Introduction to RFC Server Programs

An RFC server program is a program which offers RFC functions to be called by ABAP programs.

The RFC API offers routines for implementing RFC server programs. After having started, the RFC server programs must inform the RFC library about all RFC functions which can be called within this server program. It can then wait for incoming call requests, and the RFC library will dispatch the requested calls (using RfcDispatch in a loop).

As an alternative, the RFC server program can use RfcGetName to identify the name of the required RFC function, and then it must dispatch itself to the supported function.

A typical server looks as follows:

Since the RFC server program never builds up a connection actively, the sideinfo file is never used.

There are two methods of receiving an RFC call. The most simple way of receiving an RFC call in an external program is to register a C function to be called when a call request is received. The function RfcInstallFunction registers a C function to be called when receiving the request for an RFC call. After RfcAccept or after receiving the return code RFC_CALL when calling RfcReceive, the program must use RfcDispatch to internally call the corresponding registered function. The return code of the registered function is again returned by RfcDispatch.

There are always some standard functions which are installed automatically. Apart from some internally-used functions, the function modules are as follows:

  • RFC_PING

This function does nothing by itself. You can use it to test the connection.

  • RFC_SYSTEM_INFO

This function returns some information about the library and its environment.

  • RFC_DOCU

This function returns the function documentation which was installed during the calls of RfcInstallFunction.
It is also possible to receive RFC calls directly. The function
RfcGetName is used to get the name of the called function. The calling program has to determine the interface of the requested function module itself. It must then receive the parameters as within a function being installed via RfcInstallFunction.