How to extend SAP standard using ADT
If you, as an SAP customer or partner, need to adapt SAP standard software to your specific requirements, you make use of SAP Business Add-Ins (BAdIs). Though SAP general recommends using BAdIs as an enhancement technology whenever possible, because these are predefined extension points providing stable interfaces, some use cases still require the technology of enhancing the source code using modification-free enhancements.
Modifications to SAP standard should be used only if they are absolutely necessary to meet your business requirements, because they have a serious impact on the development and maintenance costs. Modifications are overwritten during upgrades by the respective SAP standard objects of the next release or support package and in order to keep them, you need to carry out adjustments of modifications during upgrade in the transactions SPAU/SPDD. Use Modification Assistant wherever possible, then your modifications will be tracked and recorded in the transaction SPAU and thereby the upgrade effort for your system will be reduced. Generally, modifications are the most expensive way to extend SAP standard and should be avoided wherever possible.
Since SAP advises to use for all ABAP related developments the ABAP Development Tools in Eclipse (ADT), which is the state-of-the-art SAP’s IDE for ABAP, containing modern ABAP development toolset, which covers in a highly efficient way all development, quality assurance and troubleshooting aspects, the question comes up: if using ADT, how to handle BAdI’s, enhancements and modifications?
Overview of extension options in ADT
|Extension option||Availability||SAP Help Documentation|
SAP BTP ABAP Environment 2008
ABAP Platform 2020
|Working with Business Add-Ins (BAdIs)|
|Enhancements (display)||SAP NetWeaver 7.4 SP5||Working with Source Code Plug-Ins|
|Enhancements (edit)||ABAP Platform 1809||Working with Source Code Plug-Ins|
|Enhancements (implement available enhancement options)||ABAP Platform 1909||Working with Source Code Plug-Ins|
|Modifications||ABAP Platform 1809||Modifying Development Objects in the SAP Namespace|
How to work with BAdIs in ADT
Starting with SAP BTP ABAP Environment 2008 and ADT 3.12 you can now create BAdI enhancement spots:
After providing the name (e.g.Z_CALCULATE_TAX) and description you can define BAdI definitions in the corresponding BAdI enhancement spot editor. Of course, you can also edit your existing BAdI enhancement spots in this editor:
To implement BAdI definitions you can now create BAdI enhancement implementations:
There you can add new (and change existing) BAdI implementations using the corresponding BAdI implementation editor:
The respective SAP Help documentation chapter Working with Business Add-Ins (BAdIs) provides more details.
As you can probably guess, this functionality is also available on-premise with ABAP Platform 2020.
How to work with enhancements in ADT
Already starting with SAP NetWeaver 7.4 SP5 (as well as SAP NetWeaver 7.31 SP11 or higher), you can display the source code enhancements in the source code editor of a class, program, function group, or type group.
The available enhancements are indicated by the source code plug-in marker:
If you hover the cursor over the marker, the source code enhancements are displayed in the popup like this:
If there are multiple enhancement implementations available, the popup will display the hierarchy of the enhancements from which you can choose the required implementation:
Since ABAP Platform 1809 (AS ABAP 7.53) you can edit source code enhancements in the enhancement implementation editor:
As of ABAP Platform 1909 (AS ABAP 7.54) you can create enhancement implementations to implement available enhancement options.
For the object to be enhanced, enhancement options are displayed as the following marker:
|– for enhancement options that already contain an implementation|
|– for enhancement options without implementations|
You can right-click the relevant marker to create an enhancement implementation or to add an enhancement implementation element to an existing implementation.
After providing the name and description, the enhancement implementation element will be added and opened in the corresponding enhancement implementation editor.
This was the excerpt from the SAP Help documentation. The following detailed chapter provides further information: Working with Source Code Plug-Ins.
How to work with modifications in ADT
Since ABAP Platform 1809 (AS ABAP 7.53) you can modify ABAP development objects (e.g. classes, programs, function modules etc.) in ADT.
You can only implement modifications only within the existing brackets created with Modification Assistant in SAP GUI beforehand, it is not possible to create new modifications in ADT. There are three types of brackets that are ready for input: REPLACE, DELETE, and INSERT.
In the following example the original IF i_speed > 200 condition is replaced with a new IF i_speed > 250 condition. Modifiable code has a white background and non-modifiable code is grayed out:
You can display modification annotations per menu: Window > Preferences > General Editors Text Editors > Annotations. Clicking an annotation navigates you to the modification in the source code.
If you try to modify a development object, which was not previously modified with Modification Assistant, the Limited modification support window will request you to choose the modification environment: SAP GUI or ADT. We recommend using SAP GUI to start the modification process with Modification Assistant.
More details in the SAP Help Documentation: Modifying Development Objects in the SAP Namespace.