Infotypes with buttons and huge data fields stored in cluster tables

...Previous   

Our program is now error free. Activate it and come back to PM01 screen. Now choose the 'Module pool' radio button and click on edit and on the next screen, click change.

We are in the main program of the infotype - here we see the following code:
INCLUDE MP908010. <-- Double click here  " Data Definitions 
INCLUDE MPPDAT00.                        " Global Data     - Do not change
INCLUDE FP50PPSB.                        " Buffer          - Do not change
INCLUDE MPPERS00.                        " Standard Modules- Do not change
INCLUDE MP908020.                        " Output Modules
INCLUDE MP908030.                        " Input Modules
INCLUDE MP908040.                        " Subroutines
INCLUDE MP908050.

Double click on the 'Data definition include and we are with the following code:

*----------------------------------------------------------------------*
*                                                                      *
*       Data definition for infotype 9080                              *
*                                                                      *
*----------------------------------------------------------------------*
PROGRAM MP908000 MESSAGE-ID RP.
TABLES: P9080.
* the following tables are filled globally:
* T001P, T500P
* they can be made available with a TABLES-statement
FIELD-SYMBOLS: <PNNNN> STRUCTURE P9080
                       DEFAULT P9080.
DATA: PSAVE LIKE P9080.
Add the following data declaration there.
TYPES: BEGIN OF TY_ALKEY,
        PERNR TYPE P0001-PERNR,
        AEDTM TYPE SY-DATUM,
        TIME TYPE SY-UZEIT,
        key type char2,
END OF TY_ALKEY.
DATA: AL_KEYtab TYPE TABLE OF TY_ALKEY,
 IT_TEXT1 TYPE TABLE OF TXW_NOTE,
  it_ln like line of it_text1,
 itab type table of pa9080 with header line,
 AL_KEY1  LIKE LINE OF AL_KEYtab,
  pcomm type sy-ucomm,
 pp type c value 'X'.

Check and activate the code and come back to the PM01 transaction.

Again choose 'Screen' radio button , click on edit and on the next screen click change.

Now we are on the Module pool.

Add a PBO module ' MODULE Z9080’ as shown in the code below.
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 P9001.
  module z9080.    <-- Add it here
*
  MODULE HIDDEN_DATA.
*
  PROCESS AFTER INPUT. 

Now Double click on  ' module z9080. '

It asks " PBO Module Z9080 does not exist.Create Object?"

Click yes and give an include name starting with 'Z'.

 

Click on the green tick mark and we are now in the PBO module ' MODULE Z9080 OUTPUT'

Give the following code there:

*----------------------------------------------------------------------*
***INCLUDE Z9080O01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  Z9080  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE Z9080 OUTPUT.
  PCOMM = SY-UCOMM.
** Generate the Unique Key for the Cluster.
  PERFORM F001_GENERATE_CLUSTER_KEY.
  IF PSYST-IOPER = 'DIS'.
    PP = ' '.
  ENDIF.
  CASE PCOMM.
    WHEN 'T1'.
**   Import the Text from the cluster which is stored in the Infotype.
      IF P9080-ZZKEY1 IS NOT INITIAL.
        IMPORT IT_TEXT1 FROM DATABASE PCL3(AN) ID P9080-ZZKEY1.
      ENDIF.
** Call the text editor.
      CALL FUNCTION 'TXW_TEXTNOTE_EDIT'
        EXPORTING
          EDIT_MODE = PP
        TABLES
          T_TXWNOTE = IT_TEXT1.
      P9080-ZZKEY1 = AL_KEY1.
** Export the latest changes to the cluster.
      EXPORT IT_TEXT1 TO DATABASE PCL3(AN) ID P9080-ZZKEY1.
** Update the field with the Cluster Key.
    WHEN 'UPD'.
** When Save button is clicked the latest key is stored in the Infotype and
** also the latest changes are reflected in the cluster.
      EXPORT IT_TEXT1 TO DATABASE PCL3(AN) ID P9080-ZZKEY1.
      CLEAR IT_TEXT1.
  ENDCASE.
ENDMODULE.                 " z9080  OUTPUT
*&---------------------------------------------------------------------*
*&      Form  f001_generate_cluster_key
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM F001_GENERATE_CLUSTER_KEY .
  AL_KEY1-PERNR   = P9080-PERNR .  " PERNR
  AL_KEY1-AEDTM   = SY-DATUM.  " Startdate
  AL_KEY1-TIME = SY-UZEIT.
  AL_KEY1-KEY = '1'.
* Remaining fields of the cluster
  PCL3-AEDTM     =  SY-DATUM.     " Current System Date
  PCL3-UNAME     =  SY-UNAME.     " User Name
  PCL3-PGMID     =  SY-REPID.     " Program Name
  PCL3-VERSN     =  '01'. " Version for Cluster
ENDFORM.                    " f001_generate_cluster_key

Check and activate the code and the main module pool too.  All things being taken care off - When we want to see the infotype in display mode, the field pp would be blank and the same would be passed to 'TXW_TEXTNOTE_EDIT' and it will open the sub screen in display mode and pull up the data from the cluster table PCL3 using the key generated.

Our infotype is now ready for use - see it in PA30 

 

When we press this button, a sub screen comes up and we can enter large text.

Close the sub screen and save the infotype. Lets see our infotype in the display mode now: 

So all set and done!!!!!

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