Function Modules and Remote Function Calls

SAP Function modules are procedures that are defined in function groups (special ABAP programs with type F) and can be called from any ABAP program. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder.
Overview of Function Modules
Function modules allow you to encapsulate and reuse global functions in the R/3 System. They are stored in a central library. The R/3 System contains a wide range of predefined function modules that you can call from any ABAP program. Function modules also play an important role in database updates and in remote communications between R/3 Systems or between an R/3 System and a non-SAP system. Unlike subroutines, you do not define function modules in the source code of your program.
Find here some useful ABAP Function Modules! – Download Important SAP Function Modules.
What’s a Function Group
A Function Group is an ABAP program that contains function modules. Function modules that work with the same data objects can be combined to form the function group.
Each function group can contain data objects, subroutines and screens which can be used by the function modules.
RFC is used to communicate between SAP systems and SAP to Non-SAP systems using TCP/IP protocol.
Understanding Remote Function Call (RFC) Processes
RFC’s are defined in [SM59]. There are 4 types of RFC’s
- Asynchronous RFC
- Synchronous RFC
- Transactional RFC
- Queue RFC
1. Asynchronous RFC – (Like a postcard). The sending system may or may not receive it. i.e. there is no acknowledgment from the receiving . The transmission is not reliable.
2. Synchronous RFC – It is not like ARFC. It gets an acknowledgment from the target system. (like a registered post).
If the receiving system is not available the process goes into RFC/ CPIC/ Sleep mode and waits until it is wakened by the target system. Target system/ Receiving system may be busy i.e. all the resources are used up. This is reliable but time consuming and expensive (Client Copy) the job should get finished.
SAP uses CPIC protocol SAP specific (Common Programming Interface for Communication) to communicate between system.
3. Transactional RFC – TRFC – It is an advanced version of ARFC and SRFC. The request goes to receiving system if it is not handled a Transaction ID is generated by the source system. A program RSARFCSE is scheduled in the background to run for every 60 seconds. Transaction SM58 is used for Transactional RFC. It is used to document all the transactional ID’s and ensure that they are received by the recipient system. This is consistent and reliable.
4. Queued RFC – It is an advanced version of TRF and ensures that the transaction is committed based on FIFO/ Queue. It ensures transaction consistency of Logical unit of work and reliability of data transmission.SMQ1 – to monitor the outbound queues of a sending system refer SCOTT for FAX…
- SMQ1 – to monitor the outbound queues of a sending system refer SCOTT for FAX…
- SMQ2 – Provides interface to monitor Inbound queues.
Function Module User Exists
Function Module exits exist in some SAP application programs to allow a customer to add some functionality to the SAP Program. Search the SAP application program for the search string “CALL CUSTOMER” to check if any function module exists.