Establishing an RFC Connection from an R/3 System

Call from an ABAP program:

CALL FUNCTION "ABC" DESTINATION "RFCEXTERNAL"

IMPORT...
EXPORT...
TABLES...
EXCEPTIONS...

The destination "RFCEXTERNAL" identifies an entry in the RFCDES table.

The RFCDES table in R/3 up to Release 3.0C:

From within an R/3 System, up to Release 3.0C, you can define an entry in the RFCDES table using transaction code sm59:

Connection type "T"

The RFC server program is an external program based on the RFC API and communicates via TCP/IP.

Program location "explicit"

The computer on which the RFC server program runs can be specified via Target host. In this case, the RFC server program will be started by the SAP either locally or via remote shell. This RFC server program will run on supported UNIX platforms under the gateway user-ID.

The program location "explicit" is not possible for RFC server programs with a 16-bit RFC library on Windows. See "The RFCDES table in R/3 Release 3.0C onwards" for new functionality in Releases as of 3.0C.

Program location "Server"

The RFC server program is started by the current R/3 application server. This improves performance, because the RFC server program always runs on the same computer as the ABAP program (work process of the current ABAP program).

This RFC server program will run on supported UNIX platforms under the user-ID of the respective R/3 application server.

The program location "Server" is not possible for RFC server programs with a 16-bit RFC library on Windows. See "The RFCDES table in R/3 Release 3.0C onwards" for new functionality in Release >= 3.0C.

Program location "User"

The RFC server program is started by the current SAPGUI (SAP frontend). The program location "User" is the only option available to start an RFC server program with a 16-bit RFC library on Windows. See The RFCDES Table in R/3 Releases as of 3.0C below for new functionality.

Trace

When this field is selected, trace data can be displayed in the SAP System using the ABAP program RFRFCTRC table. On extended systems, the trace data are stored in the ‘dev_rfc’ file. With the 16-bit RFC library, a trace file ‘RFCxxxx.TRC’ will be created for each connection.

Gateway

The gateway specification is optional. If nothing is specified, the default gateway will be used. The default gateway depends on the R/3 Release:

Call up transaction se38 and execute the program RSPARAM: The parameters rdisp/gateway and rdisp/gw_service contain data about the default SAP gateway.

The local gateway on each R/3 application server since these Releases is the default gateway.

Testing a Connection

After having entered and saved a new destination using transaction sm59, you can test the RFC connection by double-clicking on Test connection. However, this is only possible if the RFC server program was implemented by using RfcDispatch in a loop and not with RfcGetName.

The RFCDES table in R/3 Release 3.0C onwards

From R/3 Release 3.0C onwards, you can define an RFC server program which is already started, registered at an SAP gateway and waiting for RFC call requests by using transaction sm59.

You must define an RFC server program with registering as activating action, and a program-ID.

Program-ID

The program-ID is an identifier of the RFC server program for the SAP gateway to distinguish between different RFC server programs. It is recommended to use both the name of the RFC server program and the host name of the RFC server program.

Information about the SAP Gateway

The SAP gateway of the relevant application server will be used if nothing else is specified. It is recommended to define the SAP gateway explicitly, because an RFC server program usually registers at a specific SAP gateway.

Configurations

SAP recommends you to specify the complete name of the RFC server program (including the full path name) when defining an entry in the RFCDES table using transaction sm59.

The RFC server program can be started by the currently running SAPGUI, by the currently running application server or by an SAP gateway, but it has to communicate via a specified SAP gateway.

Consequently, the following prerequisites must be met:

  1. The user of the SAP gateway must be defined on the target computer.
  2. The.rhosts file which contains the host name of the gateway computer must exist in this user’s home directory on the target computer
  3. Since the remote shell command is different on different UNIX platforms (remsh, rsh, etc.), the command can be defined in the gateway profile parameter gw/remsh, if necessary (e.g. gw/remsh=/usr/ucb/remsh).
    The default is ‘remsh’.

For very large hosts files on OS/2, it is recommended to define the entries for all computers involved at the beginning of this file, because it may take a long time to get all IP-addresses used.

Starting an RFC server program

An RFC server program can be started by the currently running SAPGUI, by the currently running R/3 application server or by an SAP gateway, as described in the above section.

Using the registering feature of the SAP gateway (from Release 3.0C onwards), RFC server programs can be started before, register at this SAP gateway and then wait for RFC call requests from R/3 System Release 3.0C onwards.

Here, the RFC server program of the RFCDES table (transaction sm59) must be defined as registering for activating action. See The SAPRFC.INI File for more details.