SAP filter BADI allows multiple implementations to be active

A BADI that has the filter-depend checkbo x option ticked simply means that you can activate multiple BADI implementations at the same time based on this filter value. Without the filter value, a classic BADI can only have one implementation active at any one time.

A filter option means that you can implement a filter type of say country and then create implementations based on different values for country i.e. if you are a multinational organisation.

One thing I would just like to add before going any further. If you are maintaining two BADI's with filters via transaction SE18 make sure you leave the transaction fully when switching between the different BADI's. If I only returned to the main selection screen of SE18 before selecting the second I have often seen filter values from one BADI appearing in the second BADI. Leave the transaction all together before maintaining the second BADI.

Implementing a filter BADI

Well Implementing a badi with the filter-depend check box selected is much the same as implementing a classic BADI so check out that article for full step by step details...

...but to summarise you basically execute Business Add-In(BADI) transaction SE18, choose the BAdI option, enter a filter-depend BADI name ( i.e. NOTIF_EVENT_SAVE ) and press display. Also if you want to know which badi is executed within a particular transaction see here for how to find where a BADI is executed


As you can see this BADI has the filter-depend option check box checked. Also note the filter type, which for NOTIF_EVENT_SAVE is Notification Type. If you wanted to create your own BADI you could choose the filter type you required. For example, check out BADI ADDRESS_CHECK which has a filter value of "Country ISO code"


Implementing a BADI with a filter is much the same as implementing one without a filter, see below for basic steps. Also, see implementing a classic BADI for more detailed steps.

1. As with a classic badi without a filter the first step is much the same, you select the menu option Implementation->Create


then give the implementation a name such as Z_NOTIF_EVENT_SAVE


2. On the next screen enter some implementation short text and press save


It's at this point you will see the first difference, as when you save you will see the error "Specify filter value"


Press Enter to remove the message, then simply select a filter value by first selecting the insert row option


Then by selecting a value for the row using the Search Help / F4 Value help. Note you can add more than one value here, but must not be the same values as assigned to another implementation. I will cover this in more detail in a second.


Once you have selected your values ( i.e. 11 and 50) you can press the save icon to save this implementation


If you have chosen values contained in another implemantation of this BADI you will see the message "There are already implementation active for these filter values"

The values I have chosen are not already used and just saved it as a local object for this example


3. From this point on it is much the same as implementing a classic BADI i.e. you can go to the Interface tab and select a method you want to enhance by double clicking on it.


Then you just need to enter your desired ABAP code into the method.


4. But don't forget about the filter value as this actually becomes one of the importing parameters of the method. To see this simply choose menu option Goto->Method Definition from within the method.


You will then see the list of method parameters. For this example, the filter value parameter is FLT_VAL which you can confirm by looking at the parameter type and comparing to the filter type.


If multiple values are used you can then incorporate this filter value into your ABAP code something like this, i.e. by checking the filter value and performing the appropriate ABAP processing.


5. Once your done Save and activate the method and then the BADI implementation

6. As this BADI has a filter enabled you can now create a second, third, four etc implementation. But they need to be based on different filter values.

7. To test this we can now create a second implementation of NOTIF_EVENT_SAVE. To do this return to the main BADI definition screen and repeat the implementation creation steps by selecting the menu option Implementation->Create


this time give the implementation a different name such as Z_NOTIF_EVENT_SAVE2

Enter some short text and then enter one of the same filter values as the first one i.e. 11. You will now see the message "There are already implementations active for these filter values".


This just demonstrates that although you can use the filter to activate multiple implementations of the same BADI you must assign each one a different filter value.

For example, now change the value to something else like 52 or a value not already used. This time when you press the activate button it should activate fine.



BADI related articles
  Find which BADI's are triggered within a SAP transaction
  Classic BADI enhancement
  Multiple Use BADI's
  Classic BADI with filter
  Migrated BADI to enhancement
  All SAP Enhancement


Related Articles

ABAP Enhancements - Modify SAP standard code using the SAP enhancement transaction CMOD
SAP BADI enhancement implementation (Business Add-In)
Changing SAP Data Element documentation (F1 help text)
Changing SAP Data Element field text
Find SAP BADI triggered from a SAP transaction, also find tcode from BADI name
Access values outside the SAP customer exit
SAP User Exits to Add functionality to the PBO and PAI of SAP HR infotypes
Adding fields to SAP standard Infotype
SAP User exist enhancements
SAP Field Exits implementation to update global dictionary field details
SAP migrated BADI using enhancement point implementation
Modifying Standard SAP System and help Menu options
Modifying Standard SAP System and help Menu options
SAP mutiple use BADI and enhancement spot implementation (Business Add-In)
SAP User exits to allow developers to enhance standard SAP functionality without modifiy SAP code