Infotypes with buttons and huge data fields stored in cluster tables

...Previous   

Now we are in the module pool. Following is the source code written:
PROCESS BEFORE OUTPUT.
*         general infotype-independent operations
  MODULE BEFORE_OUTPUT.
  CALL SUBSCREEN subscreen_empl   INCLUDING empl_prog empl_dynnr.
  CALL SUBSCREEN subscreen_header INCLUDING header_prog header_dynnr.
*         infotype specific operations
  MODULE P9080.
*
  MODULE HIDDEN_DATA.
*
PROCESS AFTER INPUT.
*---------------------------------------------------------------------*
*  process exit commands
*---------------------------------------------------------------------*
  MODULE EXIT AT EXIT-COMMAND.
*---------------------------------------------------------------------*
*         processing after input
*---------------------------------------------------------------------*
*
*         check and mark if there was any input: all fields that
*         accept input HAVE TO BE listed here
*---------------------------------------------------------------------*
  CHAIN.
    FIELD P9080-BEGDA.
    FIELD P9080-ENDDA.
    FIELD P9080-ZZKEY1.
    FIELD P9080-ZZDATE.
    FIELD P9080-ZTYPEOFEXIT.
    MODULE INPUT_STATUS ON CHAIN-REQUEST.
  ENDCHAIN.
*---------------------------------------------------------------------*
*      process functioncodes before input-checks                      *
*---------------------------------------------------------------------*
  MODULE PRE_INPUT_CHECKS.
*---------------------------------------------------------------------*
*         input-checks:                                               *
*---------------------------------------------------------------------*
*   insert check modules here:
*  ...
*---------------------------------------------------------------------*
*     process function code: ALL fields that appear on the
*      screen HAVE TO BE listed here (including output-only fields)
*---------------------------------------------------------------------*
  CHAIN.
    FIELD P9080-BEGDA.
    FIELD P9080-ENDDA.
    FIELD RP50M-SPRTX.
    FIELD P9080-ZZKEY1.
    FIELD P9080-ZZDATE.
    FIELD P9080-ZTYPEOFEXIT.
    MODULE POST_INPUT_CHECKS.
  ENDCHAIN.

We will first of all go to the graphical layout of this infotype, change some texts, and create a button on which we can call a sub screen.

Click on the Layout button. 

First of all we will delete the input field p9080-zzkey1 and we will create a button there. There is a field in our infotypes database table (which is pa9080) named zzkey . We would not be displaying this field in the infotype. But whenever a record is created, a unique key comprising of Personal number, current date and current time would be inserted in the database table pa980's zzkey1 field. This key would act as a pointer to the cluster table where we would be storing the 'Huge Data'. It would help us retrieve data from cluster table PCL3 while displaying the already created data and while making any report or form on our infotype.

After deleting the field zzkey1 from layout, create a button at that place 

 

Let us give it a name 'B1' and give its functional code say 'T1'. Click on the icon button next to Icon name field in the properties box of this button and choose the icon say ' ICON_DESELECT_ALL' . It would make our button as shown above.

Nets change the text 'Key for what we did' to ' What did you like most about working in our company ' by double clicking and going into the properties of the text and changing text there as shown: 

Now, if we activate our screen and see the infotype in PA30, the button would come grey and we wont be able to press it or perform any action on it.

To make the button 'Alive' in the infotype, we need to give specific screen group codes to it. In the properties box of our button, give ' 01F' in the first box of the 'Groups' and ' 004' in the second box of the 'Groups' section as shown. 

Our button is now 'Alive'. Lets go for the coding part now to open a sunscreen on click of this button, unique key generation and storing of data in the cluster table.

Save and close the layout so we are again in module pool of the screen.

Now when we check the module pool program by pressing 'Ctrl + F2' , it gives us an error. 

 

This error is coming since we deleted the input field zzkey1 from the layout. So we need to deactivate the lines wherever it is being used in the code:
PROCESS BEFORE OUTPUT.
*         general infotype-independent operations
  MODULE BEFORE_OUTPUT.
  CALL SUBSCREEN subscreen_empl   INCLUDING empl_prog empl_dynnr.
  CALL SUBSCREEN subscreen_header INCLUDING header_prog header_dynnr.
*         infotype specific operations
  MODULE P9080.
*
  MODULE HIDDEN_DATA.
*
PROCESS AFTER INPUT.
*---------------------------------------------------------------------*
*  process exit commands
*---------------------------------------------------------------------*
  MODULE EXIT AT EXIT-COMMAND.
*---------------------------------------------------------------------*
*         processing after input
*---------------------------------------------------------------------*
*
*         check and mark if there was any input: all fields that
*         accept input HAVE TO BE listed here
*---------------------------------------------------------------------*
  CHAIN.
    FIELD P9080-BEGDA.
    FIELD P9080-ENDDA.
*    FIELD P9080-ZZKEY1. --> Here 
    FIELD P9080-ZZDATE.
    FIELD P9080-ZTYPEOFEXIT.
    MODULE INPUT_STATUS ON CHAIN-REQUEST.
  ENDCHAIN.
*---------------------------------------------------------------------*
*      process functioncodes before input-checks                      *
*---------------------------------------------------------------------*
  MODULE PRE_INPUT_CHECKS.
*---------------------------------------------------------------------*
*         input-checks:                                               *
*---------------------------------------------------------------------*
*   insert check modules here:
*  ...
*---------------------------------------------------------------------*
*     process function code: ALL fields that appear on the
*      screen HAVE TO BE listed here (including output-only fields)
*---------------------------------------------------------------------*
  CHAIN.
    FIELD P9080-BEGDA.
    FIELD P9080-ENDDA.
    FIELD RP50M-SPRTX.
*    FIELD P9080-ZZKEY1.  --> Here
    FIELD P9080-ZZDATE.
    FIELD P9080-ZTYPEOFEXIT.
    MODULE POST_INPUT_CHECKS.
  ENDCHAIN.

Click here to continue....

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image