接上篇RFC的远程调用-同步(https://www.cnblogs.com/BruceKing/p/11169930.html)。
TABLES:USR21. DATA:A TYPE USR21-PERSNUMBER, B TYPE SY-SYSID, C1 LIKE TABLE OF USR21 WITH HEADER LINE. DATA:MSG_TEXT(100) TYPE C. CALL FUNCTION 'ZTESTRFCKING001' DESTINATION 'QAS600' STARTING NEW TASK 'B1' "使用call function starting new task destination&&单独调试这一步时会进入目标系统的函数调式界面 PERFORMING RETURN_USER ON END OF TASK"当目标系统调试完后会进入此子例程,子例程里不能有subimt,commit work等 EXPORTING ZBNAME = '0201010001' EXCEPTIONS COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT SYSTEM_FAILURE = 2 MESSAGE MSG_TEXT. IF SY-SUBRC = 0. WRITE:'wait'. ELSE. WRITE MSG_TEXT. ENDIF. IF C1 IS INITIAL. WRITE:'请等待'. ELSE. WRITE:'CONNECTION IS READY'. ENDIF. AT USER-COMMAND."由于回调子程序不会自动运行,设置对话步骤让其进入 IF SY-UCOMM = 'OKCD'. IF MSG_TEXT IS INITIAL. WRITE:A, B. LOOP AT C1. WRITE:C1-PERSNUMBER. ENDLOOP. ELSE. WRITE:MSG_TEXT. ENDIF. ENDIF. FORM RETURN_USER USING TASKNAME. RECEIVE RESULTS FROM FUNCTION ' ZTESTRFCKING001' IMPORTING ZPERSON_NUMBER = A SYSTEMID = B TABLES OUTPUT = C1 EXCEPTIONS COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT SYSTEM_FAILURE = 2 MESSAGE MSG_TEXT. SET USER-COMMAND 'OKCD'. ENDFORM. "返还消息
点击后退显示主程序的