Program:
REPORT zsm_alv_innerjoin.
TYPE-POOLS: slis.
TYPES: BEGIN OF str,
vbeln TYPE vbeln,
erdat TYPE erdat,
ernam TYPE ernam,
audat TYPE audat,
posnr TYPE posnr,
matnr TYPE matnr,
matkl TYPE matkl,
END OF str.
DATA: it TYPE STANDARD TABLE OF str,
wa TYPE str.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
SELECT vbak~vbeln
vbak~erdat
vbak~ernam
vbak~audat
vbap~posnr
vbap~matnr
vbap~matkl FROM vbak INNER JOIN vbap ON vbak~vbeln = vbap~vbeln INTO TABLE it UP TO 50 rows.
wa_fieldcat-col_pos = '1'.
wa_fieldcat-seltext_m = 'VBELN'.
wa_fieldcat-fieldname = 'VBELN'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-seltext_m = 'ERDAT'.
wa_fieldcat-fieldname = 'ERDAT'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-seltext_m = 'ERNAM'.
wa_fieldcat-fieldname = 'ERNAM'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-seltext_m = 'AUDAT'.
wa_fieldcat-fieldname = 'AUDAT'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = '5'.
wa_fieldcat-seltext_m = 'POSNR'.
wa_fieldcat-fieldname = 'POSNR'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = '6'.
wa_fieldcat-seltext_m = 'MATNR'.
wa_fieldcat-fieldname = 'MATNR'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = '7'.
wa_fieldcat-seltext_m = 'MATKL'.
wa_fieldcat-fieldname = 'MATKL'.
APPEND wa_fieldcat TO it_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
it_fieldcat = it_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
END IF.
Output:
0 Comments