Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

finding exact badi

Former Member
0 Likes
763

hi,

how to find the exact badi with out using break points.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
727

Hi,

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).

•Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE

Go to the Transaction, for which we want to find the BADI,

Get the Program Name of Corresponding Transaction.

(Click on System->Status. Double Click on 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.

•Finding BADI Using SQL Trace (TCODE-ST05).

/people/alwin.vandeput2/blog/2006/04/13/how-to-search-for-badis-trace-it

•Finding BADI Using Repository Information System (TCODE- SE84).

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->Definition

Enter the Package Name and Execute.

Regards,

Ranjit Thakur.

<b>Please Mark The Helpful Answer.</b>

5 REPLIES 5
Read only

Former Member
0 Likes
727

Hi Prasoon ,

One mrthod of doing it is to find the package of the transaction and put this in SE80 , tou will get a node called enhancements where you will find the BADI for the enhancement.

Regards

Arun

Read only

0 Likes
727

In se80 , giving package also we will get 'n' no of one badis, in that how to find the exact badi.

Read only

Former Member
0 Likes
727

Hi Prasoon,

Go through this seven steps u will find the exact badi.

Hi,

may be you are trying to chage the some other BADI. to find the exact BADI, follow this procedure.

1) Goto se24 (Display class cl_exithandler)

2) Double click on the method GET_INSTANCE.

3) Put a break point at Line no.25 (CASE sy-subrc).

Now

4) Execute SAP standard transaction

5) Press the required button for which you need to write an exit logic, the execution will stop at the break point.

6) Check the values of variable 'exit_name', it will give you the BADI name called at that time.

7) This way you will find all the BADIs called on click of any button in any transaction

if you follow this 7 steps, you will find a suitable BADI.

Rewards some points.

Rgds,

P.Naganjana Reddy

Read only

Former Member
0 Likes
728

Hi,

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).

•Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE

Go to the Transaction, for which we want to find the BADI,

Get the Program Name of Corresponding Transaction.

(Click on System->Status. Double Click on 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.

•Finding BADI Using SQL Trace (TCODE-ST05).

/people/alwin.vandeput2/blog/2006/04/13/how-to-search-for-badis-trace-it

•Finding BADI Using Repository Information System (TCODE- SE84).

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->Definition

Enter the Package Name and Execute.

Regards,

Ranjit Thakur.

<b>Please Mark The Helpful Answer.</b>

Read only

Former Member
0 Likes
727

Hi Prasoon,

You can use this sample code to find the suitable BADI as well as user Exit.

Use the following prog. it will fetch the Exits as well as BADI's for that T Code.

&----


*& Report Z_USEREXIT_DISPLAY

&----


REPORT Z_USEREXIT_DISPLAY

NO STANDARD PAGE HEADING

LINE-SIZE 200 MESSAGE-ID ZZ.

&----


  • T A B L E D E C L A R A T I O N S *

&----


TABLES: TFTIT,

E071,

E070.

&----


  • S T R U C T U R E D E C L A R A T I O N S *

&----


TYPES: BEGIN OF X_TSTC,

TCODE TYPE TCODE,

PGMNA TYPE PROGRAM_ID,

END OF X_TSTC.

TYPES: BEGIN OF X_TADIR,

OBJ_NAME TYPE SOBJ_NAME,

DEVCLASS TYPE DEVCLASS,

END OF X_TADIR.

TYPES: BEGIN OF X_SLOG,

OBJ_NAME TYPE SOBJ_NAME,

END OF X_SLOG.

TYPES: BEGIN OF X_FINAL,

NAME TYPE SMODNAME,

MEMBER TYPE MODMEMBER,

INCLUDE(15), "Include name

END OF X_FINAL.

&----


  • I N T E R N A L T A B L E D E C L A R A T I O N S *

&----


DATA: IT_TSTC TYPE STANDARD TABLE OF X_TSTC WITH HEADER LINE.

DATA: IT_TADIR TYPE STANDARD TABLE OF X_TADIR WITH HEADER LINE.

DATA: IT_JTAB TYPE STANDARD TABLE OF X_SLOG WITH HEADER LINE.

DATA: IT_FINAL TYPE STANDARD TABLE OF X_FINAL WITH HEADER LINE.

&----


  • V A R I A B L E S D E C L A R A T I O N S *

&----


  • U S E R I N P U T S S C R E E N *

&----


&----


  • S E L E C T I O N S C R E E N *

&----


SELECTION-SCREEN: BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-T01.

PARAMETERS: P_TCODE LIKE TSTC-TCODE OBLIGATORY.

SELECTION-SCREEN END OF BLOCK BLK01.

&----


  • S t a r t o f S e l e c t i o n *

&----


START-OF-SELECTION.

PERFORM GET_TCODES. "Get Tcodes

PERFORM GET_OBJECTS. "Get Objects

&----


  • E n d o f S e l e c t i o n *

&----


END-OF-SELECTION.

PERFORM DISPLAY_RESULTS. "Display Results

&----


*& Form get_tcodes

&----


  • Get Tcodes

----


FORM GET_TCODES.

SELECT TCODE

PGMNA

INTO TABLE IT_TSTC

FROM TSTC

WHERE TCODE = P_TCODE.

IF SY-SUBRC = 0.

SORT IT_TSTC BY TCODE.

ENDIF.

ENDFORM. " get_tcodes

&----


*& Form get_objects

&----


  • Get Objects

----


FORM GET_OBJECTS.

DATA: L_FNAME LIKE RS38L-NAME,

L_GROUP LIKE RS38L-AREA,

L_INCLUDE LIKE RS38L-INCLUDE,

L_NAMESPACE LIKE RS38L-NAMESPACE,

L_STR_AREA LIKE RS38L-STR_AREA.

DATA: V_INCLUDE LIKE RODIOBJ-IOBJNM.

DATA: E_T_INCLUDE TYPE STANDARD TABLE OF ABAPSOURCE WITH HEADER

LINE.

DATA: L_LINE TYPE STRING,

L_TABIX LIKE SY-TABIX.

IF NOT IT_TSTC[] IS INITIAL.

SELECT OBJ_NAME

DEVCLASS

INTO TABLE IT_TADIR

FROM TADIR FOR ALL ENTRIES IN IT_TSTC

WHERE PGMID = 'R3TR' AND

OBJECT = 'PROG' AND

OBJ_NAME = IT_TSTC-PGMNA.

IF SY-SUBRC = 0.

SORT IT_TADIR BY OBJ_NAME DEVCLASS.

SELECT OBJ_NAME

INTO TABLE IT_JTAB

FROM TADIR FOR ALL ENTRIES IN IT_TADIR

WHERE PGMID = 'R3TR' AND

OBJECT = 'SMOD' AND

DEVCLASS = IT_TADIR-DEVCLASS.

IF SY-SUBRC = 0.

SORT IT_JTAB BY OBJ_NAME.

ENDIF.

ENDIF.

ENDIF.

*- Get UserExit names

LOOP AT IT_JTAB.

SELECT NAME

MEMBER

INTO (IT_FINAL-NAME, IT_FINAL-MEMBER)

FROM MODSAP

WHERE NAME = IT_JTAB-OBJ_NAME AND

TYP = 'E'.

APPEND IT_FINAL.

CLEAR IT_FINAL.

ENDSELECT.

ENDLOOP.

*- Process it_final contents.

LOOP AT IT_FINAL.

L_TABIX = SY-TABIX.

CLEAR: L_FNAME,

L_GROUP,

L_INCLUDE,

L_NAMESPACE,

L_STR_AREA.

L_FNAME = IT_FINAL-MEMBER.

CALL FUNCTION 'FUNCTION_EXISTS'

EXPORTING

FUNCNAME = L_FNAME

IMPORTING

GROUP = L_GROUP

INCLUDE = L_INCLUDE

NAMESPACE = L_NAMESPACE

STR_AREA = L_STR_AREA

EXCEPTIONS

FUNCTION_NOT_EXIST = 1

OTHERS = 2.

IF SY-SUBRC = 0.

IF NOT L_INCLUDE IS INITIAL.

*- Get Source code of include.

CLEAR: V_INCLUDE, E_T_INCLUDE, E_T_INCLUDE[].

V_INCLUDE = L_INCLUDE.

CALL FUNCTION 'MU_INCLUDE_GET'

EXPORTING

I_INCLUDE = V_INCLUDE

TABLES

E_T_INCLUDE = E_T_INCLUDE.

IF SY-SUBRC = 0.

LOOP AT E_T_INCLUDE.

IF E_T_INCLUDE-LINE CS 'INCLUDE'.

CLEAR L_LINE.

L_LINE = E_T_INCLUDE-LINE.

CONDENSE L_LINE NO-GAPS.

TRANSLATE L_LINE USING '. '.

L_LINE = L_LINE+7(9).

IT_FINAL-INCLUDE = L_LINE.

MODIFY IT_FINAL INDEX L_TABIX TRANSPORTING INCLUDE.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. " get_objects

&----


*& Form display_results

&----


  • Display Results

----


FORM DISPLAY_RESULTS.

FORMAT COLOR COL_HEADING.

WRITE:/1(150) SY-ULINE.

WRITE:/ SY-VLINE,

2(23) 'Extension Name',

24 SY-VLINE,

25(39) 'Exit Name',

64 SY-VLINE,

65(74) 'Description',

140 SY-VLINE,

141(9) 'Include',

150 SY-VLINE.

WRITE:/1(150) SY-ULINE.

FORMAT RESET.

SORT IT_FINAL BY NAME MEMBER.

LOOP AT IT_FINAL.

CLEAR TFTIT.

SELECT SINGLE STEXT

INTO TFTIT-STEXT

FROM TFTIT

WHERE SPRAS = 'EN' AND

FUNCNAME = IT_FINAL-MEMBER.

WRITE:/ SY-VLINE,

IT_FINAL-NAME COLOR COL_KEY, 24 SY-VLINE,

25 IT_FINAL-MEMBER, 64 SY-VLINE,

65 TFTIT-STEXT, 140 SY-VLINE,

141 IT_FINAL-INCLUDE, 150 SY-VLINE.

WRITE:/1(150) SY-ULINE.

ENDLOOP.

ENDFORM. " display_results

Hope this resolves your query.

<b>Reward all the helpful answers</b>.

Regards