Get Example source ABAP code based on a different SAP table
• LEAVE PROGRAM ABAP Statement
LEAVE PROGRAM> Short Reference >
ABAP_SYNTAX LEAVE PROGRAM.>
What does it do? This statement immediately terminates the current main program> and deletes its ABAP_ISESS >, including all loaded programs, instances, and their data. The statement LEAVE PROGRAM> can appear anywhere within any processing block. It ends the program regardless of the program object or program group> of the ABAP_ISESS in which it is executed. The runtime framework responds to LEAVE PROGRAM> depending on how the main program of the ABAP_ISESS was called:
If the main program was called using CALL TRANSACTION>>, SUBMIT AND RETURN>>, or CALL DIALOG>>, the runtime framework returns to the calling program after the call position. If the main program was called using CALL DIALOG>, the output parameters of the dialog module> are passed to the calling program.
If the main program was called using LEAVE TO TRANSACTION>> or using a transaction code from within a dynpro>, the runtime framework returns to behind the position from which the first program in the current call sequence> was called.
If the main program was called using SUBMIT>> without the addition AND RETURN>, the runtime framework returns to behind the position from which the calling program was started. The ABAP_ISESS of the calling program is also deleted, if it was preserved.
Latest notes:
If procedures are still registered when a program is exited in the current SAP LUW>, the SAP LUW is terminated without calling or rolling back the procedures. Any registered update function modules> are preserved in the database but can no longer be executed. In this case, the statement COMMIT WORK>> or ROLLBACK WORK>> should be executed explicitly before exiting the program.
The statement LEAVE>> without additions is obsolete. ABAP_HINT_END
Example ABAP Coding
Exiting a program after a failed authorization check. ABEXA 00377 ABAP_EXAMPLE_END