The transaction service implicitly or explicitly deals with the update of persistent objects, which were created in the program or whose persistent attributes were changed.
To work with the transaction service you need to have access to the Transaction Manager of the Object Services Manager which implements the
This access is enabled by the methods INIT_AND_SET_MODES and GET_TRANSACTION_MANAGER in the
system service class
By using method CREATE_TRANSACTION of the Transaction Manager you can create transactions which you can access using the
- IF_OS_TRANSACTION interface.
The most important methods of a transaction are:
The following example assumes that the program is running in the object-oriented transaction mode. That
is, either the transaction is specified as a OO transaction in Transaction Maintenance
for which the OO transaction model is marked or the INIT_AND_SET_MODES is
called before there is any access to a persistent object (where the parameter I_EXTERNAL_COMMIT must
be set to OSCON_FALSE). Only then the END method starts an update. Otherwise the program is in the compatibility
mode, in which you must explicitly specify the
COMMIT WORK statement after the end of a transaction.
data TM type ref to IF_OS_TRANSACTION_MANAGER.
data T type ref to IF_OS_TRANSACTION.
TM = CL_OS_SYSTEM=>GET_TRANSACTION_MANAGER( ).
T = TM->CREATE_TRANSACTION( ).
... "Change persistent Objects