AMDP – ABAP Managed Database Procedures

With the ABAP Managed Database Procedures, or AMDP for short, SAP succeeds in making the performance of the SAP HANA database in ABAP developments easy to use. This is a framework that now includes not only SQLScript procedures, but also functions and also allows the creation of views programmed in SQLScript with the CDS-Table Functions.

On this page I have compiled some useful Information to this topic.

Use cases of AMDP

The ABAP Managed Database Procedures technique is used for different scenarios. Probably the most important is the useage in SAP BW/4HANA:

AMDP for SAP BW/4HANA Transformation Routines

With the BW on HANA, SAP has re-implemented the execution of data transfer processes (DTPs). Directly on the HANA database. This has brought an enormous acceleration and reduced the runtime by a factor of 10. A prerequisite for this HANA execution, however, is that no ABAP routines are used in the transformations.

The alternative to ABAP routines are procedures in SQLScript. These are developed as AMDP methods. The structure of these classes and methods is generated by the BW system to match the definition of the transformation. The developer then has to develop the SQLScript code. There is no need for a deeper understanding of the definition of database procedures.

AMDP in ABAP programs

The use of SQLScript is especially useful when

  1. there are large amounts of data, and
  2. the execution time is relevant.

Both are given in SAP BW, which is why AMDP plays a major role here. But if these factors also apply to an ABAP program in S/4HANA, then we can use SQLScript via AMDPs here as well. Either to run procedures directly on the database. These can access tables in read and write mode.

Or in the form of CDS-Table Functions as programmed views. These are implemented in SQLScript as a function. A CDS entity then serves as a wrapper to make it available to ABAP programs. They can be used there like a DDic view in a SELECT query.

Blog articles about AMDP

Quellcode

AMDP (ABAP Managed Database Procedures)

With the ABAP Managed Database Procedures, or AMDP for short, SAP succeeds in making the performance of the SAP HANA database in ABAP developments easy …

AMDPs can also be used to solve many things where performance is not a concern nor mass data. Sometimes the SQLScript language is just better suited for solving a problem. For example, the Window Functions provide a simple and elegant alternative for calculations in LOOPs, where we have

  • store values from the previous loop pass in a variable and
  • In the control break with AT NEW, delete this variable again and
  • perform cross-line calculations with this variable.

These algorithms are error-prone and can often be solved very elegantly in SQLScript by using a window function.

AMDP Example

This post is also available in: Deutsch