Skip to Content
Author's profile photo Shafiq Rehman

Finding and Implementing BADIs

This blog will touch very basics of BAdis and remove a few doubts, may be. If you are reading this document then I believe you already know that BAdi stands for Business Ad-ins and they are used for enhancement purpose. You might also know that their use is ‘almost’ same as User Exits.
First off a couple of major differences between BAdis and User Exits:
1.     Object Oriented.
BAdis are implemented through ABAP Objects, classes, interfaces and all that Object Oriented stuff. User exits are plain simple normal traditional include programs.
2.     Single Use Vs. Multiple Use
User Exits are called as single use in the sense that there is only one implementation of a certain user exit. Of course many users can use that User Exit, but activating or deactivating the user exit will affect all the code (which may be written by different programmers in same include program)
BAdis can be multiple use (implementations). Each Implementation having different logic, you can easily activate or deactivate your own Z implementation without affecting other implementations.
Now, how to Implement BAdi:
There are two tcodes involved, SE18 and SE19. 
Please note that we can do all activities in SE18, we do not need to go to SE19 if we are only implementing a new BAdi or changing some old implemented Z BAdi.
In SE18, we have all the BAdis and we can also define new BAdis. 
–     This screen will show you two options, Enhancement Spots and BAdi name.
–     Input the BAdi definition name in the box next to BAdi name, how to find this name is a different science altogether … we’ll discuss that later in the discussion.
–     Click on display. Do not click on create or change button on this screen, we will do it later.
–     Here you can see the structure of BAdi, click on interface tab and make sure that this is the BAdi that you want to implement.
–     Now, Important step, click on menu item “Implementation”, you will see options for create, change, display etc. choose the one that you need, lets go with create.
–     Enter the BAdi name starting with Z.
–     Give short text description.
–     Double click the method that you want to use, and place your code there.
–     Save the implementation, activate it.
–     Go back and activate again on that screen, this is the BAdi definition that you are activating. And you are done, you can put all of your code here, you will not see anybody else’s code here as it happens in User Exits.
–     Important observation is that there are two steps of activation, at definition level, which will activate or deactivate all implementations and one is at implementation level which will only activate/deactivate your BAdi definition only.
Find a BAdi.
For a programmer, simplest way to find a BADI is through using Function Module and Debugger: 
–     Go to SE37 and display Function Module SXV_GET_CLIF_BY_NAME.
–     Put a break point on any line. 
–     Then open a new session and go to the tcode you are digging for BAdis and execute that.
–     You will notice a lot of stops on that function module, each stop is for a BAdi call. 
–     The parameter “name” of FM ‘SXV_ADD_PREFIX’ holds the BAdi name.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.