Calling from an ABAP Program
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...
RFC Destination
The destination RFCEXTERNAL identifies an entry in the table RFCDES.
The AS ABAP can only find the connection parameter if the destination has been stored and configured in the system using transaction SM59.
Connection Options
There are 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 Gateway.
Registered RFC Server
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.
Program ID
The program ID is an identifier of the RFC server program for the Gateway. When defining an entry using transaction SM59 you should specify the complete name of the RFC server program (including the full path name).
SAP recommends that you use both the name of the RFC server program and the host name of the RFC server program.
We also recommend that you define the Gateway explicitly, because an RFC server program usually registers at a specific Gateway. If nothing is specified, the Gateway of the relevant application server will be used.
Started RFC Server
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 Gateway. In both cases it has to communicate using a specified Gateway. Consequently, the following prerequisites must be met:
The user under which the application server or the Gateway runs must have access rights for the RFC server program.
Both the Gateway and the 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 Gateway must be specified in the services file.
The 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 Gateway must be specified in the services file.
The Gateway must be authorized to start the RFC server program on the target computer using remote shell:
The user of the Gateway must be defined on the target computer.
The. rhosts file which contains the host name of the gateway computer must exist in this user's home directory on the target computer
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, refer to:
Writing RFC Programs in ABAP