Ansicht
Dokumentation

ABAPLEAVE_PROGRAM - LEAVE PROGRAM

ABAPLEAVE_PROGRAM - LEAVE PROGRAM

Addresses (Business Address Services)   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

LEAVE PROGRAM

Short Reference


LEAVE PROGRAM.

Effect

This statement immediately terminates the current main program and deletes its internal session, 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 internal session in which it is executed.

The runtime framework responds to LEAVE PROGRAM depending on how the main program of the internal session 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 internal session of the calling program is also deleted, if it was preserved.

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.

Example

Exiting a program after a failed authorization check.






General Data in Customer Master   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 3588 Date: 20240616 Time: 101726     sap01-206 ( 60 ms )