Académique Documents
Professionnel Documents
Culture Documents
Kernel BADI
The new Enhancement Framework and Kernel BADI
The BADI is an object-oriented enhancement option. The BADI defines 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 predefined 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 defining 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.
For creating BAdi first we need to create Enhancement Spot. New BAdi can only be
created inside SPOT.
Below figure shows how to create Enhancement SPOT (TCode-SE18)
Creating new Interface, just doule click on Interface link under the BAdi definition
section.
As soon as you will save Interface, it will open new screen to define methods inside
this Interface.
All these methods can then be called using BAdi.
Create two different methods namely Addition and Subtraction and provide the
parameter list for these methods created inside Interfaces.
Class name is required here because using this class only we will be able to use
ethods.
Double click on Implementing Class then following screen with two Interface
methods will get displayed.
Double click on any Interface method. Currently these methods are all blank and
need to Implement to have custom logic inside these methods.
ABAP statements GET BADI, CALL BADI are used to Access Badi Objects.
Filters:
Filters are mainly used as a condition to switch over different 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 different 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.
Now creating filters in BADI:
Click on Activate.
Now Double click on Enhancement Implementation to open it.
Need to place value for these filters which will be used by BAdi to decide at runtime
which method to call.
Every Implementation needs a class, if we provide same class name then this Implementation will inherit the methods
of first Implementation which will be useless.
Now we have two Enhancement Implementations, having different method implementations one for US and another
for IN.
In above screen shot highlighted section shows how to use filters in program.