• RFC的远程调用-异步


    接上篇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.     "返还消息

    点击后退显示主程序的

  • 相关阅读:
    学习笔记:模拟退火
    我的 2020
    高一上文化课期末复习
    IOI 2020-2021 集训队作业
    学习笔记:插头DP
    NOIP2020 游记
    刷题记录
    学习笔记:四边形不等式优化 DP
    操作集合时 报错 java.lang.UnsupportedOperationException
    【编码】接收前端参数时,偶数汉字正常,奇数汉字乱码
  • 原文地址:https://www.cnblogs.com/BruceKing/p/11170773.html
Copyright © 2020-2023  润新知