Enhancement Framework – 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)





New Enhancement SPOT is created.

Now we are creating new BAdi inside this created Enhancement SPOT

Click on Create BADI button.


Provide BAdi name and short description.


BAdi requires one Interface which will contains all methods.

Creating new Interface, just doule click on Interface link under the BAdi definition section.


Provide the Interface name to be created.





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.


The parameters inside these Interface methods can only be Importing and Changing. Exporting parameters are not allowed in Interface methods.


Two created methods are displayed inside Interfaces.


Two steps are already completed

  1. Created new BAdi
  2. Created Interface and added two methods as required.


Now need to create Enhancement Implementation so that methods created inside Interfaces can be called.


Enhancement Implementation required Class name.


Class name is required here because using this class only we will be able to use ethods.


A new BADI implementation will be created with name “Z_BADI_IMPL”.


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.




Now to use this we have created new Report Program


ABAP statements GET BADI, CALL BADI are used to Access Badi Objects.


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.


Double Click on Filter and then click on EDIT button.

After this to add different Filter condition click on Combination button.

Now time to add filter condition in created Filters.


When click on Combination button following screen will be displayed.

Here double click on “????” to add new filter conditions.


Need to place value for these filters 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 filter will be US.


Two filters are created.


Activate the BADI.

Now to play with Filters we need to create another Implementation which will get called based on Country selected by User.

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 first Implementation which will be useless.


Now we have two Enhancement Implementations, having different method implementations one for US and another for IN.


Double click on Enhancement


Now create new filter for this Implementation


For US we have added 100 more to both parameters.


Now filters are all ready to be used in Report program.


In above screen shot highlighted section shows how to use filters in program.

Source Code:

REPORT z_badi_calc_ab.

PARAMETERS : pctry TYPE land1,

paramet1 TYPE i,

paramet2 TYPE i.

DATA : resultadd TYPE i,

resultsub TYPE i,

objbadi TYPE REF TO z_badi_calc_ab. "Creating object to call BADI's implemented methods

GET BADI objbadi


z_country_filter = pctry. "
Passing Filter values.

CALL BADI objbadi->;;addition


param1 = paramet1

param2 = paramet2


RESULT = resultadd.

WRITE: / 'Add Result: ', resultadd.

CALL BADI objbadi->;;substraction


param1 = paramet1

param2 = paramet2


RESULT = resultsub.

WRITE: / 'Substraction Result: ', resultsub.


This is how we can implement BAdis.


7 responses to “Enhancement Framework – BADI

  1. vishal agrawal February 13, 2014 at 11:49 pm

    i can’t see pics…

  2. Article source February 24, 2014 at 9:56 pm

    What i don’t realize is actually how you are now not actually a
    lot more neatly-favored than you may be right now. You are very intelligent.
    You already know therefore significantly with regards to this matter, made me in my view imagine
    it from numerous numerous angles. Its like
    men and women aren’t interested until it’s one thing to do with Girl gaga!
    Your personal stuffs nice. At all times maintain it up!

  3. lampy hybrydowe March 5, 2014 at 1:28 pm

    Greetings! Very useful advice in this particular post! It is the little changes that make the greatest changes.
    Many thanks for sharing!

  4. Pierwsze miejsce March 11, 2014 at 5:19 pm

    I am really impressed with your writing skills and also with
    the layout on your blog. Is that this a paid subject matter or did you modify it yourself?
    Either way stay up the excellent quality writing, it is rare to look a nice blog like this one nowadays..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: