Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP-Managed Database Objects →  Access to ABAP-Managed Database Objects 

AMDP Access to ABAP-Managed Database Objects

ABAP Managed Database Procedures (AMDP) is a class-based AS ABAP framework for managing and calling database procedures and database functions in the SAP HANA database. No other database platforms are currently supported. AMDP methods are implemented in SQLScript. The AMDP framework creates the procedures and functions as ABAP-managed database objects and is also the management framework for these objects. From ABAP, AMDP procedures or AMDP scalar functions are called using method calls. AMDP table functions, on the other hand, are called by accessing the associated CDS table function using ABAP SQL. The AMDP framework itself uses the AS ABAP Native SQL interface internally to access the database.

AMDP can be used to access ABAP-managed database objects as follows:

  • Reads and writes on the following ABAP-managed database objects in the SQLScript implementation of an AMDP method.
  • Calls of the following ABAP-managed database procedures or database functions:

The most important AMDP features are as follows:

  • The management of AMDP procedures and AMDP functions is the full responsibility of the AMDP framework. This framework creates these database objects before they are used for the first time in ABAP or updates them as required.
  • AMDP methods are implemented as platform-dependent methods and their implementation is currently restricted to SQLScript in the SAP HANA database.
  • Data types defined in ABAP Dictionary (and any enhancements of these types) are not currently known in the actual implementation of AMDP methods. Dictionary types are, however, respected as follows:
  • If possible, AMDP respects the order of fields defined in ABAP Dictionary, since this can differ from the order in the database. To do this, a view is generated internally. The prerequisite for this feature is that the AMDP framework detects that a database object defined in ABAP Dictionary is being accessed.
  • The typing of the formal parameters of an AMDP method using dictionary types is one way of creating matching variables. Here, a predefined mapping takes place between ABAP types and database types.
  • Any null values passed from formal parameters to ABAP data objects are transformed to their type-dependent initial values. There is no special handling, however, within the implementation of an AMDP method.
  • The interface parameters of AMDP methods can be tabular parameters. Internal ABAP tables can be bound to all categories of parameters. In the case of input/output parameters declared using CHANGING, the parameters are transformed to a pair of input and output parameters declared using IN and OUT.
  • The AMDP macro $ABAP.type can be used to specify ABAP Dictionary types and other ABAP types in the implementation of an AMDP method. The AMDP framework transforms this information into the respective HANA types.
  • AMDP does not support the following ABAP Dictionary and ABAP CDS functions:
  • AMDP does not support implicit client handling. The client ID must either be passed explicitly using an input parameter (recommended) or the ABAP-specific session variables CLIENT and CDS_CLIENT can be accessed. When an AMDP method is called whose declaration specifies the addition AMDP OPTIONS CDS SESSION CLIENT, the value of the session variable CDS_CLIENT can be set to the value of an input parameter here.
  • AMDP accesses the database objects of CDS entities directly and ignores any other properties of CDS entities:
  • When the CDS database view of a CDS view is accessed, the database-specific instance created of this view must be known. This applies in particular to CDS views with input parameters.
  • When an instance of a CDS table function is accessed, its AMDP table function must be called.
  • Care must be taken that all session variables used in a CDS view have the correct value. This applies in particular to the session variable client, which is mapped to the HANA session variable CDS_CLIENT and not to CLIENT.
  • The ABAP-managed database objects accessed in an AMDP method must be declared with USING in the implementation of the method. This guarantees that the AMDP methods are recorded in the where-used list.
  • DDL statements are not allowed in AMDP methods. Furthermore, no statements are allowed that are only possible in database tables and not in views, such as TRUNCATE TABLE or LOCK TABLE.
  • The SQLScript used to implement AMDP methods can use the input parameters of the AMDP as operands but does not support dynamic tokens.

Other versions: 7.31 | 7.40 | 7.54


Implementations of AMDP methods can be debugged in the ABAP Development Tools (ADT).