The main update technique for bundling database changes in a single database LUW (Logical Unit of Work) is to use CALL FUNCTION <update_function> IN UPDATE TASK.
During program execution, when the system reaches the statement, CALL FUNCTION <update_function> IN UPDATE TASK , the function module is not executed immediately, but is scheduled for execution in a special work process (update work process). For this purpose, the name of the function module including the passed actual parameters is stored as a log record in the database table VBLOG.
Now when in program it reaches COMMIT WORK statement, it looks into that table and calls each registered functions and updates the database tables (for the corresponding INSERT/MODIFY/UPDATE/DELETE statements written in the function module).
The actual execution is triggered by the statement COMMIT WORK. The formal parameters of the function module receive the values of the actual parameters from table VBLOG. A function module that is registered several times will also be executed several times with the respective parameter values.
If a COMMIT WORK statement is not executed after registration of a function module during execution of the current program, the function module is not executed and is deleted from table VBLOG at the end of the program.
Purpose : The aim is to either COMMIT all the changes at once, or ROLLBACK them all.
If COMMIT statement is not encountered , it clears VBLOG table (so no FM is registered for change anymore) and continues the program.
Additional Info : The transaction for update requests management is SM13.
Update management is used for the following:
- Display update requests
- Analyze problems pertaining to the update
- Test and debug canceled update requests
- Display and reset the status of update requests
- Delete update requests
- Display statistics on updates