REPORT  ZALV_HIE                                 .

DATA: IT_VBRK LIKE VBRK OCCURS 1 WITH HEADER LINE.
DATA: IT_VBRP LIKE VBRP OCCURS 1 WITH HEADER LINE.

TYPE-POOLS: SLIS.

DATA: WA_KEY TYPE SLIS_KEYINFO_ALV.

SELECT-OPTIONS: S_VBELN FOR IT_VBRK-VBELN.

START-OF-SELECTION.
  PERFORM GET_DATA.


END-OF-SELECTION.
  PERFORM SHOW_HIRAR_GRID.
FORM GET_DATA .
  SELECT *
    FROM VBRK
    INTO TABLE IT_VBRK
    WHERE VBELN IN S_VBELN.

  SELECT *
    FROM VBRP
    INTO TABLE IT_VBRP
    WHERE VBELN IN S_VBELN.

ENDFORM.                    " GET_DATA

FORM SHOW_HIRAR_GRID .

  WA_KEY-HEADER01 = 'VBELN'.
  WA_KEY-ITEM01 = 'VBELN'.


  CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM      = 'ZALV_HIE'
      I_TABNAME_HEADER        = 'IT_VBRK'
      I_TABNAME_ITEM          = 'IT_VBRP'
      I_STRUCTURE_NAME_HEADER = 'VBRK'
      I_STRUCTURE_NAME_ITEM   = 'VBRP'
      IS_KEYINFO              = WA_KEY
    TABLES
      T_OUTTAB_HEADER         = IT_VBRK[]
      T_OUTTAB_ITEM           = IT_VBRP[]
    EXCEPTIONS
      PROGRAM_ERROR           = 1
      OTHERS                  = 2.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    " SHOW_HIRAR_GRID
 
 
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com