To implement an RFC server, you must register every callable function with RFC. This allows the RfcDispatch routine to route RFC requests properly. Use the RfcInstallFunction routine to register callable functions.

To call RfcInstallFunction, use the calling syntax:

RFC_RC SAP_API RfcInstallFunction(RFC_FUNCTIONNAME functionname,
char * docu);

There are two possible ways to receive an RFC call. The most simple way to receive 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.

The function pointer points to a function of type RFC_ONCALL, which contains the functionality being offered as an RFC function module. ‘functionname’ is the name of the offered RFC function module, and the description should contain a description of the functionality as well as the interface. Newline characters can be used to start new lines.

The descriptions of the registered functions can be requested by calling the standard function module RFC_DOCU which is available in every RFC server program using the RfcDispatch interface.

After RfcAccept or after receiving the return code RFC_CALL, when calling RfcReceive, the program has to call RfcDispatch which internally calls the corresponding registered function.

This function is defined in SAPRFC.H.

Return Values:

  • returns RFC_OK or
  • returns RFC_FAILURE (if there is no memory available to register the function)

Function Parameters:

Function parameters:

  • functionname

name of function as it can be called from ABAP environment (null-terminated string)

  • f_ptr

function to be called (must be of type RFC_ONCALL)

  • docu

text describing the functionality and the parameters of the function module

The sample programs provide examples of how to use RfcInstallFunction. (In particular, the program rfcexec.c which is included in the RFC SDK implements an RFC server.)

RfcInstallFunctionExt is for RFC programs on Windows 3.x.

If your RFC server program is working with RfcGetName but you want to see the docu_function belonging to your RFC function (transaction sm59, system function, function list), you can use this function with NULL as function pointer.

See also RfcDispatch and RfcGetName.