From NetWeaver 740, AMDP( ABAP Managed Database Procedures ) has been supported. With AMDP, developers can write database procedures directly in ABAP. Using AMDP allows developers to create and execute those database procedures in the ABAP environment using ABAP methods and ABAP data types.
Today I’m going to show you how to invoke AMDP from Script Logic in BPC standard model.
Firstly as a starting point, you need to create a normal Custom Logic BAdi. This can be done in transaction SE18. In this example, we created a BAdi named ZBPC_CALL_AMDP.
Then we need to create a class as the implementation of this BAdi. The class need to implement 3 interfaces:
Notice that because this class contains AMDP, it has to be developed in the ABAP Development Tools. Below is the full content of the code. As this article is not showing you how to develop ADMP, I used a very simple dummy SQL in the method.
class ZCL_BPC_AMDP definition public final create public . public section. interfaces IF_BADI_INTERFACE . interfaces IF_UJ_CUSTOM_LOGIC . interfaces IF_AMDP_MARKER_HDB . methods call_amdp. protected section. private section. ENDCLASS. CLASS ZCL_BPC_AMDP IMPLEMENTATION. method IF_UJ_CUSTOM_LOGIC~CLEANUP. endmethod. method IF_UJ_CUSTOM_LOGIC~EXECUTE. call method call_amdp. endmethod. method IF_UJ_CUSTOM_LOGIC~INIT. endmethod. method call_amdp by DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT options READ-ONLY. select * from dummy; ENDMETHOD. ENDCLASS.
Last step for BAdi creation is the Filter, to be simple I used “AMDP”.
Now the BAdi creation is completed. Let’s try to create a Script to invoke it. As the BAdi created above doesn’t rely on any structure. You can create the script in any model. Below is the sample Script:
Now you can run the script in Data Manager or UJKT.