Complex activities can be simplified considerably by using of clever selection criteria. One example is the UiPath BAPI activity, for the SAP remote enabled function modules (RFM), with a business application programming interface. This inspired me to program a tool that offers a similar approach, but for all RFMs which are available in an SAP system.
Hint: You can find more technical information about RFC in my knowledge document, on side 9.
The interface between UiPath and an SAP system is the SAP dotNET Connector (NCo) via the Invoke Code activity.
Hint: You can find more information how to use NCo here.
Based on this knowledge, I programmed an RFM Code Generator. With this tool you can generate C# or VBdotNET code to use RFMs of an SAP back-end system. You can easily detect and select the RFM you need. With a few mouse clicks you can generate the code to call the RFM. All descriptions and interfaces, with its technical details, are visible and you can put together exactly what you need.
After starting the generator, the connection data must be entered first at the Connection tab.
After the connection has been successfully established, you can switch to the Selection tab. Here the desired function module can be easily selected and the code generated in a few steps.
- Type a pattern or the name of the RFM you want to use. In this example RFC*.
- Press this button to get all RFMs from the connected SAP system, with the pattern.
- Double click on the RFM name you want to use. In this example RFC_SYSTEM_INFO.
- Here you see the name of the RFM which was selected and the available descriptions in all languages.
- The RFM interface, in our case it contains only export parameters. Here you can find Import, Export, Exception and Changing parameters of the RFM.
- Select the programming language in which the code is to be generated. In this example VBdotNET.
- Press the Generate Code button to generate the code in the Code tab
If a function documentation is available, you can find it in the tab of the same name. But in the most cases RFMs are not documented.
With five tiny clicks you generate code to call an RFM in an SAP system.
With a double click on a structure you jump into the Structure Definition tab and you can see all details, in this example RFCSI_EXPORT.
This can be used to generate code for deeper structures.
- Select the fields you are interested in. In this example RFCHOST, RFCSYSID, RFCDBHOST and RFCDBSYS.
- Select Set, if you want to set the content of the fields, or Get, if you want to get the content of the fields. In this example Get.
- Press Generate Code to Clipboard button. The additional VBdotNET code to get the content of the selected fields is now in the clipboard available
Paste it into your code.
I invoke the code on an independent way, like I described here.
Now the code can be copied into the Invoke Code activity …
… and executed.
With this RFM Code Generator you can create C# or VBdotNET code sequences, to call SAP RFMs, easily. You very quickly gain an overview of the technical interface and can just as quickly create the basis for use. However, you must also know exactly what you are doing. The generated code can be easily transfer and use in the UiPath Invoke Code activity. This approach should reduce development times.
You can find the RFM Code Generator here, with a detailed user manual.