ODBC Driver for SAP ERP

Build 24.0.9060

Using a Custom Read Table Function

RFC_READ_TABLE

The driver uses the SAP RFC_READ_TABLE function to get data from SAP tables. However, it 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 the amount that 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.

RFC_READ_TABLE2

The driver also supports the RFC_READ_TABLE2 table read function. You can switch the active table read function to RFC_READ_TABLE2 by setting ReadTableFunction to "/SAPDS/RFC_READ_TABLE2".

Custom Read Table Functions

Install a Custom Read Table RFC

The driver includes the code for Z_CUSTOM_READ_TABLE, a custom read-table RFC that is similar to the SAP RFC_READ_TABLE, but with a larger buffer to address the DATA_BUFFER_EXCEEDED problem as well as bypass other RFC_READ_TABLE limitations.

Follow the steps below to use the included custom read-table RFC to bypass limitations with the default 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, though Z_CUSTOM_READ_TABLE_752.txt is preferred if your SAP ERP instance is running ABAP version 7.52 or later (see section below). 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.

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, 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 causes 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.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060