Search This Blog

Thursday, June 05, 2008

Finding BADI's & Exits

There are multiple ways of searching for BADI.

  • Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
  • Finding BADI Using SQL Trace (TCODE-ST05).
  • Finding BADI Using Repository Information System (TCODE- SE84).
  1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.
    Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI's will be listed.
    The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
  2. 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 the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session.
    Push the button "Deactivate Trace".
    Push the button "Display Trace".
    The popup screen "Set Restrictions for Displaying Trace" appears.
    Now, filter the trace on Objects:
    V_EXT_IMP
    V_EXT_ACT

    Push button "Multiple selections" button behind field Objects
    Fill: V_EXT_IMP and V_EXT_ACT

    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_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA
  3. Go to “Maintain Transaction” (TCODE- SE93).
    Enter the Transaction VD02 for which you want to find BADI.
    Click on the Display push buttons.
    Get the Package Name. (Package VS in this case)
    Go to TCode: SE84->Enhancements->Business Add-inns->DefinitionEnter the Package Name and Execute.


    Here you get a list of all the Enhancement BADI's for the given package MB.

    Also have a look at below report which will list BADIs.

see SDN - https://www.sdn.sap.com/irj/sdn/thread?threadID=268271

4 comments:

Dfloth said...

1. Go to the TCode SE24 and enter CL_EXITHANDLER as object type.
2. Methods tab.
3. Double click 'Get Instance'
4. Set a breakpoint on 'CALL METHOD cl_exithandler=>get_class_name_by_interface\'.
5. Then run your transaction.
6. The screen will stop at this method.
7. Check the value of parameter \'EXIT_NAME\'. It will show you the BADI for that transaction.

Dfloth said...

SE84 -> enhancements

Dfloth said...

The steps to find the User Exit for any Tcode is as given below..

1. Find the package for the TCode..u can find it by executing the Tcode ..then go to System on Menu Bar and click on Status.. a pop up will open up double click on the TCode ..u will get the development class.

2. Now run the Transaction SMOD ..on the menu bar select Uitilies..then click on find and then type the package in the specified input field.

3. Execute (F8).

Dfloth said...

User exits :

1. Introduction
2. How to find user exits
3. Using Project management of SAP Enhancements

1. Introduction:

User exits (Function module exits) are exits developed by SAP. The exit is implementerd as a call to a functionmodule. The code for the function module is writeen by the developer. You are not writing the code directly in the function module, but in the include that is implemented in the function module.

The naming standard of function modules for functionmodule exits is:
EXIT_<3 digit suffix>

The call to a functionmodule exit is implemented as:
CALL CUSTOMER.-FUNCTION <3 digit suffix>

Example:

The program for transaction VA01 Create salesorder is SAPMV45A

If you search for CALL CUSTOMER-FUNCTION i program
SAPMV45A you will find ( Among other user exits):

CALL CUSTOMER-FUNCTION '003'
exporting
xvbak = vbak
xvbuk = vbuk
xkomk = tkomk
importing
lvf_subrc = lvf_subrc
tables
xvbfa = xvbfa
xvbap = xvbap
xvbup = xvbup.

The exit calls function module EXIT_SAPMV45A_003

2. How to find user exits?

Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT

If you know the Exit name, go to transaction CMOD.

Choose menu Utillities->SAP Enhancements. Enter the exit name and press enter.

You will now come to a screen that shows the function module exits for the exit.

3. Using Project management of SAP Enhancements, we want to create a project to enahance trasnaction VA01 .

- Go to transaction CMOD
- Create a project called ZVA01
- Choose the Enhancement assign radio button and press the Change button

In the first column enter V45A0002 Predefine sold-to party in sales document.

Note that an enhancement can only be used in 1 project. If the enhancement is already in use, and error message will be displayed

Press Save

Press Components. You can now see that enhancement uses user exit EXIT_SAPMV45A_002. Double click on the exit.

Now the function module is displayed. Double click on include ZXVVAU04 in the function module

Insert the following code into the include: E_KUNNR = '2155'.

Activate the include program. Go back to CMOD and activate the project.

Goto transaction VA01 and craete a salesorder.

Note that Sold-to-party now automatically is "2155"