Enterprise Resource Planning Blog Posts by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
679

AMDP Class 

An AMDP (ABAP Managed Database Procedure) class is used to write complex logic directly in the SAP HANA database using SQL Script, instead of writing everything in ABAP.

This helps to:

  • Improve performance by processing data inside the database.
  • Reduce load on the application layer.
  • Speed up reports and data-heavy programs.

 Open Eclipse.

Step 1: Create a package.

 

Krishnaveni_Palanisamy_14-1746180496124.png

 

Give basic properties.

 

Krishnaveni_Palanisamy_15-1746180496127.png

 

Select Transpost request.

Krishnaveni_Palanisamy_16-1746180496133.png

STEP2 : Create AMDP class

Krishnaveni_Palanisamy_17-1746180496139.png

 The class will be like below.

Krishnaveni_Palanisamy_18-1746180496142.png

 

To convert the normal class into the AMDP class, use the interface IF_AMDP_MARKER_HDB

Krishnaveni_Palanisamy_19-1746180496151.png

 

Create class attributes, and to implement the method, click on CTRL+1.

Krishnaveni_Palanisamy_20-1746180496164.png

The AMDP procedure will run on HANA DB. The memory location is not available at the database level. It is only available at the application level, so we have to pass the parameter with a pass-by value.

 

Krishnaveni_Palanisamy_21-1746180496168.png

Two Types of AMDP Methods :

In AMDP, we can write two types of methods:

  1. Database Procedure
  • This is a normal AMDP method written in SQL Script.
  • It can be used to read or modify data.
  • Called directly from ABAP like a regular method
  1. Database Function (Table Function)
  • This is used with CDS Views to return a result set like a virtual table.
  • Implemented using an AMDP method, but used as a function in CDS.
  • Always read-only.

Here we will see Database Procedure.

To convert the method to the AMDP method.

  • To convert the normal method to the AMDP method write some code to the implementation part of methods.

Specify the target database in which you want to create the database procedure, along with the database language to be used. Additionally, list all the objects (such as tables, views, procedures, etc.) that need to be accessed within the specified schema.

  • 2.AMDP procedure is not implicit in client handling. So, we need one more parameter to pass the client.

 

Krishnaveni_Palanisamy_22-1746180496174.png

An error will occur when using the Database table in the AMDP method.

Krishnaveni_Palanisamy_23-1746180496179.png

Step 3:

Create a program to consume the AMDP class.

Krishnaveni_Palanisamy_24-1746180496194.png

Search PROGRAM and select ABAP program.

Krishnaveni_Palanisamy_25-1746180496199.png

Write the below code.

Krishnaveni_Palanisamy_26-1746180496201.png

 

Output :

Krishnaveni_Palanisamy_27-1746180496203.png

 

Conclusion:

AMDP procedures are a powerful way to push complex logic to the SAP HANA database, allowing you to handle large volumes of data more efficiently.

Use AMDP procedures when:

  • You want to improve performance with code pushdown.
  • You need to process data-heavy logic directly in HANA.
  • You want to keep your ABAP code clean and efficient.
2 Comments