Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Here I am displaying the Hierarchical ALV from list display.  

Error rendering macro 'code': Invalid value specified for parameter 'lang'
 REPORT ZTESTSTS.
*-----------------------------------------------------
*                    type pools
*----------------------------------------------------
 TYPE-POOLS: SLIS.
*----------------------------------------------------
*                    tables
*----------------------------------------------------
 TABLES:PA0002,
        PA0008.
*----------------------------------------------------
*                    internal tables
*----------------------------------------------------
 DATA:BEGIN OF IT_PA0002 OCCURS 0,
      CHECKBOX,
      PERNR LIKE PA0002-PERNR,
      BEGDA LIKE PA0002-BEGDA,
      ENDDA LIKE PA0002-ENDDA,
      VORNA LIKE PA0002-VORNA,
      NACHN LIKE PA0002-NACHN,
      END OF IT_PA0002.
 DATA:BEGIN OF IT_PA002 OCCURS 0,
      PERNR LIKE PA0002-PERNR,
      BEGDA LIKE PA0002-BEGDA,
      ENDDA LIKE PA0002-ENDDA,
      VORNA LIKE PA0002-VORNA,
      NACHN LIKE PA0002-NACHN,
      END OF IT_PA002.
 DATA:BEGIN OF IT_PA00021 OCCURS 0,
      PERNR LIKE PA0002-PERNR,
      BEGDA LIKE PA0002-BEGDA,
      ENDDA LIKE PA0002-ENDDA,
      VORNA LIKE PA0002-VORNA,
      NACHN LIKE PA0002-NACHN,
      EXPAND TYPE XFELD VALUE 'X',
      END OF IT_PA00021.
 DATA:BEGIN OF IT_PA0008 OCCURS 0,
      PERNR LIKE PA0008-PERNR,
      BEGDA LIKE PA0008-BEGDA,
      ENDDA LIKE PA0008-ENDDA,
      ANSAL LIKE PA0008-ANSAL,
      LGA01 LIKE PA0008-LGA01,
      BET01 LIKE PA0008-BET01,
      END OF IT_PA0008.
 DATA: IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
       IT_FIELD_CAT1 TYPE SLIS_T_FIELDCAT_ALV,
       IT_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
       WA_FIELD_CAT TYPE SLIS_FIELDCAT_ALV,
       WA_FIELD_CAT1 TYPE SLIS_FIELDCAT_ALV,
       IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
       IT_EVENTS TYPE SLIS_T_EVENT,
       WA_EVENTS TYPE SLIS_ALV_EVENT,
       IT_HEADER TYPE SLIS_T_LISTHEADER,
       WA_HEADER TYPE SLIS_LISTHEADER,
       WA_KEYINFO TYPE SLIS_KEYINFO_ALV.
 CONSTANTS:C VALUE 'X'.
*-----------------------------------------------
*                   selection screen
*-----------------------------------------------
 SELECT-OPTIONS: S_PERNR FOR PA0002-PERNR.
*-----------------------------------------------
*                 start of selection
*-----------------------------------------------
 START-OF-SELECTION.
   SET PF-STATUS 'DATA' .
   PERFORM GET_DATA.
   PERFORM BUILD_FIELD_CAT.
   PERFORM GET_EVENTS.
   PERFORM DISPLAY_DATA.
*&------------------------------------------------*
*&      Form  get_data
*-------------------------------------------------*
 FORM GET_DATA .
   SELECT PERNR
          BEGDA
          ENDDA
          VORNA
          NACHN
          FROM PA0002
          INTO CORRESPONDING FIELDS OF TABLE IT_PA0002
          WHERE PERNR IN S_PERNR.
 ENDFORM.                    " get_data
*&----------------------------------------------*
*&      Form  build_field_cat
*----------------------------------------------*
 FORM BUILD_FIELD_CAT .
   WA_FIELD_CAT-TABNAME = 'PA0002'.
   WA_FIELD_CAT-FIELDNAME = 'CHECKBOX'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0002'.
   WA_FIELD_CAT-REPTEXT_DDIC = 'Check Box'.
   APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
   CLEAR WA_FIELD_CAT.
   WA_FIELD_CAT-TABNAME = 'PA0002'.
   WA_FIELD_CAT-FIELDNAME = 'PERNR'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0002'.
   WA_FIELD_CAT-REPTEXT_DDIC = 'Personnel no'.
   APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
   CLEAR WA_FIELD_CAT.
   WA_FIELD_CAT-TABNAME = 'PA0002'.
   WA_FIELD_CAT-FIELDNAME = 'BEGDA'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0002'.
   WA_FIELD_CAT-REPTEXT_DDIC = 'Start date'.
   APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
   CLEAR WA_FIELD_CAT.
   WA_FIELD_CAT-TABNAME = 'PA0002'.
   WA_FIELD_CAT-FIELDNAME = 'ENDDA'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0002'.
   WA_FIELD_CAT-REPTEXT_DDIC = 'End date'.
   APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
   CLEAR WA_FIELD_CAT.
   WA_FIELD_CAT-TABNAME = 'PA0002'.
   WA_FIELD_CAT-FIELDNAME = 'VORNA'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0002'.
   WA_FIELD_CAT-REPTEXT_DDIC = 'First name'.
   APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
   CLEAR WA_FIELD_CAT.
   WA_FIELD_CAT-TABNAME = 'PA0002'.
   WA_FIELD_CAT-FIELDNAME = 'NACHN'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0002'.
   WA_FIELD_CAT-REPTEXT_DDIC = 'Last name'.
   APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
   CLEAR WA_FIELD_CAT.
   WA_FIELD_CAT1-TABNAME = 'PA0002'.
   WA_FIELD_CAT1-FIELDNAME = 'PERNR'.
   WA_FIELD_CAT1-REF_TABNAME = 'IT_PA00021'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'Personnel no'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0002'.
   WA_FIELD_CAT1-FIELDNAME = 'BEGDA'.
   WA_FIELD_CAT1-REF_TABNAME = 'IT_PA00021'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'Start date'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0002'.
   WA_FIELD_CAT1-FIELDNAME = 'ENDDA'.
   WA_FIELD_CAT1-REF_TABNAME = 'IT_PA00021'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'End date'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0002'.
   WA_FIELD_CAT1-FIELDNAME = 'VORNA'.
   WA_FIELD_CAT1-REF_TABNAME = 'IT_PA00021'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'First name'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT.
   WA_FIELD_CAT1-TABNAME = 'PA0002'.
   WA_FIELD_CAT1-FIELDNAME = 'NACHN'.
   WA_FIELD_CAT1-REF_TABNAME = 'IT_PA00021'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'Last name'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0008'.
   WA_FIELD_CAT1-FIELDNAME = 'PERNR'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0008'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'personnelno'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0008'.
   WA_FIELD_CAT1-FIELDNAME = 'BEGDA'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0008'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'begindate'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0008'.
   WA_FIELD_CAT1-FIELDNAME = 'ENDDA'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0008'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'enddate'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0008'.
   WA_FIELD_CAT1-FIELDNAME = 'ANSAL'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0008'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'annualsalary'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0008'.
   WA_FIELD_CAT1-FIELDNAME = 'LGA01'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0008'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'wagetype'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
   WA_FIELD_CAT1-TABNAME = 'PA0008'.
   WA_FIELD_CAT1-FIELDNAME = 'BET01'.
   WA_FIELD_CAT-REF_TABNAME = 'IT_PA0008'.
   WA_FIELD_CAT1-REPTEXT_DDIC = 'Amount'.
   APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
   CLEAR WA_FIELD_CAT1.
 ENDFORM.                    " build_field_cat
*&------------------------------------------------*
*&      Form  display_data
*-------------------------------------------------*
 FORM DISPLAY_DATA .
   IT_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
   IT_LAYOUT-EDIT = 'X'.
   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
       I_CALLBACK_PROGRAM       = SY-REPID
       I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
       I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
       IT_FIELDCAT              = IT_FIELD_CAT
       IS_LAYOUT                = IT_LAYOUT
       IT_EVENTS                = IT_EVENTS
     TABLES
       T_OUTTAB                 = IT_PA0002.
 ENDFORM.                    " display_data
*&------------------------------------------------*
*&      Form  get_events
*------------------------------------------------*
 FORM GET_EVENTS .
   CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
     IMPORTING
       ET_EVENTS = IT_EVENTS.
   READ TABLE IT_EVENTS INTO WA_EVENTS
                        WITH KEY NAME = SLIS_EV_TOP_OF_PAGE.
   IF SY-SUBRC = 0.
     WA_EVENTS-FORM = 'TOP_OF_PAGE'.
     MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
   ENDIF.
 ENDFORM.                    " get_events
*&--------------------------------------------*
*&      Form  top_of_page
*---------------------------------------------*
 FORM TOP_OF_PAGE.
   WA_HEADER-TYP = 'H'.
   WA_HEADER-INFO = 'EMPLOYEE DATA'.
   APPEND WA_HEADER TO IT_HEADER.
   CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
     EXPORTING
       IT_LIST_COMMENTARY = IT_HEADER.
 ENDFORM. "top_of_page
*&---------------------------------------------*
*&      Form  GUI_SET
*&---------------------------------------------*
 FORM GUI_SET USING RT_EXTAB TYPE SLIS_T_EXTAB .
   SET PF-STATUS 'DATA' .
 ENDFORM.                    "GUI_SET
*&---------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------*
 FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                         R_SELFIELD TYPE SLIS_SELFIELD.
   DATA:V_PERNR LIKE PA0002-PERNR.
   CASE R_UCOMM.
     WHEN 'DET'.
       DATA: V_FLAG.
       CLEAR : V_FLAG.
       LOOP AT IT_PA0002.
         IF IT_PA0002-CHECKBOX =  'X'.
           V_PERNR = IT_PA0002-PERNR.
           SELECT  PERNR
                   BEGDA
                   ENDDA
                   VORNA
                   NACHN
                   FROM PA0002
                   INTO CORRESPONDING FIELDS OF TABLE IT_PA00021
                   WHERE PERNR = V_PERNR.
           MOVE-CORRESPONDING IT_PA0002 TO IT_PA002.
           APPEND IT_PA002.
         ENDIF.
       ENDLOOP.
       SELECT PERNR
              BEGDA
              ENDDA
              ANSAL
              LGA01
              BET01
              FROM PA0008
              INTO TABLE IT_PA0008
              FOR ALL ENTRIES IN IT_PA002
              WHERE PERNR = IT_PA002-PERNR.
       IT_PA00021[] = IT_PA002[].
       IF NOT IT_PA0008[] IS INITIAL.
         SORT IT_PA0008 BY PERNR.
         READ TABLE IT_PA0008 INDEX 1.
       ENDIF.
       IT_LAYOUT1-GROUP_CHANGE_EDIT = C.
       IT_LAYOUT1-COLWIDTH_OPTIMIZE = C.
       IT_LAYOUT1-ZEBRA             = C.
       IT_LAYOUT1-DETAIL_POPUP      = C.
       IT_LAYOUT1-GET_SELINFOS      = C.
       IT_LAYOUT-EXPAND_FIELDNAME  = 'EXPAND'.
       WA_KEYINFO-HEADER01 = 'PERNR'.
       WA_KEYINFO-ITEM01 = 'PERNR'.
       CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
         EXPORTING
           I_CALLBACK_PROGRAM    = SY-REPID
           IS_LAYOUT             = IT_LAYOUT1
           IT_FIELDCAT           = IT_FIELD_CAT1
           I_TABNAME_HEADER      = 'PA0002'
           I_TABNAME_ITEM        = 'PA0008'
           IS_KEYINFO            = WA_KEYINFO
           I_SCREEN_START_COLUMN = 12
           I_SCREEN_START_LINE   = 6
           I_SCREEN_END_COLUMN   = 90
           I_SCREEN_END_LINE     = 35
         TABLES
           T_OUTTAB_HEADER       = IT_PA00021
           T_OUTTAB_ITEM         = IT_PA0008.
       CLEAR: IT_PA00021,IT_PA0002,IT_PA0008.
     WHEN 'BACK'.
       EXIT.
   ENDCASE.
 ENDFORM.                    "USER_COMMAND

 

*---------------------------------------

here enter the data on the selection screen.

here in the first display check the check boxes and choose display(gui status)

you will get the data on the hirarchial list display .

  • No labels