ABAP - Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  Data Consistency →  SAP LUW → 

CALL FUNCTION - IN UPDATE TASK

Quick Reference

Syntax

CALL FUNCTION update_function IN UPDATE TASK
                              [EXPORTING p1 = a1 p2 = a2 ...]
                              [TABLES t1 = itab1 t2 = itab2 ...].

Extras:

1. ... EXPORTING p1 = a1 p2 = a2 ...

2. ... TABLES t1 = itab1 t2 = itab2 ...

Effect

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 Function Builder. The registration of an update function module is an essential part of the update task.

The function module is not executed immediately, but 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 saved to the 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 database table VBLOG. A function module that is registered more than once is also executed more than once with the associated parameter values. If the statement COMMIT WORK is not 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 database tables when the program ends. The statement ROLLBACK WORK deletes all previous registrations for the current SAP LUW.

System Fields

The sy-subrc is undefined after executing the CALL FUNCTION ...IN UPDATE TASK statement.

Notes

Addition 1

... EXPORTING p1 = a1 p2 = a2 ...

Addition 2

... TABLES t1 = itab1 t2 = itab2 ...

Effect

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 rows in relation to these keys is not retained.

Note

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.

Example

Registers the update function module DEMO_UPDATE_INSERT for execution when the statement COMMIT WORK is executed (and passes an internal table).

    DATA(values) = VALUE demo_update_tab(
      ( id = 'X' col1 = 100 col2 = 200 col3 = 300 col4 = 400 )
      ( id = 'Y' col1 = 110 col2 = 210 col3 = 310 col4 = 410 )
      ( id = 'Z' col1 = 120 col2 = 220 col3 = 320 col4 = 420 ) ).

    CALL FUNCTION 'DEMO_UPDATE_INSERT' IN UPDATE TASK
      EXPORTING
        values = values.

Executable Example

SAP-LUW, UPDATE TASK