Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
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

  1. Create Enhancement Spot ( i.e. AMDP BADI Definition)

  2. Define AMDP BADI Interface and implement fallback Class.

  3. Integrate the enhancement spot in the application code.

Extension consumer: Customer

  1. Provide an implementation class for the AMDP BADI.

  2. Create a BADI implementation and set it to active.

  3. Test

We will follow the below steps to extend this AMDP method using BADI;

During the creation of a AMDP BAdI definition in SE20;

  1. New option “AMDP BAdI” must be checked

  2. Filters are not supported

  3. BAdI Interface must only contain AMDP method definition (check the prerequisites of method interfaces for AMDP methods)

  4. Fallback class must be specified

  5. 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)

  1. Only AMDP implementations of the BAdI interface methods must be provided

  2. 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

  1. BAdI invocation has to be declared after the addition USING of the relevant AMDP method. USING BADI_NAME=>METHOD_NAME

  2. 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;

1 Comment