0% found this document useful (0 votes)
62 views4 pages

Types Begin of Type Type Type Type Type End of Begin of Type Type Type Type End of Data Type Standard Table of Type Standard Table of Type Type Type

The document describes creating an ALV hierarchical sequential list display of sales order data from tables VBAK and VBAP. It defines internal tables for the header and item data, populates them from the database tables, and defines the necessary parameters to display the data in an ALV grid with the header and item data connected by a common key field.

Uploaded by

sksk1911
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views4 pages

Types Begin of Type Type Type Type Type End of Begin of Type Type Type Type End of Data Type Standard Table of Type Standard Table of Type Type Type

The document describes creating an ALV hierarchical sequential list display of sales order data from tables VBAK and VBAP. It defines internal tables for the header and item data, populates them from the database tables, and defines the necessary parameters to display the data in an ALV grid with the header and item data connected by a common key field.

Uploaded by

sksk1911
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 4

REPORT ZMR_HIERSEQ_LIST_ALV.

TYPES : BEGIN OF TY_VBAK,


VBELN TYPE VBAK-VBELN,
ERDAT TYPE ERDAT,
KUNNR TYPE KUNNR,
NETWR TYPE NETWR_AK,
EXPAND TYPE CHAR1,
END OF TY_VBAK,
BEGIN OF TY_VBAP,
VBELN TYPE VBELN_VA,
POSNR TYPE POSNR_VA,
MATNR TYPE MATNR,
NETWR TYPE NETWR_AP,
END OF TY_VBAP.
DATA : LT_VBAK TYPE STANDARD TABLE OF TY_VBAK,
LT_VBAP TYPE STANDARD TABLE OF TY_VBAP.

DATA: LV_TABNAME_HEADER TYPE SLIS_TABNAME.


DATA: LV_TABNAME_ITEM TYPE SLIS_TABNAME.
DATA: WA_KEYINFO TYPE SLIS_KEYINFO_ALV.

START-OF-SELECTION.
SELECT VBELN ERDAT KUNNR NETWR FROM VBAK INTO TABLE LT_VBAK UP TO 10 ROWS.
IF SY-SUBRC = 0.
SELECT VBELN POSNR MATNR NETWR FROM VBAP INTO TABLE LT_VBAP FOR ALL
ENTRIES IN LT_VBAK
WHERE VBELN = LT_VBAK-VBELN.
ENDIF.

LV_TABNAME_HEADER = 'LT_VBAK'.
LV_TABNAME_ITEM = 'LT_VBAP'.

WA_KEYINFO-header01 = 'VBELN'.
WA_KEYINFO-item01 = 'VBELN'.

DATA : LT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,


WA_FLDCAT TYPE SLIS_FIELDCAT_ALV.

wa_fldcat-fieldname = 'VBELN'.
wa_fldcat-tabname = 'LT_VBAK'.
wa_fldcat-col_pos = 1.
wa_fldcat-seltext_s = 'Number'.
wa_fldcat-seltext_m = 'Number'.
wa_fldcat-seltext_l = 'Number'.

* wa_fldcat-ref_fieldname = 'VBELN'.
* WA_FLDCAT-ref_tabname = 'VBAK'.
append wa_fldcat to lt_fldcat.
clear wa_fldcat.

wa_fldcat-fieldname = 'ERDAT'.
wa_fldcat-tabname = 'LT_VBAK'.
wa_fldcat-col_pos = 2.
wa_fldcat-ref_fieldname = 'ERDAT'.
WA_FLDCAT-ref_tabname = 'VBAK'.
append wa_fldcat to lt_fldcat.
clear wa_fldcat.

wa_fldcat-fieldname = 'KUNNR'.
wa_fldcat-tabname = 'LT_VBAK'.
wa_fldcat-col_pos = 3.
wa_fldcat-ref_fieldname = 'KUNNR'.
WA_FLDCAT-ref_tabname = 'VBAK'.
append wa_fldcat to lt_fldcat.
clear wa_fldcat.

wa_fldcat-fieldname = 'NETWR'.
wa_fldcat-tabname = 'LT_VBAK'.
wa_fldcat-col_pos = 4.
wa_fldcat-ref_fieldname = 'NETWR'.
WA_FLDCAT-ref_tabname = 'VBAK'.
append wa_fldcat to lt_fldcat.
clear wa_fldcat.
*ITEM
wa_fldcat-fieldname = 'POSNR'.
wa_fldcat-tabname = 'LT_VBAP'.
wa_fldcat-col_pos = 1.
wa_fldcat-ref_fieldname = 'POSNR'.
WA_FLDCAT-ref_tabname = 'VBAP'.
append wa_fldcat to lt_fldcat.
clear wa_fldcat.

wa_fldcat-fieldname = 'MATNR'.
wa_fldcat-tabname = 'LT_VBAP'.
wa_fldcat-col_pos = 2.
wa_fldcat-ref_fieldname = 'MATNR'.
WA_FLDCAT-ref_tabname = 'VBAP'.
append wa_fldcat to lt_fldcat.
clear wa_fldcat.
wa_fldcat-fieldname = 'NETWR'.
wa_fldcat-tabname = 'LT_VBAP'.
wa_fldcat-col_pos = 3.
wa_fldcat-ref_fieldname = 'NETWR'.
WA_FLDCAT-ref_tabname = 'VBAP'.
append wa_fldcat to lt_fldcat.
clear wa_fldcat.

DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.


WA_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = LT_FLDCAT
i_tabname_header = LV_TABNAME_HEADER
i_tabname_item = LV_TABNAME_ITEM

is_keyinfo = WA_KEYINFO
TABLES
t_outtab_header = LT_VBAK
t_outtab_item = LT_VBAP
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

You might also like