An application program can be split into several program sections, which are processed in sequence using different
work processes. Each switch of a work process is associated with an implicit
database commit, which means that an application program is not associated with a single
database LUW automatically. More specifically, this applies to dialog-oriented applications with classic
SAP GUI in which each
dialog step is assigned a database LUW.
To ensure the data consistency of application programs that are executed across multiple work processes,
the change statements are not executed directly in an SAP LUW. Instead, they are first registered and then executed by a single work process, that is in a single database LUW.
The statement PERFORM ... ON COMMIT is used to register a subroutine for later execution in a different work process.
A function module can be specified as either an update function module or as remote-enabled, but not both at the same time. The update is used to realize SAP LUWs within
AS ABAP, while transactional RFC creates LUWs in distributed systems.
Statements for SAP LUWs
Each opening of a new internal
session (except for the statement CALL DIALOG) starts a new SAP LUW which can be controlled by the Open SQL statements
Each closing of an internal session ends the current SAP LUW.
The statements COMMIT WORK and ROLLBACK WORK
determine the limits of a SAP LUW. An ABAP program can be divided into any number of SAP LUWs, whereby
the end of an ABAP program always ends the last SAP LUW as well. Calling ABAP programs with CALL TRANSACTION or SUBMIT ... AND RETURN provides the option of nesting SAP LUWs.
If a program is ended or an internal session closed using
SUBMIT without AND RETURN or LEAVE TO TRANSACTION and procedures are still registered in the current
SAP LUW, the SAP LUW is ended without the procedures being called or rolled back. Registered update function modules are persisted on the database, but can no longer be executed.
The system class CL_SYSTEM_TRANSACTION_STATE contains methods that get the status of the current SAP LUW.