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 typeRFC_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 theRfcDispatch interface.
AfterRfcAccept 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.
name of function as it can be called from ABAP environment (null-terminated string)
function to be called (must be of type
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.)
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 alsoRfcDispatch and RfcGetName.