Enhancement Framework and Kernel BADI - SAP Blogs
Enhancement Framework and Kernel BADI - SAP Blogs
Products
Products Industries
Industries Services and Support
Services Support Training
Training Community
Community Developer
Developer
Partner
Partner About
About
Ask a Question Write a Blog Post Login
Abhishek Sharma
November 18, 2014 5 minute read
The BADI is an object-oriented enhancement option. The BADI de nes an interface that can be
implemented by BADI-implementations that are transport objects of their own. The new BADI is fully
integrated into the Enhancement Framework.
BAdis are like prede ned Enhancement options available in SAP which can then be Implemented by the
Industries as per there needs.
BAdis: Business Add Ins are Enhancements to the standard SAP code. These BAdi Enhancement can be
done with the Interfaces which contains various methods (standard or customized). This Interface name is
generated automatically and can be changed as required.
After de ning the Interfaces developer assign some methods as required to these interfaces. These
methods can have only Importing and Changing parameters Exporting Parameters are not allowed. Finally
BAdi is Activated and ready to be used in program.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 1/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
For creating BAdi rst we need to create Enhancement Spot. New BAdi can only be created inside SPOT.
Now we are creating new BAdi inside this created Enhancement SPOT
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 2/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Creating new Interface, just doule click on Interface link under the BAdi de nition section.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 3/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 4/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
As soon as you will save Interface, it will open new screen to de ne methods inside this Interface.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 5/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Create two di erent methods namely Addition and Subtraction and provide the parameter list for these
methods created inside Interfaces.
The parameters inside these Interface methods can only be Importing and Changing. Exporting
parameters are not allowed in Interface methods.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 6/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Now need to create Enhancement Implementation so that methods created inside Interfaces can be called.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 7/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Class name is required here because using this class only we will be able to use ethods.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 8/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Double click on Implementing Class then following screen with two Interface methods will get displayed.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 9/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Double click on any Interface method. Currently these methods are all blank and need to Implement to have
custom logic inside these methods.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 10/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 11/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
ABAP statements GET BADI, CALL BADI are used to Access Badi Objects.
Filters:
Filters are mainly used as a condition to switch over di erent implementations methods. For example there is one
BAdi having Implementation for converting any amount to UD. Now there is one more new requirement to have
currency conversion to IN.
In this case we need to have di erent Implementation in BAdi which will be switched based on the input provided
by the user. This calling of Implementation is all dynamic and can only be determined by BAdi at runtime.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 12/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 13/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Click on Activate.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 14/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 15/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Need to place value for these lters which will be used by BAdi to decide at runtime which method to call.
In our example we are making calculation based on Country so I have taken IN (India) and another lter will
be US.
Now to play with Filters we need to create another Implementation which will get called based on Country
selected by User.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 16/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
Need to create another Implementation which will calculate the result based on US country.
Every Implementation needs a class, if we provide same class name then this Implementation will inherit the
methods of rst Implementation which will be useless.
Now we have two Enhancement Implementations, having di erent method implementations one for US and
another for IN.
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 17/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 18/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 19/22
6/6/2019 Enhancement Framework and Kernel BADI | SAP Blogs
In above screen shot highlighted section shows how to use lters in program.
Alert Moderator
Assigned tags
https://blogs.sap.com/2014/11/18/enhancement-framework-and-kernel-badi/ 20/22