Get Example source ABAP code based on a different SAP table
Standard SAP Help for LEAVE
Short Reference > • LEAVE LIST-PROCESSING ABAP Statement
ABAP_BASIC_FORM_6 LEAVE LIST-PROCESSING.>
What does it do? This statement immediately exits the list processor. The runtime environment continues processing with the PBO> event of the dynpro from which the list processor was called using LEAVE TO LIST-PROCESSING> > or the dynpro that was set using the addition AND RETURN TO SCREEN>> of this statement.
If the statement is not executed when the list is displayed by the list processor, it is ignored, except in the event blocks for reporting events>. Here, the processor branches to the end of the program and continues in accordance with the process flow> for executable programs.
When the list processor is exited, the list buffer of thedynpro sequence> is initialized. New output statements describe a new basic list.
Example ABAP Coding This example shows the recommended procedure for displaying lists during dynpro sequences. A separate dynpro 500 is defined for calling the list processor. The screen> of this dynpro does not contain any screen elements and calls a single PBO module call_list> but no PAI> modules. The full basic list, including the GUI status, is defined in the PBO module. When the dynpro is exited using LEAVE SCREEN>, its processing is stopped and the list processor is started. The list events are handled in the same program. When the list processor is exited, the dynpro sequence of dynpro 500 is ended, because the next dynpro> 0 is specified when the list processor is called. PROGRAM demo NO STANDARD PAGE HEADING.
MODULE call_list OUTPUT. SET PF-STATUS space. WRITE 'Basic List'. LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0. LEAVE SCREEN. ENDMODULE.
TOP-OF-PAGE. WRITE 'Header' COLOR COL_HEADING. ULINE.
TOP-OF-PAGE DURING LINE-SELECTION. WRITE sy-lsind COLOR COL_HEADING. ULINE.
AT LINE-SELECTION. WRITE 'Secondary List'. IF sy-lsind = 20. LEAVE LIST-PROCESSING. ENDIF.