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.
- Instances of the database tables and classic database views defined in ABAP Dictionary.
- Instances of the CDS database views of CDS views defined in ABAP CDS.
- Calls of the following ABAP-managed database procedures or database functions:
- It is possible to call AMDP procedures, as well as AMDP functions that do not implement any CDS table functions, from other AMDP methods.
- The AMDP table function of a CDS table function can be called from other AMDP methods.
- The ABAP-specific session variables can be read using the built-in HANA function SESSION_CONTEXT.
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
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 does not support table buffering.
- AMDP does not support CDS access control. CDS access control can only be applied when using ABAP SQL to access a CDS table function implemented in AMDP.
- AMDP cannot handle the enhancement category of structures.
- AMDP does not support the logging of database tables.
- 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.
- AMDP cannot handle CDS associations and CDS roles.
- 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
USINGin 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.
- AMDP supports ABAP-managed service connections but does not support secondary connections.
- The SQLScript used to implement AMDP methods can use the input parameters of the AMDP as operands but does not support dynamic tokens.
- In the implementation of AMDP methods, the AMDP macro "$ABAP.schema can be used to specify logical schemas that are transformed to the names of actual database schemas by the AMDP framework. This enables, for example, simple access to HDI objects that use an ABAP-managed HDI container as an interface to the Change and Transport System.
- AMDP respects the dependency rules defined for a database.
- AMDP respects data aging by default.
7.31 | 7.40 | 7.54
Implementations of AMDP methods can be debugged in the ABAP Development Tools (ADT).