Created by Jerry Wang, last modified on Oct 06, 2014

Variant 1: Asynchronous Update

START-OF-SELECTION. CALL FUNCTION 'ZTIME_SPENT2' IN UPDATE TASK EXPORTING iv_time = 2. COMMIT WORK. PERFORM main. WRITE:  / 'finish'. FORM main. WAIT UP TO 1 SECONDS. ENDFORM.Copy the code

Variant 2: Synchronizes update

START-OF-SELECTION.

  CALL FUNCTION 'ZTIME_SPENT2' IN UPDATE TASK
    EXPORTING
       iv_time = 2.

  COMMIT WORK AND WAIT.
  PERFORM main.

WRITE: / 'finish'.

FORM main.
  WAIT UP TO 1 SECONDS.
ENDFORM.
Copy the code

variant 3

The LOCAL UPDATE function performs a synchronous UPDATE after The COMMIT WORK, according to ABAP help for The keyword SET UPDATE TASK LOCAL Statement, independently of the addition AND WAIT), variant 3 is still synchronous update:(total gross time is still 3 seconds)

START-OF-SELECTION.

  CALL FUNCTION 'ZTIME_SPENT2' IN UPDATE TASK
    EXPORTING
       iv_time = 2.

  SET UPDATE TASK LOCAL.
  COMMIT WORK.
  PERFORM main.

WRITE: / 'finish'.

FORM main.
  WAIT UP TO 1 SECONDS.
ENDFORM.
Copy the code