SAP LEAVE PROCESSING BLOCKS



Get Example source ABAP code based on a different SAP table
  



Exiting Processing Blocks
Processing blocks can be exited implicitly using:
regular exiting
or program-driven, using:
RETURN
EXIT
CHECK
STOP
BEGIN_SECTION VERSION 5 OUT
CHECK SELECT-OPTIONS (obsolete, for logical databases only)
REJECT (obsolete, for logical databases only)
END_SECTION VERSION 5 OUT
The subsequent program flow depends on the type of processing block.
In addition to the statements described here, statements that call other units without returning to the caller after the call is made, also terminate their processing block. These include:
LEAVE $[TO$] SCREEN
LEAVE LIST-PROCESSING
LEAVE TO TRANSACTION
SUBMIT without AND RETURN
Messages and raised exceptions can also exit processing blocks.

ABAP_PGL
Only use RETURN to exit procedures
ABAP_PGL_END



Latest notes:

Exiting a procedure using RETURN, EXIT or CHECK is the error-free termination of the procedure. Formal parameters for which the pass by value is defined are not passed to the assigned actual parameters only if the procedure terminates after an error (an exception is raised or a message is sent).
NON_V5_HINTS
The statements for exiting programs are not recommended inside procedures. They are not allowed in contexts like unit tests or during update and lead to exceptions if a procedure is called from such a context.
ABAP_HINT_END