Optimizing SAP ERP Performance
In this entry, you will find several methods for improving the performance of the SAP ERP (Netweaver) driver.
Date Entered: 2/10/2020 Last Updated: 2/10/2020
The primary reason for slow performance when working with SAP ERP is the default paging behavior employed. The issue stems from the fact that the driver cannot pass the offset value to the underlying database as it pages through the SAP tables.
The result of this is that each page has to start from offset 0 each time, causing each page to take longer than the previous one.
Solution 1: Use a Custom Table Read Function
To improve performance, the first thing you should check is your ABAP/kernel version.
Scenario 1: ABAP Version 7.52+
If you have an ABAP/kernel version 7.52 or above, you can use our included Z_CUSTOM_READ_TABLE_752 function (found in your installation directory in the db subdirectory).
This custom table reading function uses ABAP keywords new to version 7.52 to pass the offset to the next page, eliminating the SAP ERP paging issue. If your SAP instance can support this function, then this will be by far the most significant improvement to performance possible.
Scenario 2: ABAP Version Below 7.52
If you have an ABAP/kernel version below 7.52, there is no way to enable the improved paging (with passed offset). However, there are still a few ways to achieve some (less significant) performance improvements described below.
In this case, use the Z_CUSTOM_READ_TABLE function (instead of Z_CUSTOM_READ_TABLE_752).
While Z_CUSTOM_READ_TABLE does not inherently improve performance, it still enables a configurable buffer size, which you can then tweak for better performance (Solution 2 below).
Installing the Custom Read Function
After selecting either Z_CUSTOM_READ_TABLE or Z_CUSTOM_READ_TABLE_752, follow the steps below to install.
- 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.
- 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 either Z_CUSTOM_READ_TABLE.txt or Z_CUSTOM_READ_TABLE_752.txt, depending on your selection. 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 Z_CUSTOM_READ_TABLE_752 (based on the relevant function name).
Solution 2: Decrease Buffer Size
Decrease the buffer size to an amount that fits your needs. A smaller buffer size will be faster.
Before you can change the buffer size, you must be using a custom table read function.
The custom table read function is configured by opening Z_CUSTOM_READ_TABLE.txt or Z_CUSTOM_READ_TABLE_752.txt in your db folder and changing the value found just after line 180:
DATA: BEGIN OF WORK, BUFFER(30000), END OF WORK.
Solution 3: Increase Pagesize
Set a larger pagesize via the Pagesize connection property. A larger pagesize means fewer pages, and therefore less resets to offset 0. This is configured
Note that while performance will continuously improve as the pagesize increases, you can only increase the pagesize to the extent that your machine's memory can handle.
Solution 4: Supplying Filters
In some instances, you can significantly improve performance by supplying a filter, enabling you to retrieve data in smaller chunks, which means fewer pages of data to process. As an example, you could narrow down your results to only those from certain tables:
SELECT * FROM DD02T WHERE TABNAME >= 'A' AND TABNAME < 'B'
SELECT * FROM DD02T WHERE TABNAME >= 'B' AND TABNAME < 'C'
We appreciate your feedback. If you have any questions, comments, or suggestions about this entry, please contact our support team at email@example.com.