首先创建rfc FM:
FUNCTION Z_WAIT_30_SECS.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IM_INTERVAL) TYPE INT4
*"----------------------------------------------------------------------
DATA: ztime LIKE sy-uzeit.
GET TIME.
ztime = sy-uzeit + im_interval.
DO.
GET TIME.
IF sy-uzeit > ztime.
EXIT.
ENDIF.
ENDDO.
ENDFUNCTION.
然后,可以创建下面的程序测试:
*&---------------------------------------------------------------------*
*& Report ZREFRESH
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZREFRESH LINE-SIZE 232 NO STANDARD PAGE HEADING.
DATA: znum LIKE sy-tabix.
START-OF-SELECTION.
GET TIME.
WRITE: /01 'Update Number',znum,sy-uzeit.
CALL FUNCTION 'Z_WAIT_30_SECS'
STARTING NEW TASK 'IF'
PERFORMING start_refresh ON END OF TASK
EXPORTING
IM_INTERVAL = 1.
AT USER-COMMAND.
IF sy-ucomm = 'REFR'.
sy-lsind = sy-lsind - 1.
ADD 1 TO znum.
GET TIME.
WRITE: /01 'Update Number:', znum,sy-uzeit.
CALL FUNCTION 'Z_WAIT_30_SECS'
STARTING NEW TASK 'IF'
PERFORMING start_refresh ON END OF TASK
EXPORTING
IM_INTERVAL = 1.
ENDIF.
*&---------------------------------------------------------------------*
*& Form start_refresh
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM start_refresh USING taskname.
SET USER-COMMAND 'REFR'.
ENDFORM. " start_refresh