关于COMMIT WORK and COMMIT WORK AND WAIT在SAT中的讨论

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

variant 1: 异步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.

关于COMMIT WORK and COMMIT WORK AND WAIT在SAT中的讨论_第1张图片

variant 2: 同步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.

关于COMMIT WORK and COMMIT WORK AND WAIT在SAT中的讨论_第2张图片

variant 3

根据ABAP help 对关键字SET UPDATE TASK LOCAL的说明(The local update function performs a synchronous update after the COMMIT WORK statement, independently of the addition AND WAIT), variant 3还是属于同步update:( 总的gross time仍然为3秒)

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.

关于COMMIT WORK and COMMIT WORK AND WAIT在SAT中的讨论_第3张图片

你可能感兴趣的:(ABAP)