SAP ABAP MANAGED DB OBJECTS AMDP



Get Example source ABAP code based on a different SAP table
  



ABAP_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 and manages the procedures and functions as ABAP-managed database 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 AB_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 DDIC database views defined in ABAP Dictionary.
Instances of the CDS-managed DDIC views of ABAP_CDS_V1_VIEWS defined in ABAP CDS.
ABAP_NOTE Accessing a CDS-managed DDIC view is obsolete. ABAP_CDS_V1_VIEWS have been replaced by ABAP_CDS_V2_VIEWS .
Calls of the following ABAP-managed database procedures or database functions:
AMDP procedures and AMDP functions that do not implement any CDS table functions or CDS scalar functions can be called from other AMDP methods.
The AMDP table function of a CDS table function can be called from other AMDP methods.
The AMDP scalar function of a CDS scalar 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 the ABAP Dictionary and their possible enhancements 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 the ABAP Dictionary, which 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 the ABAP Dictionary is being accessed.
The typing of the formal parameters of an AMDP method using dictionary types is one way of creating appropriate 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. 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 internally 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 only applies when using AB_SQL to access a CDS table function implemented in AMDP.
AMDP cannot handle the enhancement category of DDIC 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 a ABAP_CDS_MNG_VIEW of a ABAP_CDS_V1_VIEW is accessed, its database-specific instance must be known. This applies in particular to ABAP_CDS_V1_VIEWS with input parameters.
ABAP_NOTE Accessing a ABAP_CDS_MNG_VIEW is obsolete.
When an instance of a CDS table function is accessed, its AMDP table function must be called.
When an instance of a CDS scalar 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 entity or a ABAP_CDS_V1_VIEW have the correct value. This applies in particular to the session variable client, to which the HANA session variable CDS_CLIENT is assigned and not 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.
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.



Latest notes:

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