How to extend an ABAP Managed Database Procedures using AMDP BADI’s
Summary : Extend an ABAP Managed Database Procedures using AMDP BADI.
With ABAP 7.4 SP08, the modification-free enhancement of AMDPs is now possible using so-called AMDP BAdIs. The AMDP BAdIs transmit the effect of the switches from the Switch Framework to the implementation of database procedures in the current database. It allows the definition of a clear contract between extension provider and extension consumer (aka implementer) through a dedicated interface. AMDP BAdIs are created in Enhancement Spots in the transaction SE20 and are later called within an AMDP implementation similarly to other AMDPs.
Tasks to be performed for modification-free extension of AMDP using BADI;
Extension Provider: Solution provider
- Create Enhancement Spot ( i.e. AMDP BADI Definition)
- Define AMDP BADI Interface and implement fallback Class.
- Integrate the enhancement spot in the application code.
Extension consumer: Customer
- Provide an implementation class for the AMDP BADI.
- Create a BADI implementation and set it to active.
We will follow the below steps to extend this AMDP method using BADI;
During the creation of a AMDP BAdI definition in SE20;
- New option “AMDP BAdI” must be checked
- Filters are not supported
- BAdI Interface must only contain AMDP method definition (check the prerequisites of method interfaces for AMDP methods)
- Fallback class must be specified
- Only AMDP classes can be provided as fallback class or implementation class
Regarding the implementation of BAdI classes (i.e. Fallback class or implementation classes)
- Only AMDP implementations of the BAdI interface methods must be provided
- Only AMDP methods for a database platform can be implemented in a BAdI class (only SAP HANA currently supported)
Regarding the invocation of a BAdI within an AMDP method
- BAdI invocation has to be declared after the addition USING of the relevant AMDP method. USING BADI_NAME=>METHOD_NAME
- The call is syntactically similar to a procedure call CALL “BADI_NAME=>METHOD_NAME”( * set input and output parameters here );
We will take an example to show the customer classification demo report where it gives the category details for the customers.
Example customer classification Report and it will show the customer details along with category details:
Example output of the customer classification results before modification AMDP method;
Example output of the customer classification results After modification AMDP method;
We will take a look at the class: ZCL_OAI_BUPA_CLASIFICATION;
In the below class implementation we can see AMDP method:EXICUTE.
The below tasks need to be performed to extend ABAP managed Database procedure using AMDP BADI’s.
1.Create Enhancement Spot using SE20 Transaction code ( i.e. AMDP BADI Definition)
2.Create BADI Definition for the Enhance spot.
Here we have to select AMDP BADI checkbox.
3.Create Interface for that BADI;
Once interface created , we could see the below one;
Here we need to copy the existing interface definations into the new one and copy the AMDP method with rename to classify to enhance the existing logic.
Fallback class must be specified;Only AMDP classes can be provided as fallback class or implementation class;
Call Fallback implantation class;
Call the BADI from AMDP Method : EXICUTE from the class : ZCL_OAI_BUPA_CLASSIFICATION;
We can enhance the logic in the implemented class : ZCL_OAI_CLASSIFICATION_IMPL01.
execute the Report and see the results after modification;
Final results of category results after modification of AMDP method using BADI;
Hi Reddy Sir ,
Could you please send me the code of class OAI_BUPA and all other code please .
Thanks and Kind Regards,
Praveen Bindla ,