Adding Update Task Calls to a Subroutine 

You can also put the CALL FUNCTION IN UPDATE TASK into a subroutine and call the subroutine with:

PERFORM SUBROUT ON COMMIT.

If you choose this method, the subroutine is executed at the commit. Thus the request to run the function in the update task is also logged during commit processing. As a result, the parameter values logged with the request are those current at the time of the commit.

a = 1.
PERFORM F ON COMMIT.
a = 2.
PERFORM F ON COMMIT.
a = 3.
COMMIT WORK.

FORM f.
CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A.
ENDFORM.

In this example, the function module UPD_FM is carried out with the value 3 in PAR. The update task executes the function module only once, despite the two PERFORM ON COMMIT statements. This is because a given function module, logged with the same parameter values, can never be executed more than once in the update task. The subroutine itself, containing the function module call, may not have parameters.

 

The method described here is not suitable for use inside dialog module code. However, if you do need to use a dialog module, refer to Dialog Modules That Call Update Modules.