LEAVE statement is used for leaving from the current screen or list in ABAP programs.
It can be used for
- Stop the current screen processing
- Switch between lists and screens
- Stop the current ABAP program processing
- Call another program using transaction code in an ABAP program.
LEAVE statement for screen
LEAVE SCREEN.
This statement will stop the execution of current screen and will process the next subsequent screen.
LEAVE TO SCREEN <scr>.
This statement will stop the execution of current screen and will process the specified screen (<scr>) next.
LEAVE statement for switch between lists and screens
LEAVE LIST-PROCESSING.
This statement will switch from the current list processing to the screen processing.
LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <scr>].
This statement is used for switching from the screen to list processing.
RETURN TO SCREEN addition is used for specifying a screen to process after the list processing.
LEAVE ABAP programs.
LEAVE [PROGRAM].
It will stop the processing of current ABAP program.
LEAVE TO TRANSACTION <tcod> [AND SKIP FIRST SCREEN].
It will stop the processing of current ABAP program and will process another program (specified with its transaction code).
SKIP FIRST SCREEN addition is used for skipping the initial screen of the called program.
Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes