As businesses move towards SAP HANA, leveraging its in-memory computing capabilities becomes essential for developing efficient and high-performing applications. One of the critical tools in this journey is the ABAP Managed Database Procedures (AMDP). When combined with Business Add-Ins , AMDP provides a powerful way to customize and enhance SAP applications, especially when performance is a concern. In this blog, we'll dive into what AMDP is, how it can be used within Business Add-Ins, and the benefits it brings to the table.
What is a Business Add-Ins?
Business Add-Ins (Business Add-Ins) are SAP's standard mechanism for extending the functionality of SAP applications without modifying the original code. Business Add-Ins provide predefined hooks or enhancement spots where custom code can be inserted. This makes Business Add-Ins a powerful tool for customizations in SAP.
Combining AMDP with Business Add-Ins: Why and When?
When implementing Business Add-Ins, the custom logic traditionally runs on the ABAP application server, which might not fully exploit the capabilities of SAP HANA. However, by integrating AMDPs within a Business Add-Ins, you can move resource-intensive operations to the database level. This is particularly useful for scenarios where the custom logic involves complex data retrieval, aggregation, or transformation, as these operations are executed much faster on the HANA database.
Benefits of Using AMDP in Business Add-Ins
Best Practices
There are some rules if a Business Add-Ins is marked as AMDP
Now we will see the practical things how to use BADI in AMDP
1.Create a enhancement spot in se18 T-code
2.Create BADI Definition for the Enhance spot.
3.Once you created Business Add-Ins definition click on the AMDP Business Add-Ins checkbox
4.Create Interface for that BADI
5.Once you created interface go to source code-Based
6.There provide ID_AMDP_MARKER_HDB interfaces and declare the method and activate it.
7.We have to create the Fallback class if you didn’t create the fallback class it will gives the error
8.Copy the fallback class name now go to eclipse by providing alt+f8 we can find the fallback class in eclipse
9.Provide the implementation to the fallback class
10.Now we can activate the Business Add-Ins
11.To call the Business Add-Ins we have to create one more ABAP class in eclipse.
12.Now create a report program
Refer the code Below
class ZSH_AMDP_FALLBACK_FLIGHTS1 definition
public
final
create public .
public section.
interfaces IF_AMDP_MARKER_HDB .
interfaces IF_BADI_INTERFACE .
interfaces ZSH_IF_FLIGHT_DETAILS1 .
protected section.
private section.
ENDCLASS.
CLASS ZSH_AMDP_FALLBACK_FLIGHTS1 IMPLEMENTATION.
METHOD ZSH_IF_FLIGHT_DETAILS1~fetch_data by DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY USING sflight.
et_flight = SELECT * FROM sflight WHERE carrid = iv_carrid;
ENDMETHOD.
ENDCLASS.
CLASS zsh_cl_amdp_badi1 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES : if_amdp_marker_hdb.
METHODS : execute IMPORTING VALUE(iv_carrid) TYPE sflight-carrid
EXPORTING VALUE(et_flight) TYPE flighttab.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zsh_cl_amdp_badi1 IMPLEMENTATION.
METHOD execute BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY USING ZSH_BADI_DEF_FLIGHT1=>FETCH_DATA.
CALL "ZSH_BADI_DEF_FLIGHT1=>FETCH_DATA"(iv_carrid => :iv_carrid , et_flight => :et_flight);
ENDMETHOD.
ENDCLASS.
REPORT ZSH_RP_AMDP_BADI1.
DATA(lo_obj) = new zsh_cl_amdp_badi1( ).
lo_obj->execute(
EXPORTING
iv_carrid = 'AA'
IMPORTING
et_flight = DATA(lt_flight)
).
cl_demo_output=>display( lt_flight ).
Why AMDP Business Add-Ins?
Purpose Of AMDP Business Add-Ins
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 |