AMDP’s Alternative To READ_TEXT Function Module
The Functional Module READ_TEXT is used to fetch different long text objects or long text values in SAP. But while using this module for retrieving mass amount of long texts, we have come across huge performance issues.
In order to meet customers’ expectations, an organization should deliver the safe product performed in accordance with requirement. To overcome this performance issue, we investigated and found few reports and functional modules which replace READ_TEXT.
As the world is revolving through S/4 HANA, I thought of why we can’t accommodate this by creating AMDPs.
This article focuses on how to use AMDP, one of the code push-down techniques in S/4 HANA to overcome the performance problem while using traditional READ_TEXT function module for retrieving mass amount of long texts.
ABAP Managed Database Procedure (AMDP)
ABAP Managed Database Procedure is one of the Code Push-Down techniques in HANA. A Code Push-Down Technique comprises of delegating data intense calculations to the database layer. They are stored and executed in the database itself.
These AMDPs work with high performance because the complex calculations will be executed inside HANA database. They are used to leverage native capabilities of SAP HANA from ABAP. The language behind creating AMDPs is SQL script. Write your own SQL Script procedures and access them from ABAP.
AMDPs can be created using ADT (ABAP Development Tools) – Eclipse or HANA studio which has a syntax check with meaningful error messages and warnings. It also includes syntax highlighting, references and navigation.
AMDPs can also recreate database procedures, if the source code or dependent objects change and can delete obsolete database procedures asynchronously.
Let us understand how to use AMDPs as an alternative to overcome the performance problem in using READ_TEXT function module.
The basic idea is simple – Use ABAP classes as containers for SQL Script and let HANA SQL Script source code benefit from the existing ABAP development tools and lifecycle management.
AMDP Method: Here the referenced objects from the Data Dictionary & AMDP methods must be listed in the USING clause. First fetch the data from SAP script text file header table.
Normal Method in an AMDP class: Use this method to fetch the text file lines.
We can also trace the AMDP method to analyze the performance using AMDP_UTILS tcode, which provides us the list of AMDP utilities present in our system.
You will find a report with name RS_AMDP_STMT_TRACE, double click on it and a screen will appear like traditional ST05 trace which allows you to perform trace for an AMDP method.
I have compared the execution times between the traditional READ_TEXT function module and the AMDP. AMDP method took 26.68 seconds to fetch long texts of 9,517 objects while READ_TEXT function module leads to TIMEOUT exception.
Thus, AMDP’s can be used to minimize the application server logic and thereby improving the performance of the objects as they can be executed in database itself.
Contact for further details
Team Lead – ERP SAP Technical