Using a Custom Read Table Function
The RFC_READ_TABLE and Custom Read Table Functions
The driver uses the SAP RFC_READ_TABLE function to get data from SAP tables. RFC_READ_TABLE is well documented and has certain limitations.
As an example, consider the DATA_BUFFER_EXCEEDED exception. The SAP RFC_READ_TABLE has a fixed size of 512 bytes it can buffer for each row of data, and thus you cannot select more columns than what would fit in this buffer. If you select more than 512 bytes, an exception will occur indicating that you have exceeded the maximum buffer size allowed per row and need to select fewer columns.
The driver includes the code for a custom read-table RFC that is similar to the SAP RFC_READ_TABLE but has a larger buffer that can address the DATA_BUFFER_EXCEEDED problem as well as solve other RFC_READ_TABLE limitations.
Install a Custom Read Table RFC
Follow the steps below to use the included custom read-table RFC to bypass limitations with the default RFC_READ_TABLE.
- 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".
- On the Attributes tab of the SAP screen, select "Remote Enabled Module".
- On the Tables tab, set the DATA parameter to "CHAR8000" (you may need to right-click and then click "Display <-> Change")
- 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.
- Define the imports, tables, and exceptions as documented in the provided custom read table.
- Activate the function module and in your connection string set ReadTableFunction to Z_CUSTOM_READ_TABLE, or the name of your function module.
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.