REPORT ZALV_BLOCKDIPLAY.
TYPE-POOLS SLIS.
PARAMETERS:P TYPE MARA-MATNR,
Q TYPE MARA-MATNR.
DATA:BEGIN OF IMARA OCCURS 0,
A TYPE MARA-MATNR,
B TYPE MARA-MBRSH,
C TYPE MARA-MTART,
END OF IMARA.
DATA: BEGIN OF IMARC OCCURS 0,
D TYPE MARC-MATNR,
E TYPE MARC-WERKS,
END OF IMARC.
DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA TYPE SLIS_FIELDCAT_ALV.
DATA:FCAT1 TYPE SLIS_T_FIELDCAT_ALV,
WA1 TYPE SLIS_FIELDCAT_ALV.
DATA:LT TYPE SLIS_LAYOUT_ALV.
DATA:ET TYPE SLIS_T_EVENT.
SELECT MATNR MBRSH MTART FROM MARA INTO TABLE IMARA WHERE MATNR BETWEEN P AND Q.
SELECT MATNR WERKS FROM MARC INTO TABLE IMARC WHERE MATNR BETWEEN P AND Q.
WA-REF_TABNAME = 'MARA'.
WA-COL_POS = '1'.
WA-TABNAME = 'IMARA'.
WA-FIELDNAME = 'MATNR'.
APPEND WA TO FCAT.
CLEAR WA.
WA-REF_TABNAME = 'MARA'.
WA-COL_POS = '2'.
WA-TABNAME = 'IMARA'.
WA-FIELDNAME = 'MBRSH'.
APPEND WA TO FCAT.
CLEAR WA.
WA-REF_TABNAME = 'MARA'.
WA-COL_POS = '3'.
WA-TABNAME = 'IMARA'.
WA-FIELDNAME = 'MTART'.
APPEND WA TO FCAT.
CLEAR WA.
WA1-REF_TABNAME = 'MARC'.
WA1-COL_POS = '1'.
WA1-TABNAME = 'IMARC'.
WA1-FIELDNAME = 'MATNR'.
APPEND WA1 TO FCAT1.
CLEAR WA1.
WA1-REF_TABNAME = 'MARC'.
WA1-COL_POS = '2'.
WA1-TABNAME = 'IMARC'.
WA1-FIELDNAME = 'WERKS'.
APPEND WA1 TO FCAT1.
CLEAR WA1.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = 'SY-CPROG'
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = LT
IT_FIELDCAT = FCAT[]
I_TABNAME = 'IMARA'
IT_EVENTS = ET[]
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IMARA
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
* EXPORTING
* I_INTERFACE_CHECK = ' '
* IS_PRINT =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
* 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.