sapdev logo background
sapdev logo sapdev logo
Comments

ABAP LEAVE TO TRANSACTION Statement syntax, information and example SAP source code



Return to Statement index



LEAVE TO TRANSACTION

Short Reference

ABAP Syntax_2 LEAVE TO { {TRANSACTION ta} | {CURRENT TRANSACTION} }
[AND SKIP FIRST SCREEN].

ABAP_ADDITION:
... AND SKIP FIRST SCREEN

What does it do? The statement LEAVE TO TRANSACTION calls either the transaction whose transaction code is contained in data object ta , or the current transaction. The data object ta must be character-like, flat and contain the transaction code in uppercase letters.
When CURRENT TRANSACTION is specified, the current transaction is called using the transaction code that was used to call the transaction using CALL TRANSACTION or LEAVE TO TRANSACTION
. This transaction code is contained in the system field sy-tcode
except for parameter transactions
or variant transactions . When using parameter actions or variant transactions, their transaction code is used for the call and sy-tcode contains the name of the implicitly called dialog transaction
.
When using LEAVE TO TRANSACTION , the current call sequence is exited completely. Upon completion of the called transaction, the runtime environment returns to the position where the first program in the call sequence was called. The current SAP LUW is thereby ended.
When the transaction is called, the ABAP program associated with the transaction code is loaded in a new internal session. All previous internal sessions are deleted from the stack. At the same time, the ABAP memory is deleted, which means that EXPORT FROM MEMORY or IMPORT TO MEMORY do not transfer data when using LEAVE TO TRANSACTION .
The steps of the called dialog transaction or OO transaction are the same as with CALL TRANSACTION . When the called transaction is exited, the runtime environment returns to the position where the first program in the current call sequence was called.
If the transaction specified in ta is not found, or if ta
is initial or blank, the stack of the current call sequence is deleted and the runtime environment returns directly to the position where the first program in the current call sequence was called. If
ta is not initial, an appropriate message appears in the status bar.
The LEAVE TO TRANSACTION statement always terminates the current call sequence, regardless of whether or not a new transaction can be called.
Contrary to the statement CALL TRANSACTION , the authorization of the current user for executing the called transaction is always automatically checked by the authorization object S_TCODE
(and the authorization object specified in the definition of the transaction code (transaction SE93 ) when using the statement LEAVE TO TRANSACTION . If the required authorization is missing, a message with
message type A (
termination message ) is triggered and the system responds appropriately.
Latest notes: The CURRENT TRANSACTION call can be used to execute a current parameter transaction or variant transaction with the corresponding parameters or the transaction variant. Alternatively, the method GET_CURRENT_TRANSACTION of the class CL_DYNPRO can be used to obtain the transaction code of the current transaction. This method returns the transaction code during a parameter transaction or variant transaction instead of the transaction code of the implicitly called dialog transaction.
LEAVE TO TRANSACTION does not end the current database LUW . A database commit or database rollback in the called program works in exactly the same way as in the current program.
If procedures are still registered at LEAVE TO TRANSACTION in the current SAP LUW , the SAP LUW is ended and the procedures are not called or rolled back. Registered update function modules remain in the database, but can no longer be executed. In a case like this, therefore, it is advisable to execute the statement
COMMIT WORK or ROLLBACK WORK explicitly before the program call.
Specifying a transaction in a variable data object ta is one of the dynamic programming techniques. See Dynamic Calls .

ABAP_ADDITION ... AND SKIP FIRST SCREEN

What does it do? The addition AND SKIP FIRST SCREEN has the same meaning as with CALL TRANSACTION .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




LEAVE_TO_LIST-PROCESSING
LOAD




comments powered by Disqus