Register Login

ABAP Managed Database Procedure (AMDP) in HANA

Updated May 18, 2018

This tutorial gives us an introduction to ABAP Managed Database Procedure in HANA

Definition of ABAP Managed Database Procedure (AMDP)

ABAP Managed Database Procedure (AMDP) is a class-based framework for managing and calling database procedure in ABAP.

Bottom-Up Approach with Database Procedure Proxies

As we know the currently, the optimized way for using HANA procedures in ABAP is provide by Database Procedure Proxies which was introduced with Application ABAP 7.4 with service package 2.

In this Bottom-up approach, the database has first to be developed in HANA server and then expose the Database Procedure Proxy in ABAP server. To ensure that dependent ABAP and HANA content is exported together in HANA Transport Container and HANA Delivery Unit are required.

This Bottom-UP approach involves the problem of having a different independent life cycle in TMS (Transport Management System) for the HANA and ABAP content.

ABAP Managed Database Procedure (AMDP) (Top-Down Approach)

The solution for the problem faced in Bottom-Up approach is provided by ABAP Managed Database Procedure (AMDP).

This Top-Down approach enables developers to create a managed whole life-cycle of HANA procedure in ABAP Development Environment.The AMDP is implemented as a method of a global class which is marked with specific interfaces called as AMDP class.

In corresponding to AMDP class, the HANA based SQL class is created at the first call of the method.

Advantage of AMDP Process

  • The main advantage of this method that only the AMDP class has to be transported wit ABAP transport mechanism.
  • No HANA delivery or HANA transport system is required in this process.
  • Developers only need ABAP development tools for building and managing the CDS view. There is no need for additional HANA development tools.

Example of AMDP Class Definition

CLASS CL_AMBP_EXAMPLE DEFINITION.

PUBLIC SECTION.
INTERFACES IF_AMDP_MARKER_HDB. //Marker Interface for HANA DB//

METHODS process //Only ABAP code is possible//
IMPORTING it_param TYPE type1
EXPORTING et_param TYPE type2.

METHODS execute //SQLScript or ABAP code both are possible//
IMPORTING VALUE(it_param) TYPE type1
EXPORTING VALUE(et_param) TYPE type2. //specific parameter interface required//
CHANGING VALUE(ch_param) TYPE type3

ENDCLASS.

AMDP Class Implementation

CLASS CL_AMDP_EXAMPLE IMPLEMENTATION

METHODS process
// Write ABAP source code here//
...
ENDMETHOD

METHOD execute BY DATABASE PROCEDURE //AMDP method marker//
FOR HDB //Database platform//
LANGUAGE SQLScript //Database language//
[OPTIONS READ-ONLY] //Database-specific options//
USING name1 name2 etc... //List of used DDIC entities and AMDPs//

//Write here the SQLScript coding//
select * from dummy;
...
ENDMETHOD.
ENDCLASS.

Features of ABAP Managed Database Procedure (AMDP)

  • Static check code and Syntax colouring are provided for embedded SQLScript
  • The user can set a Background colour for better visibility AMDP methods in the class.
  • The User can access other AMDP methods, ABAP dictionary view and ABAP tables in AMDP method.
  • AMDP method are called like other regular ABAP methods.
  • User can perform detailed analysis of various error during runtime in transaction ST22
  • Modification or Enhancement of regular ABAP classes can be done by Users.


×