一般列表显示(Normal List Display)
TABLES : mara.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
TYPE-POOLS: slis.
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
ernam LIKE mara-ernam,
ersda LIKE mara-ersda,
labor LIKE mara-labor,
END OF itab.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
xevents TYPE slis_t_event,
ls_event TYPE slis_alv_event,
slis_ev_top TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: v_repid LIKE sy-repid.
START-OF-SELECTION.
v_repid = sy-repid.
SELECT matnr ernam ersda labor
INTO TABLE itab
FROM mara
WHERE matnr IN s_matnr.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = xevents
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 xevents WITH KEY name = slis_ev_top
INTO ls_event.
IF sy-subrc = 0.
MOVE slis_ev_top TO ls_event-form.
APPEND ls_event TO xevents.
ENDIF.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'ITAB'
* I_STRUCTURE_NAME =
* I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
i_bypassing_buffer = 'X'
i_buffer_active = ' '
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 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_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
i_bypassing_buffer = 'X'
i_buffer_active = ' '
i_callback_program = v_repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_STRUCTURE_NAME =
* IS_LAYOUT =
it_fieldcat = i_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = 'A'
* IS_VARIANT =
IT_EVENTS = xevents
* 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
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab
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.
*&--------------------------------------------------------------------*
*& Form top_of_page
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE.
WRITE:/ 'Top of page event triggered’.
WRITE:/ ‘This report gives the material details'.
ENDFORM. "top_of_page