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: 

own BADI's......take points buddy!!!!

Former Member
0 Kudos

Hi all,

Wht is the use of making our own BADI's definition n implementations instead of using system defined BADI's. Pleas let me know according to live scenerio in simple language.

<b>I ensure u to give points.</b>

Regards,

pradeep.phogat@gmail.com

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi pradeep,

1. instead of using system defined BADI's

Our own badi (right from scratch)

will not be useful for any standard sap transaction/program.

(bcos this z badi, will never be called from standard program/transaction)

2. But suppose we are developing our own z transaction/functionality

in sap,

then we can architect it

so that it can allow for future changes etc,

similar to how sap provides for user-exit / badi.

(using our own badis in our own z programs is not compulsary.

But we can definitely provide POINTS where such badi is called.

With this, in future, we only need to change the badi

and not the program)

regards,

amit m.

5 REPLIES 5

Former Member
0 Kudos

Hi

Most of the times in real time we use the System defined BADI's only

Very rarely we create our own custom BAdi's

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

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

Some useful URL

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

www.sapgenie.com/publications/saptips/022006%20-%20Zaidi%20BADI.pdf

http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm

http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm

Now write a sample program to use this badi method..

Look for “BBB” sample program.

“AAA”

data : wa_flights type sflight,

it_flights type table of sflight.

format color col_heading.

write:/ 'Flight info of:', i_carrid, i_connid.

format color col_normal.

select * from sflight

into corresponding fields of table it_flights

where carrid = i_carrid

and connid = i_connid.

loop at it_flights into wa_flights.

write:/ wa_flights-fldate,

wa_flights-planetype,

wa_flights-price currency wa_flights-currency,

wa_flights-seatsmax,

wa_flights-seatsocc.

endloop.

“BBB”

&----


*& Report ZBADI_TEST *

*& *

&----


REPORT ZBADI_TEST .

tables: spfli.

data: wa_spfli type spfli,

it_spfli type table of spfli with key carrid connid.

*Initialise the object of the interface.

data: exit_ref type ref to ZCL_IM_IM_LINESEL,

exit_ref1 type ref to ZIF_EX_BADISPFLI1.

selection-screen begin of block b1.

select-options: s_carr for spfli-carrid.

selection-screen end of block b1.

start-of-selection.

select * from spfli into corresponding fields of table it_spfli

where carrid in s_carr.

end-of-selection.

loop at it_spfli into wa_spfli.

write:/ wa_spfli-carrid,

wa_spfli-connid,

wa_spfli-cityfrom,

wa_spfli-deptime,

wa_spfli-arrtime.

hide: wa_spfli-carrid, wa_spfli-connid.

endloop.

at line-selection.

check not wa_spfli-carrid is initial.

create object exit_ref.

exit_ref1 = exit_ref.

call method exit_ref1->lineselection

EXPORTING

i_carrid = wa_spfli-carrid

i_connid = wa_spfli-connid.

clear wa_spfli.

http://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htm

and

http://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htm

Badihttp://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

/people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series

/people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework

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

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

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

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

http://esnips.com/doc/365d4c4d-9fcb-4189-85fd-866b7bf25257/customer-exits--badi.zip

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

http://help.sap.com//saphelp_470/helpdata/EN/eb/3e7cee940e11d295df0000e82de14a/frameset.htm

<b>Reward points for useful Answers</b>

Regards

Anji

Former Member
0 Kudos

Hi pradeep,

1. instead of using system defined BADI's

Our own badi (right from scratch)

will not be useful for any standard sap transaction/program.

(bcos this z badi, will never be called from standard program/transaction)

2. But suppose we are developing our own z transaction/functionality

in sap,

then we can architect it

so that it can allow for future changes etc,

similar to how sap provides for user-exit / badi.

(using our own badis in our own z programs is not compulsary.

But we can definitely provide POINTS where such badi is called.

With this, in future, we only need to change the badi

and not the program)

regards,

amit m.

Former Member
0 Kudos

Hi,

BADI(Business Add-In) is the object oriented method of user exits...

Each BAdI has a definition and more than one implementation. The definition means the methods(in class concept) that are used for performing various functions. The BAdI definition can be viewed in SE18 transaction(for standard ones) and user-defined BAdIs can be created in the same transaction as well.

When you create a BAdI definition, an class interface will be automatically created and you can define your methods in the interface. The implementation of the methods can be done in SE19 transaction

Intro.....

http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm

Check these links for info about badi..

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

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

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

/people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series

/people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework

http://www.esnips.com/web/BAdI

http://www.allsaplinks.com/badi.html

Implementing Business Add-Ins (BADI)

The use of object orientated code within SAP has lead to new method of enhancing standard SAP code called

Business Add-Ins or BADI's for short. Although the implementation concept is based on classes, methods and

inheritance you do not really have to understand this fully to implement a BADI. Simply think of methods

as a function module with the same import and export parameters and follow the simple instructions below.

Steps:

1. Execute Business Add-In(BADI) transaction SE18

2. Enter BADI name i.e. HRPBSGB_HESA_NISR and press the display

button

3. Select menu option Implementation->Create

4. Give implementation a name such as Z_HRPBSGB_HESA_NISR

5. You can now make any changes you require to the BADI within this

implementation, for example choose the Interface tab

6. Double click on the method you want to change, you can now enter

any code you require.

7. Please note to find out what import and export parameters a

method has got return the original BADI definition

(i.e. HRPBSGB_HESA_NISR) and double click on the method name

for example within HRPBSGB_HESA_NISR contract is a method

8. When changes have been made activate the implementation

<b>Reward points</b>

Regards

Former Member
0 Kudos

Hi,

we donot have predefined BADI for each and every requirement.

There might be so many scenarios where we have to define our own BADI

with our own requirements.

In these kind of scenarios we go for CUSTOM BADI.

and the advantage of this CUSTOM BADI is we can call from our program

and get the desired result.

Thanks,

Srinivas

former_member181962
Active Contributor
0 Kudos

HI Pradeep,

A system defined badi definition is empty by default. Means, the methods are not yet implemented.

If you want some additional functionality to be triggered when the badi is triggered, youl should implement the badi, so that you can fil the empty methods with your code.

Let me provide an example.

A badi is like a ghost. It cannot do anything by itself.

It needs to possess a body to do anything...The Body in this case is an implementation.....:)

Hope the simili makes sense..

Regards,

Ravi