Show TOC

Object documentationRfcListenAndDispatch Locate this document in the navigation structure

 

Starts to listen on the given RFC server connection and dispatches incoming RFC calls to the insatlled server functions.

This function will block the current thread until an incoming call returns or times out.

 

Process

The mechanism for dispatching incoming function calls works as follows:

First RfcListenAndDispatch checks, whether for the current combination of SAP System ID and function module name a callback function has been installed via RfcInstallServerFunction. If not, it checks, whether a global callback function has been installed via RfcInstallGenericServerFunction.

If a callback function has been found, the RFC call will be dispatched to that function for processing, and RfcListenAndDispatch returns the return code of the callback function.

Otherwise RfcListenAndDispatch returns a SYSTEM_FAILURE to the SAP backend and the return code RFC_NOT_FOUND to the caller.

In general the return codes of RfcListenAndDispatch have the following meaning:

  • RFC_OK: A function call was processed successfully.

  • RFC_RETRY: No function call came in within the specified timeout period. (timeout is given in seconds.)

  • RFC_ABAP_EXCEPTION: A function call was processed and ended with a defined ABAP Exception, which has been returned to the backend.

In the above three cases rfcHandle is still open and can be used to listen for the next request.

  • RFC_ABAP_MESSAGE: A function call was started to be processed, but was aborted with an ABAP A- or E-Message. The message parameters have been returned to the backend (and can be evaluated there via the sy-msgid, sy-msgtype, sy-msgno, sy-msgv1, ..., sy-msgv4 parameters).

  • RFC_ABAP_RUNTIME_FAILURE: A function call was started to be processed, but was aborted with a RABAX,

which has been returned to the backend.

  • RFC_COMMUNICATION_FAILURE: The connection broke down while processing the function call. No response has been sent to the backend.

In these three cases the connection has been closed, so the rfcHandle needs to be refreshed via RfcRegisterServer.

  • RFC_INVALID_HANDLE: rfcHandle is invalid or points to a connection that has already been closed.

Structure

RFC_RC SAP_API RfcListenAndDispatch (RFC_CONNECTION_HANDLE rfcHandle, int timeout, RFC_ERROR_INFO* errorInfo);

rfcHandle : RFC server connection handle;

timeout : time-out period in seconds