Different Types of RFC in SAP
While working with SAP systems, we interact with it via SAPGUI or WebGUI or via FIORI App, etc. Depending on the nature of the activity, the SAP system may need to communicate with other SAP systems or non-SAP systems for the information exchange. Remote Function Call (RFC) is the standard SAP interface for communication between SAP systems. RFC calls a function to be executed in a remote system to get the required activity completed. There are different types of RFC in SAP system, depending upon the expected work. Let’s check it out in more detail.
Types of RFC
There are different RFC variants, each of which has different properties and is used for a specific purpose.
Synchronous RFC (sRFC)
The first version of RFC is synchronous RFC (sRFC). This type of RFC executes the function call based on synchronous communication, meaning that the systems involved must both be available at the time the call is made. And this RFC waits for the activity completion.
Asynchronous RFC (aRFC)
For asynchronous RFC, the called system must be available during the call, but function control returns to the calling program directly after the call. Using aRFC is always a good idea when real-time communication is established with a remote system, where processing in the calling program should not be interrupted until the results of the called function module have been obtained.
Also Read
SAP Memory Management
Transactional RFC (tRFC)
Transactional RFC (tRFC, previously known as asynchronous RFC) is a genuine asynchronous communication method that – unlike aRFC – executes the called function module just once in the RFC server. The remote system need not be available at the time when the RFC client program is executing a tRFC. The tRFC component stores the called RFC function, together with the corresponding data, in the SAP database under a unique transaction ID ( TID).
If a call is sent, and the receiving system is down, the call remains in the local queue until a later time. The calling dialog program can proceed without waiting to see whether or not the remote call was successful. If the receiving system does not become active within a certain amount of time, the call is scheduled to run in batch.
tRFC is always used if a function is executed as a Logical Unit of Work (LUW). Within a LUW, all calls are
- Executed in the order in which they are called
- Executed in the same program context in the target system
- Executed in a single transaction: they are either committed or rolled back as a unit.
Implementation of tRFC is recommended if you want to maintain the transactional sequence of the calls.
Queued RFC (qRFC)
To guarantee that multiple LUWs are processed in the order specified by the application, tRFC can be serialized using queues (inbound and outbound queues). This type of RFC is called queued RFC (qRFC).
qRFC is therefore an extension of tRFC. It transfers an LUW (transaction) only if it has no predecessors (based on the sequence defined in different application programs) in the participating queues.
Implementation of qRFC is recommended if you want to guarantee that several transactions are processed in a predefined order.
Background RFC (bgRFC)
bgRFC is the successor to tRFC and qRFC, with significant improvements in terms of performance and functionality.
Local Data Queue (LDQ)
The LDQ is a special case in RFC communication. Here, no data is sent actively by the system. Instead, it is stored locally until being called by an external application (such as a mobile device) according to the pull principle.
Overall
A remote function call (RFC) calls a function module in a different system to the calling program. It is also possible to call a function module in the system by RFC. Normally though, the caller and the called function module are in different systems. In the SAP system, these functions are provided by the RFC interface system. The RFC interface enables function calls between two SAP systems, or between an SAP system and an external system.
Stay Healthy, Stay Safe, Jai Hind!