Thursday, August 13, 2009

Finding BADI in any SAP transaction

One of the options to consider when a need arise to change the standard out of the box SAP feature is to take advantage of Business Add ins , or in short, BADIs. BADIs are basically exit classes which are integrated in the SAP transaction program, and are called during execution, usually with run time variables which can be modified. By taking advantage of these BADIs, application developers can change these variables during run time, based on the business rules, and transfer the values back to the main SAP transaction application, there by modifying the way in which standard out of the box SAP transaction work.

The 2 transactions of notice when coming to BADIs are SE18 and SE19, where we implement the BADIs using our own classes. These classes use the same interface as that of the BADI class.

Having said that, many a times, the issue I have run into, especially in a new environment is how to find these exit points/BADIs that are available for a given transaction. One option is to spend a very long time debugging and keeping a close eye on each and every call that is made in the SAP program. However, this is not an option when it comes to web transactions because web applications time out.

The BADI class we implement is considered an Instance of the actual BADI class. For SAP to find out if a BADI has any active implementations, it first calls a static method called “getInstance()” of class : CL_EXITHANDLER. If we set a break point within this method, the execution will break for every single BADI that is implemented in the SAP transaction.

Hence, set a Break point in: CL_EXITHANDLER=>GET_INSTANCE()

While this is a sure shot way of finding BADIs in a transaction, the down part of this method is that there will be too many break point hits. The most effective method to find BADIs is to go to SDN and check out the user forums. However, if all else fails, the method I detailed below will get you the BADI you are looking for.