To call an external RFC server from an ABAP program you generally use the following statement:
CALL FUNCTION “ABC” DESTINATION “RFCEXTERNAL”
IMPORT...
EXPORT...
TABLES...
EXCEPTIONS...
The destination RFCEXTERNAL identifies an entry in the table RFCDES.
The AS ABAP can find the connection parameter only if the destination has been stored and configured in the system via transaction SM59.
There are basically two different ways to establish a connection between an SAP system and an external RFC server. You can use:
● A registered RFC server
● A server started by the application server or by an SAP Gateway.
If you want to run the RFC server as a registered server, the destination must be specified as Registered RFC Server with a corresponding program ID.
The program ID is an identifier of the RFC server program for the SAP Gateway. When defining an entry via transaction SM59 you should specify the complete name of the RFC server program (including the full path name).
It is recommended to use both the name of the RFC server program and the host name of the RFC server program.
It is also recommended to define the SAP Gateway explicitly, because an RFC server program usually registers at a specific SAP Gateway. If nothing is specified the SAP Gateway of the relevant application server will be used.
As an alternative to the registered RFC server the RFC server program can also be started by the currently running application server or by an SAP Gateway. In both cases it has to communicate via a specified SAP Gateway. Consequently, the following prerequisites must be met:
● The user under which the application server or the SAP Gateway runs must have access rights for the RFC server program.
● Both SAP Gateway and RFC server program are running on the same computer:
○ The IP address of this computer must be specified in the hosts file.
○ The service name of the SAP Gateway must be specified in the services file.
● The SAP Gateway and the RFC server program are running on different computers:
○ The IP addresses of both computers must be specified in both hosts files.
○ The service name of the SAP Gateway must be specified in the services file.
○ The SAP Gateway must be authorized to start the RFC server program on the target computer via remote shell:
i. The user of the SAP Gateway must be defined on the target computer.
ii. The.rhosts file which contains the host name of the gateway computer must exist in this user’s home directory on the target computer
iii.
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 more details.see:
● Writing RFC Programs in ABAP
● Maintaining Remote Destinations
● Registering Server Programs on the SAP Gatway