Skip to Content

Introduction

There are multiple ways of searching for BAdIs. My favorite one is using the Performance Trace (formerly known as SQL trace) transaction code ST05.

This analyzing technique is based on the fact that all BAdIs are registrated in SAP database tables. So for each BAdI call these database tables will be accessed. The BAdI database tables are SXS_INTER, SXC_EXIT, SXC_CLASS and SXC_ATTR. These tables are always accessed by the views V_EXT_IMP and V_EXT_ACT. So these two ABAP views (T: SE11) will be the basis for the trace.

This blog will not describe how to implement BAdIs. See http://help.sap.com/ for more information on implementing a BAdI.

The procedure to discover BAdIs by a Performance Trace will be explained by using the example used below.

Example case

I want to know which BAdIs are called in the transaction “Maintain Business Partners” transaction code BP.

Pre checks

  • Check if no other users (T:SM04) or batch jobs (T: SM50) are using the same user as you do.

Trace Actions

Start the Performance trace

  • Start transaction ST05 (Performance Analysis)
  • Set flag field “Buffer trace”

Remark: We need to trace also the buffer calls, because BAdI database tables are buffered. (especially view V_EXT_IMP and V_EXT_ACT)

  • Push button “Activate Trace”

Execute the Business transaction

  • Start transaction BP in a new GUI session
  • Push button “Organization”
  • Fill in your test data
Name NL4B
Street Olympia
House number 1a/1b
Postal code 1213 NS
City Hilversum
Country NL
  • Push button Save

Performance trace

  • Go back to the Performance trace session
  • Push button “Deactivate Trace”

Analyzing the Trace List

Showing the Trace List

  • Push button “Display Trace”

The popup screen “Set Restrictions for Displaying Trace” appears

Now we are going to filter the trace on Objects: V_EXT_IMP and V_EXT_ACT.

  • Push button “Multiple selections” button behind field Objects
  • Fill: V_EXT_IMP and V_EXT_ACT

image

  • Push button “Copy (F8)”
  • Fill Operations: OPEN
  • Push button Enter
    See the result:

image

Interpreting the Trace list

All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BAdI class interfaces. The BAdI name is after the IF_EX_.

So the BAdI name of IF_EX_ADDR_LANGU_TO_VERS is ADDR_LANGU_TO_VERS.

In transaction SE18 you can see the BAdI definition.

image

(If you can’t find the BAdI definition name, search in table SXS_INTER.)

Exporting the Trace list

If you’d like to keep your analysis, you can export it to Excel file format.

Actually the file will be saved in tab separated file format, but giving the file the extension .xls it will automatically be opened by Excel.

  • Start menu: List > Save > Local File
  • Select Spreadsheet
  • Push Enter
  • Fill your preferred file location and file name

image

  • Push button “Generate”
  • Open the file (in Excel)

image

  • Delete the columns and rows you don’t need and the result looks like:

image

View V_EXT_IMP and V_EXT_ACT

The reason for filtering the result not only on the view V_EXT_IMP but also on V_EXT_ACT is necessary, because not all BAdIs are implemented in the same way.

For example:

V_EXT_IMP catches BAdI BPTIME_BP001.

V_EXT_ACT catches BAdI ADDRESS_SEARCH

Tips

  • Make a full test entry in the Business transaction before starting the Performance analysis.
    So during the Performance trace you won’t make mistakes. Making mistakes during the recording will cause extra trace lines in your trace list.
  • Try to start with an empty Business transaction screen.
    This tip is best explained by an example.
    When I restart transaction BP after I have created, displayed or changed a business partner, the last opened business partner will be displayed automatically. This means also I will get extra trace lines in my trace list.
    To start again with an empty business partner screen you have to close all GUI sessions and login again.
  • In the Business transaction you need to fill all required fields so all BAdIs will be called.

Appendix BP analysis

View Call BAdI
V_EXT_ACT R 20 ADDR_LANGU_TO_VERS ADDR_LANGU_TO_VERS
V_EXT_IMP R 30 IF_EX_ADDR_LANGU_TO_VERS ADDR_LANGU_TO_VERS
V_EXT_ACT R 20 BUPR_FILTER_RELTYP BUPR_FILTER_RELTYP
V_EXT_IMP R 30 IF_EX_BUPR_FILTER_RELTYP BUPR_FILTER_RELTYP
V_EXT_ACT R 20 BUPR_FILTER_RELTYP BUPR_FILTER_RELTYP
V_EXT_IMP R 30 IF_EX_BUPR_FILTER_RELTYP BUPR_FILTER_RELTYP
V_EXT_ACT R 20 BUPR_FILTER_RELSHP BUPR_FILTER_RELSHP
V_EXT_ACT R 20 BUPA_AUGRP BUPA_AUGRP
V_EXT_IMP R 30 IF_EX_BUPA_AUGRP BUPA_AUGRP
V_EXT_IMP R 30 IF_EX_BPTIME_BP001 BPTIME_BP001
V_EXT_ACT R 20 ADDRESS_SUBSCREEN ADDRESS_SUBSCREEN
V_EXT_ACT R 20 ADDRESS_SEARCH ADDRESS_SEARCH
V_EXT_IMP R 30 IF_EX_ADDRESS_SUBSCREEN ADDRESS_SUBSCREEN
V_EXT_IMP R 30 IF_EX_ADDRESS_SUBSCREEN ADDRESS_SUBSCREEN
V_EXT_IMP R 30 IF_EX_ADDRESS_SUBSCREEN ADDRESS_SUBSCREEN
V_EXT_IMP R 30 IF_EX_ADDRESS_SUBSCREEN ADDRESS_SUBSCREEN
V_EXT_ACT R 20 ADDRESS_SEARCH ADDRESS_SEARCH
V_EXT_ACT R 20 ADDRESS_CHECK ADDRESS_CHECK
V_EXT_ACT R 20 ADDRESS_CHECK ADDRESS_CHECK
V_EXT_ACT R 20 ADDR_TXJCD_CHECK ADDR_TXJCD_CHECK
V_EXT_ACT R 20 ADDRESS_CHECK ADDRESS_CHECK
V_EXT_ACT R 20 ADDR_PRINTFORM_SHORT ADDR_PRINTFORM_SHORT
V_EXT_IMP R 30 IF_EX_ADDR_PRINTFORM_SHORT ADDR_PRINTFORM_SHORT
V_EXT_ACT R 20 BUPA_ROLE_EXPORT BUPA_ROLE_EXPORT
V_EXT_IMP R 30 IF_EX_BUPA_ROLE_EXPORT BUPA_ROLE_EXPORT
V_EXT_ACT R 20 BUPA_BANK_EXPORT BUPA_BANK_EXPORT
V_EXT_IMP R 30 IF_EX_BUPA_BANK_EXPORT BUPA_BANK_EXPORT
V_EXT_ACT R 20 BUPA_CCARD_EXPORT BUPA_CCARD_EXPORT
V_EXT_IMP R 30 IF_EX_BUPA_CCARD_EXPORT BUPA_CCARD_EXPORT
V_EXT_ACT R 20 BUPA_INDSEC_EXPORT BUPA_INDSEC_EXPORT
V_EXT_IMP R 30 IF_EX_BUPA_INDSEC_EXPORT BUPA_INDSEC_EXPORT
V_EXT_ACT R 20 BUPA_ADDR_EXPORT BUPA_ADDR_EXPORT
V_EXT_IMP R 30 IF_EX_BUPA_ADDR_EXPORT BUPA_ADDR_EXPORT
V_EXT_ACT R 20 BUPA_GENERAL_EXPORT BUPA_GENERAL_EXPORT
V_EXT_IMP R 30 IF_EX_BUPA_GENERAL_EXPORT BUPA_GENERAL_EXPORT
V_EXT_ACT R 20 BUPA_GENERAL_UPDATE BUPA_GENERAL_UPDATE
V_EXT_IMP R 110 IF_EX_BUPA_GENERAL_UPDATE BUPA_GENERAL_UPDATE
V_EXT_ACT R 20 BUPA_BANK_UPDATE BUPA_BANK_UPDATE
V_EXT_IMP R 110 IF_EX_BUPA_BANK_UPDATE BUPA_BANK_UPDATE
V_EXT_ACT R 20 BUPA_CARDS_UPDATE BUPA_CARDS_UPDATE
V_EXT_IMP R 30 IF_EX_BUPA_CARDS_UPDATE BUPA_CARDS_UPDATE
V_EXT_ACT R 20 BUPA_ROLES_UPDATE BUPA_ROLES_UPDATE
V_EXT_IMP R 30 IF_EX_BUPA_ROLES_UPDATE BUPA_ROLES_UPDATE
V_EXT_ACT R 20 BUPA_INDSEC_UPDATE BUPA_INDSEC_UPDATE
V_EXT_IMP R 30 IF_EX_BUPA_INDSEC_UPDATE BUPA_INDSEC_UPDATE
V_EXT_ACT R 20 BUPA_IDENT_UPDATE BUPA_IDENT_UPDATE
V_EXT_IMP R 30 IF_EX_BUPA_IDENT_UPDATE BUPA_IDENT_UPDATE
V_EXT_ACT R 20 ADDRESS_UPDATE ADDRESS_UPDATE
V_EXT_IMP R 30 IF_EX_ADDRESS_UPDATE ADDRESS_UPDATE
V_EXT_IMP R 30 IF_EX_ADDRESS_UPDATE ADDRESS_UPDATE
V_EXT_ACT R 20 BUPA_ADDR_UPDATE BUPA_ADDR_UPDATE
V_EXT_IMP R 110 IF_EX_BUPA_ADDR_UPDATE BUPA_ADDR_UPDATE
V_EXT_ACT R 20 BUPA_TAX_UPDATE BUPA_TAX_UPDATE
V_EXT_IMP R 110 IF_EX_BUPA_TAX_UPDATE BUPA_TAX_UPDATE
V_EXT_ACT R 20 FSBP_BPID_UPDATE FSBP_BPID_UPDATE
V_EXT_IMP R 30 IF_EX_FSBP_BPID_UPDATE FSBP_BPID_UPDATE
V_EXT_IMP R 30 IF_EX_BPTIME_BP001 BPTIME_BP001
V_EXT_ACT R 20 FSBP_BP001_UPDATE FSBP_BP001_UPDATE
V_EXT_IMP R 30 IF_EX_FSBP_BP001_UPDATE FSBP_BP001_UPDATE
V_EXT_IMP R 30 IF_EX_BPTIME_BUT021_FS BPTIME_BUT021_FS
V_EXT_ACT R 20 FSBP_BUT021_UPDATE FSBP_BUT021_UPDATE
V_EXT_IMP R 30 IF_EX_FSBP_BUT021_UPDATE FSBP_BUT021_UPDATE
V_EXT_ACT R 20 ADDRESS_SEARCH ADDRESS_SEARCH
V_EXT_ACT R 20 PARTNER_UPDATE PARTNER_UPDATE
V_EXT_IMP R 30 IF_EX_PARTNER_UPDATE PARTNER_UPDATE
V_EXT_IMP R 30 IF_EX_PARTNER_UPDATE PARTNER_UPDATE
V_EXT_IMP R 30 IF_EX_BPTIME_BP001 BPTIME_BP001
V_EXT_IMP R 30 IF_EX_BPTIME_BUT021_FS BPTIME_BUT021_FS
V_EXT_ACT R 20 GOS_SRV_SELECT GOS_SRV_SELECT
V_EXT_IMP R 30 IF_EX_GOS_SRV_SELECT GOS_SRV_SELECT
V_EXT_ACT R 20 ADDRESS_SEARCH ADDRESS_SEARCH

Keywords: BAdI BAdIs BAdI’s Businesses Add In Business Add-In Business Add-Ins how to find BAdI’s

To report this post you need to login first.

46 Comments

You must be Logged on to comment or reply to a post.

  1. Anonymous
    Hey,

    thanks for that one! This will save a lot of time in future!

    Regards
    Wolfgang

    (0) 
  2. Bharat Reddy Vaka
    This method is good…
    but placing a break point on the line of code
    “CALL METHOD cl_exithandler=>get_class_name_by_interface”
    in the method “GET_INSTANCE” of the class “CL_EXITHANDLER” is a bit easy and even we can know where a particular BAdI is triggering…
    (0) 
    1. Alwin van de Put Post author
      My next weblog will about searching and analyzing BAdIs based on debugging.

      A break-point in CALL METHOD cl_exithandler=>get_class_name_by_interface is indeed a good method, but not all BAdI calls made by SAP do call this method.

      As you can see in the example below the CL_EXITHANDLER class won’t be called before the Definition class will be called.

      Still the break-point in cl_exithandler=>get_class_name_by_interface is a very good method as you will also read in my next weblog.

      Example:
      BAdI BPTIME_BP001 in transaction BP is called in this way in the code:
      Function group: FSBP_04
      Include: LFSBP_04F01
      Routine: FORM badi_get_vers_but021_fs

      FORM badi_get_vers_but021_fs TABLES p_but021_fs
                                CHANGING p_filled_by_badi.

        DATA: badi_but021_fs TYPE REF TO cl_ex_bptime_but021_fs,
              lt_but021_fs_new TYPE but021_fs_t.

        CREATE OBJECT badi_but021_fs.
      CALL METHOD badi_but021_fs->if_ex_bptime_but021_fs~bptime_but021_fs_get
          IMPORTING
            e_executed  = p_filled_by_badi
          CHANGING
            e_but021_fs = lt_but021_fs_new.

        p_but021_fs[] = lt_but021_fs_new[].

      ENDFORM.

      (0) 
        1. Peter Inotai
          Hi Hannes,

          Where can we find info about the nw 7.1 debugger script? Or is it still strictly confidential/under development?

          The only info I saw was a screen shot in Thomas Jung’s presentation about the debugger.

          Thanks,
          Peter

          (0) 
  3. Sascha Buhmann
    During the migration process problems have been reported for this blog. The blog content may look corrupt due to not supported HTML code on this platform. Please adjust the blog content manually before moving it to an official community.
    (0) 
  4. Patrick Pant
    Hi Alwin, this is a very cool approach to quickly find Badis. However I just ran into a snag when looking for a badi for MIGO. A BADI MB_DOCUMENT_BADI was shown that turned out not to be used…
    Fortunately there was another one that I then could use.
    So you still need to do the test before betting on one you find.
    thnx
    (0) 
  5. varun sonu
    Hi Alwin,

    I might be very late in responding , but this blog has been of great use for me to gain good concept in BADI and also good confidenec to win over my current situation .

    Thanks a lot for sharing such information .

    Thanks ,
    Varun .

    (0) 
  6. Ankur Jain
    I guess earlier we used to debug or put beakpoint in CL_EXITHANDLER or search in SPRO for it.

    This method is more innovative!

    Cheers 🙂
    Ankur

    (0) 
  7. chandra ch
    It is really a very gud approach. it gives more insight about SQL trace too.I also aprpeciate the way you have explained

    Thanks a lot

    (0) 
  8. MANMEET SINGH
    I was knowing this method but, Precaution which you had mentioned to be taken care for extra trace lines is somthing that may really matter.

    Regards

    (0) 
  9. sridhar naidu
    I have been searching the badi’s in 3 other ways which i would face more difficulties. your tips and suggestions and this way of finding the badi is marvelous and appreciable.

    thanks alot………………….. sridhar

    (0) 

Leave a Reply