An example of AMDP( ABAP Managed Database Procedure ) in 740
ABAP Managed Database Procedures are new feature available in AS ABAP 7.40, SP05 which enables you to manage and call stored procedures or database procedure in AS ABAP. An ABAP Managed Database Procedure is a procedure written in its database-specific language (Native SQL, SQLScript, …) implemented in an AMDP method of an AMDP class.
I use a simple example to show how it works. In line 21 the check is done against database type. Since I will demonstrate to manage and call store procedure writtin in SQLScript in HANA, the sample must be running in HANA DB.
Then in line 26 a pop up is displayed to allow user input how much price he would like to increase. In line 33, the price is increased by calling
HANA store procedure, with the help of AMDP class CL_DEMO_AMDP.
An AMDP class to handle with HANA stuff must inherit the tag interface IF_AMDP_MARKER_HDB
And AMDP method must specify the database type ( HDB ) and language type ( SQLSCRIPT ) using keyword shown below.
The “:” in line 4 and line 5 are specific syntax of SQLScript – the importing parameter should have it as prefix.
The most important part is the AMDP class could not be developed in SAP GUI, but only possible in ABAP development Tools ( i.e ABAP in Eclipse)
Every AMDP method corresponds to a store procedure which you can find in HANA studio. Or you can also find it via ST05:
Meanwhile this document Implement and consume your first ABAP Managed Database Procedure on HANA also introduces another good example.