An AMDP function implementation is an AMDP method for implementing an AMDP function as a
table function. An AMDP
function implementation is indicated as an AMDP method in the implementation part of the class using
the addition BY DATABASE FUNCTION
of the statement METHOD. AMDP functions can be defined that can be accessed only in other AMDP methods and functions defined that implement
CDS table functions.
An AMDP function implementation must have a
return value defined using
RETURNING. The data type of the return value must be tabular with a structured row type whose components are elementary. Any
table category and
table key can be specified for return value.
No class-based exceptions can be declared using RAISING in the interface of an AMDP function implementation.
In declarations of the AMDP method using the addition
AMDP OPTIONS READ-ONLY or in implementations of the AMDP method using the addition OPTIONS READ-ONLY, any AMDP function implementations must be restricted to reads.
An AMDP function defined
using a AMDP function implementation like this can only be called in other AMDP methods and not in database procedures managed in AMDP or in database functions like database
The input parameters in the AMDP function implementation are determined by the
input parameters of the CDS table function.
Their names are used and the ABAP types are derived from their Dictionary types. The input parameters are not optional.
A return value with the type of a standard table is created with an empty table key named result with a structured row type. The components of the row type are determined by the
elements of the CDS table function. Their names
are used and the ABAP types are derived from their Dictionary types. The row type corresponds to the
structured data type, which the CDS table function represents with respect to ABAP. In the case of a client-specific CDS table function, the client column is also included.
The AMDP function defined by an AMDP function implementation like this can be used as follows using the
CDS entity represented by the CDS table function:
Furthermore, the same uses as in the preceding function implementation are possible in other AMDP methods or other database procedures or database functions
The row type of the return value result of an AMDP function implementation
for a client-specific CDS table function does not contain a client field, even though this field must be declared in the element list.
An AMDP function implementation can only be associated with a single CDS table function.
When an AMDP function implementation is created for a CDS table function, it must already exist
as an active function. When a new CDS table function is activated, an empty AMDP function is created
in the database. This function raises an exception if a non-AMDP access is performed. When the CDS table
function is accessed by the ABAP runtime environment for the first time (for example, using Open SQL), the AMDP function implementation implements the empty AMDP function. Other frameworks that evaluate CDS entities using their
can also cause the AMDP function to be implemented. It is possible to access the table function in a native way only after the implementation.