Skip to Content
author's profile photo Former Member
Former Member

BADI

Hi,

Can anybody give me some tips on how to find out BADI for a particular transaction. And more over, is there any specific way how to enhance the way of finding this BADI...

If possible can any body drop me saome piece of caode example, which i can practise...

Thanks in advance...

Sangram

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 14, 2007 at 02:06 PM

    Hi,

    You can refer to recenlty published webblog by Alwin van de Put named How to search for BAdIs? (Trace it).

    Here is the link..

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

    Check out this Prgm and execute it ...

    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.

    endcase.

    <b>Reward points</b>

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 14, 2007 at 02:07 PM

    DEFINING THE BADI

    1) execute Tcode SE18.

    2) Specify a definition Name : ZBADI_SPFLI

    3) Press create

    4) Choose the attribute tab. Specify short desc for badi.. and specify the type :

    multiple use.

    5) Choose the interface tab

    6) Specify interface name: ZIF_EX_BADI_SPFLI and save.

    7) Dbl clk on interface name to start class builder . specify a method name (name,

    level, desc).

    Method level desc

    Linese;ection instance methos some desc

    8) place the cursor on the method name desc its parameters to define the interface.

    Parameter type refe field desc

    I_carrid import spfli-carrid some

    I_connid import spefi-connid some

    9) save , check and activate…adapter class proposed by system is

    ZCL_IM_IM_LINESEL is genereated.

    IMPLEMENTATION OF BADI DEFINITION

    1) EXECUTE tcode se18.choose menuitem create from the implementation menubar.

    2) Specify aname for implementation ZIM_LINESEL

    3) Specify short desc.

    4) Choose interface tab. System proposes a name fo the implementation class.

    ZCL_IM_IMLINESEL which is already generarted.

    5) Specify short desc for method

    6) Dbl clk on method to insert code..(check the code in “AAA”).

    7) Save , check and activate the code.

    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm

    http://support.sas.com/rnd/papers/sugi30/SAP.ppt

    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm

    http://members.aol.com/_ht_a/skarkada/sap/

    http://www.ct-software.com/reportpool_frame.htm

    http://www.saphelp.com/SAP_Technical.htm

    http://www.kabai.com/abaps/q.htm

    http://www.guidancetech.com/people/holland/sap/abap/

    http://www.planetsap.com/download_abap_programs.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm

    http://www.esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt

    http://www.esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf

    http://www.esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc

    http://www.esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc

    http://www.esnips.com/doc/3b7bbc09-c095-45a0-9e89-91f2f86ee8e9/BADI-Introduction.ppt

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.