Report ZTEST.
TYPE-POOLS: SLIS.DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, FIELDCAT_LN LIKE LINE OF FIELDCAT, SORTCAT TYPE SLIS_T_SORTINFO_ALV, SORTCAT_LN LIKE LINE OF SORTCAT, EVENTCAT TYPE SLIS_T_EVENT, EVENTCAT_LN LIKE LINE OF EVENTCAT.DATA: COL_POS TYPE I.
Mara.Data: Begin of Itab Occurs 10, Matnr Like Mara-Matnr, Mtart Like Mara-Matart, Bismt Like Mara-Bismt, End of Itab.
Select-Options: p_matnr for mara-matnr.
START-OF-SELECTION.SELECT MATNR Matart Bismt Into Corresponding Fields of Table Itab from Mara WHERE MATNR IN P_MATNR.
ADD 1 TO COL_POS.FIELDCAT_LN-REF_TABNAME = 'MARA'.FIELDCAT_LN-FIELDNAME =' MTART'.FIELDCAT_LN-KEY = SPACE.FIELDCAT_LN-DO_SUM = SPACE.FIELDCAT_LN-COL_POS = COL_POS.FIELDCAT_LN-NO_OUT = SPACE.FIELDCAT_LN-QFIELDNAME = SPACE .Fieldcat_ln-hotspot = space.append fieldcat_ln tofieldcat.
ADD 1 TO COL_POS.FIELDCAT_LN-REF_TABNAME = 'MARA'.FIELDCAT_LN-FIELDNAME =' MATNR'.FIELDCAT_LN-KEY = SPACE.FIELDCAT_LN-DO_SUM = SPACE.FIELDCAT_LN-COL_POS = COL_POS.FIELDCAT_LN-NO_OUT = SPACE.FIELDCAT_LN-QFIELDNAME = SPACE .Fieldcat_ln-hotspot = space.append fieldcat_ln tofieldcat.
ADD 1 TO COL_POS.FIELDCAT_LN-REF_TABNAME = 'MARA'.FIELDCAT_LN-FIELDNAME =' BISMT'.FIELDCAT_LN-KEY = SPACE. * DEFINE AN SUMFIELDCAT_LN-DO_SUM = 'X'.FIELDCAT_LN-COL_POS = COL_POS.FIELDCAT_LN-NO_OUT = SPACE. FIELDCAT_LN-QFIELDNAME = SPACE.FIELDCAT_LN-HOTSPOT = SPACE.APPEND FIELDCAT_LN TO FIELDCAT. * DEFINE AN SORT TABLE * ADD SORT INTO SORT INTERNAL TABLE.SORTCAT_LN-SPOS = '1'. * DEFINE AN SORT FIELDSORTCAT_LN-FIELDNAME = 'BISMT'. Sortcat_ln-up = 'x'.sortcat_ln-down = space.sortcat_ln-subtot =' X'.Append Sortcat_ln to Sortcat.
* Define EVENT LIST (EVENT CATALOGS) EventCAT_LN-NAME = 'TOP_OF_PAGE'.Eventcat_ln-form =' page_header'.Append Eventcat_ln to Eventcat.
* Define Alv Call Function Moduledata: pgm like Sy-repid.pgm = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'EXPORTING I_CALLBACK_PROGRAM = PGM I_CALLBACK_USER_COMMAND =' USER_COMMAND 'IT_FIELDCAT = FIELDCAT IT_SORT = SORTCAT I_SAVE =' A 'IT_EVENT = EVENTCAT TABLES T_OUTTAB = ITABEXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2.
* Define Event of the User Clicked Keyboard.