Design a Custom SAP Function Module to Circumvent RFC_READ_TABLE Limitations



You can use CData SAP Data Providers to view SAP data as a relational database and select any data set you need through data access standards. However, the RFC_READ_TABLE function module that all CData driver technologies use by default has a 512-byte-per-row limitation. You can follow the steps below to bypass this and other limitations with RFC_READ_TABLE.

Create a Custom Function Module

You can follow the procedure below to use the included source code to create an alternative to RFC_READ_TABLE.

  1. Use the RFC_READ_TABLE function as a template for the new function: Select transaction code SE37 and the SDTX Function Group and copy RFC_READ_TABLE to a new function group or your working function group. In this example, RFC_READ_TABLE is copied to "Z_CUSTOM_READ_TABLE".
  2. On the Attributes tab of the SAP screen, select "Remote Enabled Module".
  3. On the Tables tab, set the DATA parameter to "CHAR8000" (you may need to right-click and then click "Display <-> Change"):
  4. On the Source Code tab, paste the example source code for the replacement RFC_READ_TABLE function module located in the "db" subfolder of the installation directory. The code is located in Z_CUSTOM_READ_TABLE.txt. Click Save.
  5. Define the imports, tables, and exceptions as documented in the provided custom read table.
  6. Activate the function module and in your connection string set ReadTableFunction to Z_CUSTOM_READ_TABLE, or the name of your function module.

You can now select any fields in SAP.

The ABAP 7.52 Custom Read Table

Along with Z_CUSTOM_READ_TABLE.txt, there is also a Z_CUSTOM_READ_TABLE_752.txt file. This one is designed for ABAP version 7.52 and above. It is mostly the same as Z_CUSTOM_READ_TABLE, but it takes advantage of newly available keywords in ABAP 7.52 to perform paging within the database instead of in the ABAP script itself. This makes paging far more efficient and will give a very noticeable performance boost when working with large tables. It is recommended to use the Z_CUSTOM_READ_TABLE_752 RFC if at all possible.

 
 
Downloads