Receiving Results from an Asynchronous RFC

Posted aurora-cj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Receiving Results from an Asynchronous RFC相关的知识,希望对你有一定的参考价值。

REPORT  ZTEST_RFC.

DATA: INFO LIKE RFCSI,
* Result of RFC_SYSTEM_INFO function
      SYSTEM_MSG(80) VALUE SPACE.
* Exception handling

CALL FUNCTION 'RFC_SYSTEM_INFO'
     STARTING NEW TASK 'INFO'
     PERFORMING RETURN_INFO ON END OF TASK.
WRITE: 'Wait for reply'.
...
AT USER-COMMAND.
* Return from FORM routine RETURN_INFO
   IF SYSTEM_MSG = SPACE.
     WRITE: 'Destination =', INFO-RFCDEST.
   ELSE.
     WRITE SYSTEM_MSG.
   ENDIF.
...
FORM RETURN_INFO USING TASKNAME.

  RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'
      IMPORTING  RFCSI_EXPORT = INFO
      EXCEPTIONS SYSTEM_FAILURE MESSAGE SYSTEM_MSG.

*  REFRESH SCREEN. "Simulate command field = return key"this is obsolete
  SET USER-COMMAND 'OKCD'.
ENDFORM.

The SET USER-COMMAND ‘OKCD’ statement replaces the REFRESH SCREEN command. REFRESH SCREEN is no longer maintained and should therefore not be used.if the user had entered the function in the command field and pressed ENTER. The current positioning of the list and the cursor are thus taken into account.

CALL FUNCTION 'XXXXXXX'
      STARTING NEW TASK 'AAA'
      DESTINATION 'NONE'
      PERFORMING RETURN_INFO ON END OF TASK
      EXPORTING
        I_VBELN               = L_VBELN
      TABLES
        E_RETURN              = L_IT_RETURN[]
      EXCEPTIONS
        COMMUNICATION_FAILURE = 1  MESSAGE MSG
        SYSTEM_FAILURE        = 2  MESSAGE MSG.

    IF SY-SUBRC = 0.
      WAIT UNTIL SEMAPHORE = 'X'.
    ELSE.
      WRITE MSG.
      MESSAGE 'Synchronize Failed' TYPE 'A'.
    ENDIF.


FORM RETURN_INFO USING TASKNAME.
  RECEIVE RESULTS FROM FUNCTION 'XXXXXXX'
      IMPORTING  RFCSI_EXPORT = AAA
        TABLES E_RETURN  = GV_IT_RETURN[]
      EXCEPTIONS
         COMMUNICATION_FAILURE = 1 MESSAGE MSG
         SYSTEM_FAILURE        = 2 MESSAGE MSG.
  RET_SUBRC = SY-SUBRC. "Set RET_SUBRC
  SEMAPHORE = 'X'. "Reset semaphore
ENDFORM.     

You can use the WAIT statement with PERFORMING form ON END OF TASK to wait for the reply to a previously started asynchronous call. In this case, WAIT must be in the same program context.

以上是关于Receiving Results from an Asynchronous RFC的主要内容,如果未能解决你的问题,请参考以下文章

UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list:

ios8调用相机报警告: Snapshotting a view that has not been rendered results in an empty snapshot. Ensure you

2743711 - Possible Unexpected Results When Using Query With an ORDER BY Clause on a Rowstore Table W

如何从 PHP [Json results from open alpr] 中读取这种类型的 JSON 文件?

where column in from another select results with limit (mysql/mariadb)

Import image from './image.jpeg' results Failed to load module script 服务器以“image/jpegerror”的非 JavaSc