以一个简单的例子说明:
REPORT ztest22.
START-OF-SELECTION.
PERFORM main.
CALL FUNCTION 'ZTIME_SPENT'
EXPORTING
iv_time = 2.
CALL FUNCTION 'ZTIME_SPENT'
EXPORTING
iv_time = 1
iv_nested = abap_true.
WRITE:/ 'finish'.
FORM main.
WAIT UP TO 1 SECONDS.
ENDFORM.
ZTIME_SPENT的实现:
CHECK iv_time > 0.
WAIT UP TO iv_time SECONDS.
IF iv_nested = abap_true.
CALL FUNCTION 'ZTIME_SPENT2'
EXPORTING
iv_time = iv_time.
ENDIF.
ZTIME_SPENT2的实现:
CHECK iv_time > 0.
WAIT UP TO iv_time SECONDS.
总的gross time: 1 ( subroutine MAIN ) + 2 (ZTIME_SPENT call with iv_nested = abap_false ) + 1 ( time spent on ZTIME_SPENT itself) + 1 ( time spent on ZTIME_SPENT2, since iv_nested = abap_true)
第一次ZTIME_SPENT调用,其gross time = net time = 2 seconds 第二次ZTIME_SPENT调用, 其net time = 1 second ( WAIT UP TO 1 second), 其gross time 的另一个1 second是花费在另一个function module call ZTIME_SPENT2 上的,因此不能计算在其net time内。