* Bausteine REUSE_ALV_GRID_DISPLAY und REUSE_ALV_COMMENTARY_WRITE sind obsolet
* stattdessen sollten die Klassen cl_gui_alv_grid bzw. cl_salv_table verwendet werden
DATA: it_header TYPE slis_t_listheader.
DATA: lv_comment LIKE LINE OF it_header.
DATA: it_flight LIKE TABLE OF sflight.
DATA: it_event TYPE slis_t_event.
DATA: lv_event TYPE LINE OF slis_t_event.
START-OF-SELECTION.
lv_comment-typ = 'H'. " H = Header, S = Selection, A = Action
lv_comment-key = 'COM_KEY1'.
lv_comment-info = 'Überschrift'.
APPEND lv_comment TO it_header.
lv_comment-typ = 'S'. " H = Header, S = Selection, A = Action
lv_comment-key = 'COM_KEY2'.
lv_comment-info = 'Infotext'.
APPEND lv_comment TO it_header.
lv_comment-typ = 'A'. " H = Header, S = Selection, A = Action
lv_comment-key = 'COM_KEY2'.
lv_comment-info = 'Infotext2'.
APPEND lv_comment TO it_header.
lv_event-name = 'TOP_OF_PAGE'.
lv_event-form = 'TOP_LINE'.
APPEND lv_event TO it_event.
CLEAR lv_event.
SELECT * FROM sflight INTO TABLE it_flight UP TO 100 ROWS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'SFLIGHT'
i_callback_program = sy-repid
it_events = it_event
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
FORM top_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header
i_logo = 'ENJOYSAP_LOGO'
i_end_of_list_grid = it_flight.
ENDFORM.
[ABAP] ALV-Grid mit Header-Zeile
* Bausteine REUSE_ALV_GRID_DISPLAY und REUSE_ALV_COMMENTARY_WRITE sind obsolet * stattdessen sollten die Klassen cl_gui_alv_grid bzw. cl_salv_table verwendet werden DATA: it_header TYPE slis_t_listheader. DATA: lv_comment LIKE LINE OF it_header. DATA: it_flight LIKE TABLE OF sflight. DATA: it_event TYPE slis_t_event. DATA: lv_event TYPE LINE OF slis_t_event. START-OF-SELECTION. lv_comment-typ = 'H'. " H = Header, S = Selection, A = Action lv_comment-key = 'COM_KEY1'. lv_comment-info = 'Überschrift'. APPEND lv_comment TO it_header. lv_comment-typ = 'S'. " H = Header, S = Selection, A = Action lv_comment-key = 'COM_KEY2'. lv_comment-info = 'Infotext'. APPEND lv_comment TO it_header. lv_comment-typ = 'A'. " H = Header, S = Selection, A = Action lv_comment-key = 'COM_KEY2'. lv_comment-info = 'Infotext2'. APPEND lv_comment TO it_header. lv_event-name = 'TOP_OF_PAGE'. lv_event-form = 'TOP_LINE'. APPEND lv_event TO it_event. CLEAR lv_event. SELECT * FROM sflight INTO TABLE it_flight UP TO 100 ROWS. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_structure_name = 'SFLIGHT' i_callback_program = sy-repid it_events = it_event TABLES t_outtab = it_flight EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc NE 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. FORM top_line. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = it_header i_logo = 'ENJOYSAP_LOGO' i_end_of_list_grid = it_flight. ENDFORM.