Remote Function Call
Remote Function Call
What is RFC?
Any ABAP program can call a remote function using the CALL
FUNCTION...DESTINATION statement. The DESTINATION parameter tells the SAP System
that the called function runs in a system other than the callers.
Syntax-
DESTINATION dest
EXPORTING f1 =
IMPORTING f2 =
TABLES t1 =
EXCEPTIONS
Logical Destinations are defined via transaction SM59 and stored in Table RFCDES
Converting all parameter data to the representation needed in the remote system
Calling the communication routines needed to talk to the remote system.
Handling communications errors, and notifying the caller, if desired ( using
EXCEPTIONS parameter of the CALL FUNCTION).
RFC is a SAP protocol to handle communications between systems to simplify the related
programming. It is the process of calling a function module which is residing on a different
machine from the caller program. RFCs can be used to call a different program on the same
machine as well, but usually, it is used when 'calling' and 'called' function modules/
programs are running on separate machines.
In SAP, RFC Interface system is used for setting-up RFC connections between different SAP
systems, and also between a SAP and an external (non-SAP) system.
Must Know Details About RFC
RFC helps to reduce the efforts of programmers, by letting them avoid the re-development
of modules and methods at remote systems. It is capable enough to:
Convert the data into the format understandable by the remote (target) system.
Convert the data into the format understandable by the remote (target) system.
Call up certain routines which are necessary to start communication with the remote
system.
Handle errors that might occur in the process of communication.
Types of RFC:
Synchronous
Requires both the systems (client and server) to be available at the time of communication
or data transfer. It is the most common type and is required when the result is required
immediately after the execution of sRFC.
The issue is if the target system is not available, the source system resources wait until
target system is available. This may lead to the Processes of source system to go into
Sleep/RFC/CPIC Mode at target systems and hence blocks these resources.
Used for
Asynchronous
It is communication between systems where acknowledgments are not required (it is similar
to postcard delivery).It doesn't require both the systems to be available at the time of
execution and the result is not immediately required to be sent back to the calling system.
The Source System resource does not wait for the target system as they deliver the
message/data without waiting for any acknowledgment. It is not reliable for communication
since data may be lost if the target system is not available. Used for -
Queued
Queued RFC is an extension of tRFC. It also ensures that individual steps are processed in
sequence.
To guarantee that multiple LUWs (Logical Unit of Work/ Transaction) are processed in the
order specified by the application. tRFC can be serialized using queues (inbound and
outbound queues). Hence the name queued RFC (qRFC). Used For-
Type 3 - entries specify the connection between ABAP systems. Here, we must specify the
host name / IP address. You can, however, specify logon information if desired. This is
applicable for both type of RFCs, between ABAP systems and external calls to ABAP systems
Type I - entries specify ABAP systems connected to the same database as the current
system. These entries are pre-defined and cannot be modified. Example entry name:
ws0015_K18_24
ws0015=host name
K18=system name (database name)
24=TCP-service name
Type T - destinations are connections to external programs that use the RFC API to receive
RFCs. The activation type can be either Start or Registration. If it is Start, you must specify
the host name and the pathname of the program to be started.
How to Code an RFC?
1. In the function module attributes tab (transaction code SE37), set the processing
type as Remote-enabled module to create a remote function module.
3. Define the destination of the RFC server in the RFC client system that calls the
remote function ( via SM59 transaction).
4. Declaring Parameters: All parameter fields for a remote function module must be
defined as reference fields, that is, like ABAP Dictionary fields.