Call Function Module using RFC Destination in ABAP
ABAP developers can call function module using RFC destination in ABAP program codes. RFC call of ABAP function module with RFC Destination enables running FM in an other SAP system. ABAP programmer can easily set the RFC destination dynamically to a variable in his/her programs and call function module for execution on different SAP systems.
After ABAP programmer enable RFC enabled execution of the target function module, using SE37 screen by pressing F8 programmer can test the function module. If RFC target system is populated with a valid SAP system, the results will be from the related remote SAP system.
If RFC target system is left as blank, or initial this parameter is mapped to RFC Destination "NONE" which means it will be executed on the current SAP system.
Below ABAP code block, first checks the current SAP system and makes a simple decision for RFC destination.
Then using DESTINATION keyword within ABAP CALL FUNCTION command the target RFC destination SAP system is assigned.
Note that NONE is used for the current SAP system instead of pointing to a remote SAP system for the RFC destination.
The above ABAP Call Function syntax shows how to run a function module with RFC destination is set dynamically.