Skip to main content

SAP RFC Transfer Object Example

This example demonstrates how to call an RFC function module using an SAP RFC transfer object. The function module Z_FM_ADD is used as an example; its import, export, and source code are shown in the following figures.

Function Module in the SAP® System​

Function module Z_FM_ADD in the Function Builder

note

In the general properties, select the "Remote callable" option so that this function module can be called by third-party systems, such as the OPC Router. Otherwise, this function module can only be called within the current SAP system.

Import​

Function module Z_FM_ADD – Import

Export​

Function module Z_FM_ADD – Export

Source Code​

Function Module Z_FM_ADD – Source Code

note

The function module must then be saved, checked, and activated (“Save,” “Check” and “Enable” in the Function Builder, transaction SE37). Only an active function module marked as remote-capable can be called via RFC from the OPC Router.

Create a Transfer Object​

In the OPC Router, select the SAP-RFC transfer object for a new flow.

In this example, the function module Z_FM_ADD is located in the function group ZZ_TEST_OPC. A connection named Vm-Sap was created in the SAP® plug-in to access it.

Double-click to open the SAP-RFC transfer object and perform the following steps on the “Settings” tab:

  1. Select “Vm-Sap” in the “SAP access data” field.
  2. In the “Function group” section, click “Filter” in the “Search Filter” field to load the function groups.
  3. Select “ZZ_TEST_OPC” in the “Function group” field.
  4. In the “Function” section, click “Filter” in the “Search Filter” field to load the functions.
  5. Select “Z_FM_ADD” in the “Function” field.

SAP RFC Transfer Object – Settings

On the “Parameters” tab, select the imports and exports.

SAP RFC Transfer Object – Parameters

After confirming with “OK”, the SAP RFC transfer object looks like this:

SAP RFC Transfer Object for Z_FM_ADD

Design the Flow​

As shown in the following figure, In_Param1 and In_Param2 are set to constants, and RESULT is assigned to a variable.

Flow with the SAP RFC transfer object

Deploy the change​

Next, click “Deploy Change” at the top of the page and confirm again by clicking “Deploy Change” in the “Publish” section.

Deploy Change to Production

Trigger the flow and check the result​

Next, trigger the flow in the Status Indicator by right-clicking on your flow and selecting “Trigger Flow.”

Triggering the flow in the status display

As expected, the value of RESULT is equal to the sum of In_Param1 and In_Param2.

Result of the RFC call in the status display