sapdev logo background
sapdev logo sapdev logo
Comments

SAP OS PERSISTENCE COMMIT documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

Saving Persistent Objects
The ABAP statement COMMIT WORK must be executed to apply any changes to the runtime objects of persistent classes to the actual persistent objects in the database. If an object-oriented transaction from the transaction sevice is not used explicitly, the statement
COMMIT WORK must be specified explicitly. If not, it is encapsulated in the transaction service. Specifying the statement COMMIT WORK explicitly means, in the transaction service, that the top level transaction runs in compatibility mode.
The classic statement COMMIT WORK has additional functions when used in conjunction with object services. Before the statement closes the SAP LUW and triggers an update, it calls methods of the persistence service internally. These methods bundle the changes made to managed objects of the persistence service and pass them to a special update function module using CALL FUNCTION ... IN UPDATE TASK . This means that the persistence service works with traditional update methods. The update module is usually registered after any update modules that have already been registered. The update is then triggered and the update task executes the update module in the order in which they were registered.
After the COMMIT WORK statement, the attributes of a persistent object in the ABAP program are initial (the method
IF_OS_STATE~INVALIDATE was called).
If the changes are to be made to managed objects directly rather than using the update module, the update mode of the implicitly used transaction service must be changed. This is done by executing the following statements before the COMMIT WORK statement:
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->GET_CURRENT_TRANSACTION( ).
T->SET_MODE_UPDATE( OSCON_DMODE_DIRECT ).
COMMIT WORK.
Persistent objects can be also used during updates � that is, within update modules. The update task changes the persistent objects in update modules as the last step after processing all the registered update modules in the database.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




OS_EXCEPTIONS
OS_PERSISTENCE_COMPS




comments powered by Disqus