The function

RFC_HANDLE  SAP_API  RfcAccept(char ** argv)

accepts an incoming connection. You must use this routine if your program will be started by an RFC call from an SAP System (or by any other program using this API). The command line (argv) has to be passed to this function.

This function can be used to register at an SAP gateway, and the server program can wait for the next RFC request by issueing RfcDispatch or RfcListen or RfcGetName.

Using this functionality, an RFC server program can now already run and work as an RFC daemon. Starting any server program by an SAP application server, by SAPGUI or via remote shell by an SAP gateway is no longer necessary.

There are two ways to define the input parameter ‘argv’


       1.      Working with the ‘saprfc.ini’-file:


<destination pointed to an entry in ‘saprfc.ini’>


Use RFC-trace

       2.      Working without the ‘saprfc.ini’-file:


<program ID>   e.g. own_host_name.program_name


<host name of the SAP gateway>


<service of the SAP gateway>   e.g. sapgw00


Use RFC-trace

The first of these two ways is recommended, because this way allows you to use some RFC features today and in the future without changing your RFC programs. See saprfc.ini for more details.

The three parameters above must fit with the configuration in the SAP system (via SM59, connection type T and register mode).

For working with register mode no further changes in RFC programs are necessary.

You must be careful to use only the program name as program-ID, because more programs (e.g. rfcexec) might be registered at the same SAP gateway. You ought to use at least the host name of the computer where your RFC server program is running as part of the program-ID.

The well-known rfcexec program can be started from the command line with RFC-trace as follows:

rfcexec -ap10234.rfcexec -ghs0311 -xsapgw53 -t


rfcexec -Drfctest

and an entry in saprfc.ini can be defined as follows:



RFC server programs working with this functionality will be called RFC server programs running in register mode.

This function is defined in SAPRFC.H.

Return value:

·        Returns a valid RFC_HANDLE or RFC_HANDLE_NULL.

Function Parameter:

·        argv

command line, the line the program is started with