SAP METHOD BY DB PROC ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• BY DATABASE PROCEDURE METHOD
• BY DATABASE FUNCTION METHOD
• BY DATABASE GRAPH WORKSPACE METHOD
ID METHOD-BY-DATABASE

METHOD, BY DATABASE PROCEDURE, FUNCTION, GRAPHWORKSPACE

ABAP_SYNTAX
METHOD meth BY DATABASE PROCEDURE$|FUNCTION$|${GRAPH WORKSPACE$}
FOR db
LANGUAGE db_lang
$[OPTIONS db_options$]
$[USING entities$]
$[USING SCHEMA schema1 OBJECTS db_entities$]
$[USING SCHEMA schema2 OBJECTS db_entities$]
... .
...
ENDMETHOD.

ABAP Addition
1 ... FOR db
2 ... LANGUAGE db_lang
3 ... OPTIONS db_options
4 ... USING entities
5 ... USING SCHEMA schema OBJECTS db_entities

What does it do?
Implements an AMDP procedure, an AMDP function, or a graph workspace in an AMDP class. The addition BY DATABASE PROCEDURE, BY DATABASE FUNCTION or BY DATABASE GRAPH WORKSPACE can be specified in the implementation part of a global class that contains an appropriate tag interface IF_AMDP_MARKER_... for AMDP classes.
The addition BY DATABASE PROCEDURE defines an AMDP procedure implementation for implementing a database procedure.
The addition BY DATABASE FUNCTION defines an AMDP function implementation for implementing a database function.
The addition BY DATABASE GRAPH WORKSPACE defines a graph workspace that can be consumed by a graph procedure using GraphScript, see Graph Processing.
The parameter interface of the method declared in the declaration part must meet the prerequisites for AMDP procedure implementations or AMDP function implementations. The parameter interface of an AMDP function implementation that implements a CDS table function is taken from the definition of the CDS table function specified after the addition FOR TABLE FUNCTION in the declaration of the method. The parameter interface of an AMDP function implementation that implements a CDS scalar function is taken from the definition of the CDS scalar function specified after the addition FOR SCALAR FUNCTION in the declaration of the method.
The addition FOR db defines the database system where the method is used. The addition LANGUAGE defines the database-specific language in which the method is implemented. OPTIONS is used to specify database-specific options. USING is used to declare database objects managed by ABAP that are used in the AMDP method.



Latest notes:

If the current AS ABAP does not have sufficient authorizations to manage database procedures or database functions in its database system, syntax errors can occur in AMDP methods. Missing authorizations can be identified using transaction SICK.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLES_ABEXA
AMDP - Examples
ABAP_EXAMPLE_END
• FOR HDB METHOD BY DATABASE PROCEDURE
• FOR HDB METHOD BY DATABASE FUNCTION

ABAP Addition

What does it do?
Determines the database system for which the AMDP method is used. The AMDP class must contain the appropriate tag interface. The following table shows the syntax that can be specified for db, the database system it identifies, and the required tag interface. dbDatabase SystemTag Interface
HDBSAP HANA database IF_AMDP_MARKER_HDB
The AMDP method can only be called in an AS ABAP whose standard database is managed by the specified database system. Otherwise a runtime error occurs.



Latest notes:

Currently, the only available database is the SAP HANA database.
Additional regular methods can be provided to make an AMDP class with AMDP procedure implementations generally available. These methods call the AMDP methods depending on the database system of the current standard AS ABAP database. In database systems that do not yet support AMDP, an alternative implementation in AB_SQL can be created in regular methods.
NON_V5_HINTS
In the latter case an alternative implementation in Native SQL can be created as well.
ABAP_HINT_END
• LANGUAGE SQLSCRIPT METHOD BY DATABASE PROCEDURE
• LANGUAGE SQLSCRIPT METHOD BY DATABASE FUNCTION
• LANGUAGE SQL METHOD BY DATABASE PROCEDURE
• LANGUAGE SQL METHOD BY DATABASE FUNCTION
• LANGUAGE GRAPH METHOD BY DATABASE PROCEDURE
• LANGUAGE GRAPH METHOD BY DATABASE FUNCTION
BEGIN_SECTION SAP_ONLY
• LANGUAGE LLANG METHOD BY DATABASE PROCEDURE
END_SECTION SAP_ONLY

ABAP Addition

What does it do?
Determines the database-specific language in which the AMDP is implemented. The following table shows the syntax for db_lang used to specify the language depending on the specified database system db, the meaning, and a link to further information. dbdb_langLanguageMore Information
HDBSQLSCRIPTSQLScript
BEGIN_SECTION ID METHOD-BY-DATABASE-SQLS SQLScript for the SAP HANA Database
END_SECTION ID METHOD-BY-DATABASE-SQLS
HDBSQLDDL
BEGIN_SECTION ID METHOD-BY-DATABASE-SQL Not yet documented
END_SECTION ID METHOD-BY-DATABASE-SQL
HDBGRAPHGraphScript
BEGIN_SECTION ID METHOD-BY-DATABASE-GRAPH Graph Processing
END_SECTION ID METHOD-BY-DATABASE-GRAPH
BEGIN_DELETE ID METHOD-BY-DATABASE-LLANG
BEGIN_SECTION SAP_ONLY
HDBLLANG L L for the SAP HANA database (for internal SAP use only and only for AMDP procedure implementations)
END_SECTION SAP_ONLY
END_DELETE ID METHOD-BY-DATABASE-LLANG
The ABAP syntax check examines the implementation of the method for the specified language as far as possible. This is possible only if the check takes place on an AS ABAP whose standard database is managed by the specified database system. The check is performed with respect to the currently installed version of the database. No checks take place on an AS ABAP with a different database system.
• OPTIONS READ-ONLY METHOD BY DATABASE PROCEDURE
• OPTIONS SUPPRESS SYNTAX ERRORS METHOD BY DATABASE PROCEDURE
• OPTIONS READ-ONLY METHOD BY DATABASE FUNCTION
• OPTIONS SUPPRESS SYNTAX ERRORS METHOD BY DATABASE FUNCTION
• OPTIONS DETERMINISTIC METHOD BY DATABASE FUNCTION

ABAP Addition

What does it do?
Specifies database-specific options for the AMDP procedure or function. The following table shows the syntax for option depending on the specified database system db and the associated meaning. dboptionMeaning
HDBREAD-ONLYOnly reads are allowed on the database tables in the database procedure or database function. Other AMDP methods can be called only if they are also flagged as READ-ONLY.
HDBDETERMINISTICFor AMDP scalar functions only. If a query calls an AMDP scalar function more than once with the same values for the input parameters and with the option DETERMINISTIC, the function is performed only once, and the result is buffered for the duration of the query. In AMDP scalar functions like this, no functions are allowed that could return different values in different calls. For more information, see SAP Hana SQLScript Reference.
HDBSUPPRESS SYNTAX ERRORS
BEGIN_SECTION ID METHOD-BY-DATABASE-NO-SYN-ERR For internal SAP use only: If the AMDP procedure accesses database objects not managed by ABAP that do not yet exist at the time of the syntax check, only syntax warnings are raised and not syntax errors. If a required object is missing at runtime, a catchable exception is raised.
END_SECTION ID METHOD-BY-DATABASE-NO-SYN-ERR
The option READ-ONLY can also be specified with the addition AMDP OPTIONS in the declaration of an AMDP method. It applies when specified either in the implementation or in the declaration of the method, or in both places.
BEGIN_SECTION VERSION 5 OUT
These options are optional, with the following exception: READ-ONLY must be specified at least once in the implementation of an AMDP function or an L procedure.
END_SECTION VERSION 5 OUT