Just a recap of ABAP Managed Database Procedures (AMDP) another amazing feature for code push down introduced in AS ABAP 7.4 SP5,
AMDP allows you to do code-push down to HANA and is ideal in cases where there is scope for making use of HANA specific features during code push down. AMDPs enable you to create database procedures directly in ABAP using e.g. SQL Script and to seamlessly integrate it in modern ABAP development. An AMDP can be implemented using an ABAP method.
An overview about the new AMDP features introduced in AS ABAP 7.4 SP8 by Horst Keller can be found hereABAP News for 7.40, SP08 – ABAP Managed Database Procedures (AMDP)
In general AMDP methods when called are executed on SAP standard database (primary HANA database). From AS ABAP 7.4 SP8 onwards it is possible to call AMDP method implementation by specifying a database connection explicitly
Special Input Parameter
- An input parameter with the name connection and type DBCON_NAME needs to be declared for an AMDP method.
class zcl_demo_amdp definition public final create public . public section. interfaces if_amdp_marker_hdb . methods increase_price importing value(connection) type dbcon_name default '' value(clnt) type sy-mandt value(inc) type sflight-price raising cx_amdp_error. endclass
Calling the AMDP Method with Connection information
- Pass initial value or the value “DEFAULT” to use the standard database connection
- Pass as value a name “R/3*name”(With prefix “R3*” in upper case letters and a user-defined name “name” (case sensitive)) to use a service connection of this name “name”
**** Call using Standard Database Connection(Primary HANA DB) lo_amdp_demo->increase_price( exporting connection = 'DEFAULT' clnt = '000' inc = 10 ). **** Call using named Database Connection "SECDB" lo_amdp_demo->increase_price( exporting connection = 'R/3*SECDB' clnt = '000' inc = 10 ).
The names “R/3*AMDP_SYNC” and “R/3*AMDP_ADBC” are reserved for the AMDP framework and would lead to exceptions at runtime if used.