First List ALV using FM-REUSE_ALV_LIST_DISPLAY
The post REUSE_ALV_LIST_DISPLAY- 1 shows how to display a simple list alv. In this post the codes arranged properly with subroutine calls for different sections.
Records in the table – SPFLI
Program Code Snippet:
———-data declarations——–
TYPE-POOLS: slis.
DATA: lt_spfli TYPE TABLE OF spfli.
DATA: ls_layout TYPE slis_layout_alv.
———————————–
START-OF-SELECTION.
PERFORM build_data.
PERFORM build_layout.
PERFORM display_list_alv.
&————————————————-
& Form BUILD_DATA
&————————————————-
FORM build_data.
SELECT * FROM spfli INTO TABLE lt_spfli.
ENDFORM. ” BUILD_DATA
&————————————————–
& Form BUILD_LAYOUT
&————————————————–
FORM build_layout.
ENDFORM. ” BUILD_LAYOUT
&—————————————————
& Form DISPLAY_LIST_ALV
&—————————————————-*
FORM display_list_alv.
CALL FUNCTION ‘REUSE_ALV_LIST_DISPLAY’
EXPORTING
i_callback_program = sy-cprog
i_structure_name = ‘SPFLI’
is_layout = ls_layout
TABLES
t_outtab = lt_spfli
EXCEPTIONS
program_error = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 1.
MESSAGE ‘Program Error’ TYPE ‘I’.
WHEN OTHERS.
ENDCASE.
ENDFORM. ” DISPLAY_LIST_ALV
Program Output:
One comment