We are proud to share our inclusion in the 2024 Gartner Magic Quadrant for Data Integration Tools. We believe this recognition reflects the differentiated business outcomes CData delivers to our customers.
Get the Report →CData SAP Driver Deep Dive: How to Create SAP RFC Module and Access from CData Driver for SAP
As we take a deeper look into the CData SAP ERP Driver, we can see that the driver's processes are carried out through generic modules and RFCs (Remote Function Calls). Retrieving table lists and calling table data are also done through dedicated generic modules and RFCs.
Additionally, the CData SAP ERP Driver provides all SAP Tables as read-only views. Therefore, operations on these SAP Tables must be performed through generic modules. This is similar to how SAP ERP screens (Dynpro) process through their respective modules.
For this article, we will introduce how to call the generic modules and RFCs that form the core of the CData SAP ERP Driver.
Note: Although this article uses the CData SAP ERP JDBC Driver, the same methods can be applied to any CData SAP ERP connectivity solution.
Executing Generic Modules and RFCs
First, let's introduce how to execute generic modules and RFCs through the CData SAP ERP Driver.
As stated in the documentation, the CData SAP ERP Driver allows you to execute generic modules directly as stored procedures. CData SAP ERP JDBC Driver Documentation
When viewed through the CData JDBC Driver, you can see them listed as stored procedures.

For example, to execute the generic module "RFC_READ_TABLE", you can do it as follows:
EXEC RFC_READ_TABLE OPTIONS='{ \"TEXT\": \"TABNAME LIKE ''MARA%''\" }', QUERY_TABLE='DD02L', ROWCOUNT='1', ReturnTables='DATA';
In this case, "Import" becomes the parameter, and "Export" can be confirmed as the result set.

One key point in executing this generic module is whether it is defined as an "RFC" (Remote Function Call). The "RFC_READ_TABLE" is defined as a Remote-Enabled Module, allowing it to be called externally through the CData SAP ERP Driver.

Creating and Calling Custom Generic Modules and RFCs
Now, let's create a custom generic module and RFC, and call it from the CData Driver.
The generic module we will create is called "Z_HELLO_MODULE_1". It is a simple echo-type generic module that returns a string like "HELLO:{INPUT}" based on the input value. For example, if you pass the import parameter "INPUT" with the value "KAZUYA", it will return "HELLO:KAZUYA" in the export parameter "OUTPUT".

Let's create the new generic module.
Use the shortcut key "SE37" to move to the Function Builder, enter "Z_HELLO_MODULE_1" in the Function Module, and click "Create".

Specify the pre-created "Z_FUNCTION_GROUP" as the Function Group, enter an appropriate Short Text, and click "Save".

In the development screen of the generic module, define the import and export parameters. We created CHAR100 parameters named INPUT and OUTPUT.
When making it an RFC, ensure to define it as "Pass Value"


Then, write the ABAP code in the Source Code tab.
FUNCTION Z_HELLO_MODULE_1.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(INPUT) TYPE CHAR100 DEFAULT 'TEST'
*" EXPORTING
*" VALUE(OUTPUT) TYPE CHAR100
*"----------------------------------------------------------------------
DATA: VALUE TYPE string.
VALUE = 'HELLO:'.
CONCATENATE VALUE INPUT INTO OUTPUT.
ENDFUNCTION.

In the "Attributes" tab, check "Remote-Enabled Module" to enable this generic module as an RFC, save, and then activate it.

After activation, connect with the CData SAP ERP Driver, and you will see the added generic module displayed.

Execute the SQL command "EXEC Z_HELLO_MODULE_1 INPUT = 'KAZUYA';" to get the result as shown below!

Troubleshooting When the Target Generic Module is Not Displayed
If the target generic module you want to use is not displayed, check the Stored Procedure Filter connection property in the Help documentation: Stored Procedure Filter Property
By default, only BAPI generic modules are displayed due to the large number of generic modules.

By adding the following connection property; you can confirm all generic modules and RFCs: StoredProcedureFilter="*"

Conclusion
As demonstrated, the CData SAP ERP Driver is structured by effectively utilizing generic modules and RFCs to make the most of this feature to achieve SAP ERP integration. You can view more details about the CData SAP ERP Driver and download a free trial from the CData SAP ERP Driver page.