What does it do? This statement registers the update function module specified in update_function>. update_function> must be a character-like field, which contains the name of an update function module> in uppercase letters during execution of the statement. If specified, the same applies to update_function> as to general function module calls>. An update function module is a function module> for which the property update module> is flagged in the Function Builder>. The registration of an update function module is an essential part of the update>. The function module is not executed immediately, but it is scheduled for execution in a special work process (update work process) or, if local updates> are enabled, in the current work process. To do this, the name of the function module and the actual parameters passed are stored in the DDIC database tables VBMOD>> and VBDATA>>, which are managed by VBHDR>>. If the statement is executed during the update task, the addition IN UPDATE TASK> is ignored. If the statement SET UPDATE TASK LOCAL>> is executed before registration of an update function module in the current SAP LUW>, registration takes place in the ABAP memory> rather than on the database, and for the current work process. 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 the DDIC database table VBDATA>. A function module that is registered more than once is also executed more than once with the relevant parameter values. If no COMMIT WORK> statement is executed when the current program is executed after the registration of a function module, the function module is not executed and the associated entries are deleted from the corresponding DDIC database tables when the program ends. The statement ROLLBACK WORK>> deletes all previous registrations for the current SAP LUW. System Fields> The system field sy-subrc> is undefined after the statement CALL FUNCTION ... IN UPDATE TASK> is executed.
Latest notes:
No database commits> and no database rollbacks> can occur, and the update control cannot be modified during the processing of an update function module triggered using COMMIT WORK> is being processed. Any statements that would produce this situation are forbidden statements in updates> and always directly produce runtime errors.
No authorization checks> are possible while an update function module triggered using COMMIT WORK>> is being processed.
Subroutines can be registered using PERFORM ON COMMIT>> during the processing of an update function module triggered by COMMIT WORK>>. They are then executed at the end of the current update.
If a runtime error occurs during the update>, the update work process executes a database rollback>, logs this in the corresponding DDIC database tables, and notifies the user whose program created the entries by SAPMail. After the cause of the error has been resolved, the canceled entries can be updated again.
When handling the registration entries in the DDIC database tables, it should be noted that they are subject to the regular administration rules for a database LUW>. For example, the database LUW is ended by a database rollback> , all registration entries of the current database LUW are deleted.
When an update function module is registered using CALL FUNCTION ... IN UPDATE TASK>, the relevant data is exported internally to a data cluster using EXPORT>> and is imported again when executing the function module with IMPORT>>. If an error occurs in the export, for example because too much data is exported, the exceptions documented in EXPORT>> are raised. If the data types of the exported actual parameters do not match the typing of the formal parameter of the function module, the exceptions documented in IMPORT>> may be raised. BEGIN_SECTION SAP_INTERNAL_HINT During the execution of a function module that was registered with IN UPDATE TASK>, the internal system field sy-oncom> has the value V>. Instead of sy-oncom> the system class CL_SYSTEM_TRANSACTION_STATE> should be used in programs. END_SECTION SAP_INTERNAL_HINT ABAP_HINT_END • EXPORTING CALL FUNCTION IN UPDATE TASK
ABAP Addition • TABLES CALL FUNCTION IN UPDATE TASK
ABAP Addition
What does it do? The additions EXPORTING> and TABLES> have the same syntax and meaning as in the parameter_list>> of the general function module call, except that for EXPORTING>, no reference variables> or data objects that contain reference variables can be specified as actual parameters. When passing internal tables with non-unique table keys>, the order of the duplicate lines in relation to these keys is not retained.
Latest notes: The additions IMPORTING>, CHANGING> and EXCEPTIONS> of the general function module call may be specified, but they are ignored during the execution. The additions for dynamic parameter passing are not allowed. ABAP_HINT_END
Example ABAP Coding
Registering of the update function module DEMO_UPDATE_INSERT>> for execution when the statement COMMIT WORK>> is executed and passing an internal table. ABEXA 00058 ABAP_EXAMPLE_END