SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

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.

test ABAP function module call using RFC destination on SE37 transaction

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.

DATA lv_destination TYPE char10.

CASE sy-sysid+2(1).
WHEN 'P'.
 lv_destination = 'K0P_040'.
WHEN OTHERS.
 lv_destination = 'NONE'.
ENDCASE.

CALL FUNCTION 'ZWF_List_User_Tasks'
DESTINATION lv_destination
EXPORTING
 i_user = lv_user
IMPORTING
 et_approval_requests = lt_approval_requests.
Code

The above ABAP Call Function syntax shows how to run a function module with RFC destination is set dynamically.



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.