With AS ABAP 7.4 SP08 various ABAP (for SAP HANA) features and improvements have been delivered (see here). This is also the case for ABAP Managed Database Procedures (AMDPs). You can read the ABAP News for 7.40, SP08 – ABAP Managed Database Procedures (AMDP) by Horst Keller.
In the present blog, I would like to emphasize the modification-free enhancement of AMDP using special Business Add-Ins, so-called AMDP BAdIs.
One the main advantages of the so-called Top-Down approach is that as a developer you remain in your familiar ABAP environment, despite the fact that you may be writing HANA-specific code. This is exactly the case with AMDPs which allow embedding SQLScript code into special class methods (so-called AMDP methods). Another important advantage is that proven and well-known ABAP capabilities and concepts can then be applied on such objects, e.g. the standard ABAP transport mechanism and the version management.
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.
Below is a short video tutorial showing how to achieve it and additional information on that topic.
General information about BAdIs:
A BAdI is an object-oriented enhancement option, which makes it the most sophisticated enhancement type. The main characteristic of a BAdI is that it provides a mechanism to change the functionality of a well-defined business function without making changes to the delivered source code. Future upgrades of the original business function can be applied without losing the customer-specific enhancements or the need to merge the changes. The two code lines (the original one and the customer-specific coding) are strictly separated but still integrated.
Special information and restrictions to be taken into consideration when working with AMDP BAdIs:
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.
- The call is syntactically similar to a procedure call
* set input and output parameters here
Hope this information helps you. For more information check the online ABAP Keyword documentation in the SAP Help Portal. Various information (guides, tutorial, videos) around the ABAP development for SAP HANA can be found here.