Lets explore AMDP – What is happening ?
AMDP(ABAP managed database procedures) enables coding SQL Script inside an ABAP Class method directly. OK, we are writing it inside the class methods, but where it is getting executed ? Answer is HANA Database for sure. How it is happening ? Let us explore.
Create a AMDP enabled class
Here I created a AMDP enabled class and wrote necessary implementation as below(Please don’t look into the logic. Its all weird ).
Now I activated the class and executed the method GET_MATERIAL_DESC.
For each of the exporting variables specified, it created SQL Views in the ABAP Schema .
(Did you notice the View name)
For each of the methods we are creating in the AMDP class, it will create 2 database procedures in the HANA DB. Both the view creation and procedures creation will be done when the class method is used first.(That is when it is executed for the first time – This make sense. Now it is so easy to transport the developments to Quality or Production system. We don’t need to bother about the HANA here ) .
Lets go the procedures created by it.
This procedure will contain the actual logic which we have written inside the AMDP Class method. Only difference is, it will replace the objects specified in the USING clause with the view name.
This procedure is a wrapper procedure for the real one created . This procedure will call the first procedure and project the returned result set.
Limitations of AMDP – Why is it so ?
Below are some key limitations of AMDP classes. Let us see, why it is so.
1.Methods with returning parameters cannot be implemented as AMDPs : A Procedure does not return anything. Which exports multiple outputs.
2.Method parameters have to be tables or scalar types – No Single line concept here in procedure returns.
3.Method parameters have to be passed as values : Well, how you will pass it by reference from ABAP to HANA SQL Script ? 🙂