*TO CAPTURE EVENTS AND HANDLE
DATA : it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event.
*&---------------------------------------------------------------------*
* POPULATE ALL EVENTS INTO INTERNAL TABLE
*&---------------------------------------------------------------------*
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 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.
READ TABLE it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
wa_event-form = 'END'. "sub-routine that will be used to write
MODIFY it_event FROM wa_event INDEX sy-tabix. "modify it_events
CLEAR wa_event.
*&---------------------------------------------------------------------*
* POPULATE ALV GRID WITH DATA
*&---------------------------------------------------------------------*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid "report id
it_fieldcat = it_field "field catalog internal table
it_sort = it_sort "sort by field internal table
it_events = it_event "internal table containing events
TABLES
t_outtab = itab "internal table containing data to be displayed
EXCEPTIONS
program_error = 1
OTHERS = 2.
*&---------------------------------------------------------------------*
*& Form end
*&---------------------------------------------------------------------*
* TO WRITE THE FOOTER
*----------------------------------------------------------------------*
FORM end.
REFRESH it_end.
wa_end-typ = 'S'.
wa_end-key = text-001.
wa_end-info = rep_id.
APPEND wa_end TO it_end.
CLEAR wa_end.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_end
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM. "end