Application Development 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: 

How can find BAdi

Former Member
0 Kudos

Hi All.

I need to find BAdi for Tcode:VL02N. how can find BAdi for particular transaction.

Help me.

To be Reward all helpfull answers.

Regards.

Jay

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Jay,

To find badis for any transactions --->

1. Go to Transaction SE24

2. Enter the Object Type CL_EXITHANDLER and click on Display.

3. Double Click on method "GET_INSTANCE".

4. Put a Break-point on

Call method cl_exithandler=>get_class_name_by_interface

5. Run any Transaction for which you need enhancements.

6. The execution will stop at the break point. Check the values of variable 'exit_name', it will give you the BADI name called at that time.

hope this helps..

Regards,

Simy Abraham

10 REPLIES 10

former_member189629
Active Contributor
0 Kudos

Jay,

Run the below code to find badis for a txn,

report zbadi_find .

tables : tstc,

tadir,

modsapt,

modact,

trdir,

tfdir,

enlfdir,

sxs_attrt ,

tstct.

data : jtab like tadir occurs 0 with header line.

data : field1(30).

data : v_devclass like tadir-devclass.

parameters : p_tcode like tstc-tcode,

p_pgmna like tstc-pgmna .

data wa_tadir type tadir.

start-of-selection.

if not p_tcode is initial.

select single * from tstc where tcode eq p_tcode.

elseif not p_pgmna is initial.

tstc-pgmna = p_pgmna.

endif.

if sy-subrc eq 0.

select single * from tadir

where pgmid = 'R3TR'

and object = 'PROG'

and obj_name = tstc-pgmna.

move : tadir-devclass to v_devclass.

if sy-subrc ne 0.

select single * from trdir

where name = tstc-pgmna.

if trdir-subc eq 'F'.

select single * from tfdir

where pname = tstc-pgmna.

select single * from enlfdir

where funcname = tfdir-funcname.

select single * from tadir

where pgmid = 'R3TR'

and object = 'FUGR'

and obj_name eq enlfdir-area.

move : tadir-devclass to v_devclass.

endif.

endif.

select * from tadir into table jtab

where pgmid = 'R3TR'

and object in ('SMOD', 'SXSD')

and devclass = v_devclass.

select single * from tstct

where sprsl eq sy-langu

and tcode eq p_tcode.

format color col_positive intensified off.

write:/(19) 'Transaction Code - ',

20(20) p_tcode,

45(50) tstct-ttext.

skip.

if not jtab[] is initial.

write:/(105) sy-uline.

format color col_heading intensified on.

  • Sorting the internal Table

sort jtab by object.

data : wf_txt(60) type c,

wf_smod type i ,

wf_badi type i ,

wf_object2(30) type c.

clear : wf_smod, wf_badi , wf_object2.

  • Get the total SMOD.

loop at jtab into wa_tadir.

at first.

format color col_heading intensified on.

write:/1 sy-vline,

2 'Enhancement/ Business Add-in',

41 sy-vline ,

42 'Description',

105 sy-vline.

write:/(105) sy-uline.

endat.

clear wf_txt.

at new object.

if wa_tadir-object = 'SMOD'.

wf_object2 = 'Enhancement' .

elseif wa_tadir-object = 'SXSD'.

wf_object2 = ' Business Add-in'.

endif.

format color col_group intensified on.

write:/1 sy-vline,

2 wf_object2,

105 sy-vline.

endat.

case wa_tadir-object.

when 'SMOD'.

wf_smod = wf_smod + 1.

select single modtext into wf_txt

from modsapt

where sprsl = sy-langu

and name = wa_tadir-obj_name.

format color col_normal intensified off.

when 'SXSD'.

  • For BADis

wf_badi = wf_badi + 1 .

select single text into wf_txt

from sxs_attrt

where sprsl = sy-langu

and exit_name = wa_tadir-obj_name.

format color col_normal intensified on.

endcase.

write:/1 sy-vline,

2 wa_tadir-obj_name hotspot on,

41 sy-vline ,

42 wf_txt,

105 sy-vline.

at end of object.

write : /(105) sy-uline.

endat.

endloop.

write:/(105) sy-uline.

skip.

format color col_total intensified on.

write:/ 'No.of Exits:' , wf_smod.

write:/ 'No.of BADis:' , wf_badi.

else.

format color col_negative intensified on.

write:/(105) 'No userexits or BADis exist'.

endif.

else.

format color col_negative intensified on.

write:/(105) 'Transaction does not exist'.

endif.

at line-selection.

data : wf_object type tadir-object.

clear wf_object.

get cursor field field1.

check field1(8) eq 'WA_TADIR'.

read table jtab with key obj_name = sy-lisel+1(20).

move jtab-object to wf_object.

case wf_object.

when 'SMOD'.

set parameter id 'MON' field sy-lisel+1(10).

call transaction 'SMOD' and skip first screen.

when 'SXSD'.

set parameter id 'EXN' field sy-lisel+1(20).

call transaction 'SE18' and skip first screen.

Reward if helpful,

karthik

Message was edited by:

Karthik Potharaju

paruchuri_nagesh
Active Contributor
0 Kudos

hi execute following u will get all userexits & badis

report zbadi_find .

tables : tstc,

tadir,

modsapt,

modact,

trdir,

tfdir,

enlfdir,

sxs_attrt ,

tstct.

data : jtab like tadir occurs 0 with header line.

data : field1(30).

data : v_devclass like tadir-devclass.

parameters : p_tcode like tstc-tcode,

p_pgmna like tstc-pgmna .

data wa_tadir type tadir.

start-of-selection.

if not p_tcode is initial.

select single * from tstc where tcode eq p_tcode.

elseif not p_pgmna is initial.

tstc-pgmna = p_pgmna.

endif.

if sy-subrc eq 0.

select single * from tadir

where pgmid = 'R3TR'

and object = 'PROG'

and obj_name = tstc-pgmna.

move : tadir-devclass to v_devclass.

if sy-subrc ne 0.

select single * from trdir

where name = tstc-pgmna.

if trdir-subc eq 'F'.

select single * from tfdir

where pname = tstc-pgmna.

select single * from enlfdir

where funcname = tfdir-funcname.

select single * from tadir

where pgmid = 'R3TR'

and object = 'FUGR'

and obj_name eq enlfdir-area.

move : tadir-devclass to v_devclass.

endif.

endif.

select * from tadir into table jtab

where pgmid = 'R3TR'

and object in ('SMOD', 'SXSD')

and devclass = v_devclass.

select single * from tstct

where sprsl eq sy-langu

and tcode eq p_tcode.

format color col_positive intensified off.

write:/(19) 'Transaction Code - ',

20(20) p_tcode,

45(50) tstct-ttext.

skip.

if not jtab[] is initial.

write:/(105) sy-uline.

format color col_heading intensified on.

  • Sorting the internal Table

sort jtab by object.

data : wf_txt(60) type c,

wf_smod type i ,

wf_badi type i ,

wf_object2(30) type c.

clear : wf_smod, wf_badi , wf_object2.

  • Get the total SMOD.

loop at jtab into wa_tadir.

at first.

format color col_heading intensified on.

write:/1 sy-vline,

2 'Enhancement/ Business Add-in',

41 sy-vline ,

42 'Description',

105 sy-vline.

write:/(105) sy-uline.

endat.

clear wf_txt.

at new object.

if wa_tadir-object = 'SMOD'.

wf_object2 = 'Enhancement' .

elseif wa_tadir-object = 'SXSD'.

wf_object2 = ' Business Add-in'.

endif.

format color col_group intensified on.

write:/1 sy-vline,

2 wf_object2,

105 sy-vline.

endat.

case wa_tadir-object.

when 'SMOD'.

wf_smod = wf_smod + 1.

select single modtext into wf_txt

from modsapt

where sprsl = sy-langu

and name = wa_tadir-obj_name.

format color col_normal intensified off.

when 'SXSD'.

  • For BADis

wf_badi = wf_badi + 1 .

select single text into wf_txt

from sxs_attrt

where sprsl = sy-langu

and exit_name = wa_tadir-obj_name.

format color col_normal intensified on.

endcase.

write:/1 sy-vline,

2 wa_tadir-obj_name hotspot on,

41 sy-vline ,

42 wf_txt,

105 sy-vline.

at end of object.

write : /(105) sy-uline.

endat.

endloop.

write:/(105) sy-uline.

skip.

format color col_total intensified on.

write:/ 'No.of Exits:' , wf_smod.

write:/ 'No.of BADis:' , wf_badi.

else.

format color col_negative intensified on.

write:/(105) 'No userexits or BADis exist'.

endif.

else.

format color col_negative intensified on.

write:/(105) 'Transaction does not exist'.

endif.

at line-selection.

data : wf_object type tadir-object.

clear wf_object.

get cursor field field1.

check field1(8) eq 'WA_TADIR'.

read table jtab with key obj_name = sy-lisel+1(20).

move jtab-object to wf_object.

case wf_object.

when 'SMOD'.

set parameter id 'MON' field sy-lisel+1(10).

call transaction 'SMOD' and skip first screen.

when 'SXSD'.

set parameter id 'EXN' field sy-lisel+1(20).

call transaction 'SE18' and skip first screen.

regards

Nagesh.Paruchuri

Former Member
0 Kudos

Hi Jai,

Method to find the package for a transaction.

Step 1.

Run Transaction.Go to menu Bar System -> Status. Here you will get the attached program with the transaction.

Step 2.

Open the program in transaction SE38. Go to Attibute.Here you will get the package to which this program is attached.

Step 3.

Run Transaction SE18(Definition of BADI).

Press F4 on Definition Name.In the package, Enter the package obtained from Step 1 and Step 2.

Press Enter.It will dispaly you the BADI for that transaction.

Package for the transaction VL03N is VL.

BADI for it is DELIVERY_PUBLISH

Regards,

Mukesh Kumar

former_member480923
Active Contributor
0 Kudos

The Only BADI available is: DELIVERY_PUBLISH.

Hope That Helps

Anirban M.

Former Member
0 Kudos

Hi,

Goto the SAP code of your Tcode,

Then do a global search in main program for CL_EXITHANDLER=>GET_INSTANCE

This is the call to the Badi implementations.

Double click there it will take u to the badi.

also with badi name in se18 , goto implementations tab -display

Former Member
0 Kudos

Hi Jay,

To find badis for any transactions --->

1. Go to Transaction SE24

2. Enter the Object Type CL_EXITHANDLER and click on Display.

3. Double Click on method "GET_INSTANCE".

4. Put a Break-point on

Call method cl_exithandler=>get_class_name_by_interface

5. Run any Transaction for which you need enhancements.

6. The execution will stop at the break point. Check the values of variable 'exit_name', it will give you the BADI name called at that time.

hope this helps..

Regards,

Simy Abraham

Former Member
0 Kudos

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,

Priyanka.

0 Kudos

Go-> se93 ->click on program-> click on display of the program->find globally ->

Then give "cl_exithandler=>get_instance".

From this u can find badi's related to the transaction.

After getting suitable .

Go to se18.

Check the functionality that you want to change.

then implement the badi in se19.

for [VL02n] definitions avilable are DELIVERY_PUBLISH

LE_SHP_TAB_CUST_HEAD

<b>if helpful reward some points.</b>

Former Member
0 Kudos

Hi,

Use BADI DELIVERY_PUBLISH

Reward if useful.

FabioFar
Explorer
0 Kudos

See this video with one technique using a break-point:

http://www.youtube.com/watch?v=URdSaRmMmd8