SAP METHODS AMDP OPTIONS ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• AMDP OPTIONS CLASS-METHODS
• AMDP OPTIONS METHODS
ID METHODS-AMDP-OPTIONS

[CLASS-]METHODS, AMDP OPTIONS
Short Reference

ABAP_SYNTAX
[CLASS-]METHODS meth ... AMDP OPTIONS $[READ-ONLY$]
$[${CDS SESSION CLIENT clnt$|CURRENT$}
$| CLIENT INDEPENDENT$] ...

ABAP Addition
1 ... READ-ONLY
2 ... ${CDS SESSION CLIENT clnt$|CURRENT$}$| CLIENT INDEPENDENT

What does it do?
The addition AMDP OPTIONS for METHODS and CLASS-METHODS statements can be used to declare properties of AMDP methods of global classes or interfaces. After AMDP OPTIONS, at least one property must be specified.
If the addition AMDP OPTIONS is used in the declaration of a method, but the method is implemented as a regular ABAP method without the addition BY DATABASE PROCEDURE|FUNCTION, the properties specified by AMDP OPTIONS are ignored. However, the following restrictions for AMDP methods apply to the method declaration:
If there is no RETURNING parameter, the restrictions for AMDP procedure implementations apply.
If there is a RETURNING parameter, the restrictions described for AMDP function implementations apply.
A prerequisite for using AMDP OPTIONS is that the global class or the interface must contain a tag interface IF_AMDP_MARKER_... for AMDP classes . AMDP OPTIONS cannot be used in the following cases:
in local classes
for the constructors constructor or class_constructor
for event handlers declared with FOR EVENT
for redefinitions declared with REDEFINITION
for AMDP function implementations for CDS table functions declared with FOR TABLE FUNCTION
for AMDP function implementations for CDS scalar functions declared with FOR SCALAR FUNCTION .
• READ-ONLY METHODS
• READ-ONLY CLASS-METHODS

ABAP Addition

What does it do?
If the option READ-ONLY is specified, only reads of database tables are allowed in the implementation of the database procedure or database function. Only database procedures or database functions of other AMDP methods that are also marked as READ-ONLY can be called. This is checked during the syntax check or at runtime.
This property can also be specified using the addition OPTIONS in the implementation of an AMDP method with METHOD meth BY DATABASE PROCEDURE|FUNCTION. It applies when specified either in the declaration or in the implementation of the method, or in both places.
BEGIN_SECTION VERSION 5 OUT
The option READ-ONLY must be specified at least once in the implementation of an AMDP function or an L procedure. If the addition AMDP OPTIONS is used in the declaration of a method with a RETURNING parameter, the option READ-ONLY must already be specified in the declaration.
END_SECTION VERSION 5 OUT