Show TOC Start of Content Area

RfcAccept  Locate the document in its SAP Library structure

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:

   D

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

   t

Use RFC-trace

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

   a

<program ID>   e.g. own_host_name.program_name

   g

<host name of the SAP gateway>

   s

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

   t

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.

Caution

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.

Example

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

rfcexec -ap10234.rfcexec -ghs0311 -xsapgw53 -t

or

rfcexec -Drfctest

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

DEST=rfctest
TYPE=R
PRGOGID=p10234.rfcexec

GWHOST=hs0311
GWSERV=sapgw53
RFC_TRACE=1

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

 

End of Content Area