Object-Oriented Transaction Mode 
Syntax
report DEMO_TRANSACTION_SERVICE.
class CL_OS_SYSTEM definition load.
data TM type ref to IF_OS_TRANSACTION_MANAGER.
data T type ref to IF_OS_TRANSACTION.
data WA_SPFLI type SPFLI.
data: CONNECTION type ref to CL_SPFLI_PERSISTENT,
AGENT type ref to CA_SPFLI_PERSISTENT.
data: EXC type ref to CX_ROOT,
TEXT type STRING.
class TH definition.
public section.
methods HANDLE for event FINISHED of IF_OS_TRANSACTION
importing STATUS.
endclass.
class TH implementation.
method HANDLE.
if status = OSCON_TSTATUS_FIN_SUCCESS.
message 'Update commited ...' type 'I'.
endif.
endmethod.
endclass.
data H type ref to TH.
load-of-program.
CL_OS_SYSTEM=>INIT_AND_SET_MODES( I_EXTERNAL_COMMIT = OSCON_FALSE
I_UPDATE_MODE = OSCON_DMODE_DEFAULT ).
start-of-selection.
TM = CL_OS_SYSTEM=>GET_TRANSACTION_MANAGER( ).
T = TM->CREATE_TRANSACTION( ).
create object H.
set handler H->HANDLE for T.
WA_SPFLI-CARRID = 'LH'.
WA_SPFLI-CONNID = '123'.
AGENT = CA_SPFLI_PERSISTENT=>AGENT.
try.
T->START( ).
CONNECTION = AGENT->GET_PERSISTENT( I_CARRID = WA_SPFLI-CARRID
I_CONNID = WA_SPFLI-CONNID ).
WA_SPFLI-DEPTIME = CONNECTION->GET_DEPTIME( ).
WA_SPFLI-ARRTIME = CONNECTION->GET_ARRTIME( ).
WA_SPFLI-DEPTIME = WA_SPFLI-DEPTIME + 3600.
WA_SPFLI-ARRTIME = WA_SPFLI-ARRTIME + 3600.
CONNECTION->SET_DEPTIME( WA_SPFLI-DEPTIME ).
CONNECTION->SET_ARRTIME( WA_SPFLI-ARRTIME ).
T->END( ).
catch CX_ROOT into EXC.
TEXT = EXC->GET_TEXT( ).
message TEXT type 'I'.
endtry.
In this example, a transaction is run in object-oriented mode. Parameter I_EXTERNAL_COMMIT of the system service method INIT_AND_SET_MODES is set to OSCON_FALSE in the program constructor. Once a Transaction Manager and a transaction (which is also the top level transaction) have been created, the transaction is started with START and ended with END. During the transaction, attributes DEPTIME and ARRTIME of a persistent object of class CL_SPFLI_PERSISTENT are changed. Calling method END implicitly triggers a COMMIT WORK and writes the change to the database asynchronously. The HANDLE method of local class TH reacts to the end of the transaction and evaluates its status.