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

BAdi Steps

Former Member
0 Likes
705

Hi Experts,

I am new to BAdi , Could anyone explain, by means of an example, to do screen modifications using a BAdi?

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
651

Hi ,

Hope it might be helpful to you..

Business Add-Ins

Business Add-Ins are a new SAP enhancement technique based on ABAP

Objects. They can be inserted into the SAP System to accommodate user

requirements too specific to be included in the standard delivery.

Since specific industries often require special functions, SAP allows

you to predefine these points in your software.

As with customer exits (SMOD/CMOD [Page 40]), two different views are

available:

• In the definition view, an application programmer predefines exit

points in a source that allow specific industry sectors, partners, and

customers to attach additional software to standard SAP source code

without having to modify the original object.

• In the implementation view, the users of Business Add-Ins can

customize the logic they need or use a standard logic if one is

available.

In contrast to customer exits, Business Add-Ins no longer assume a

two-system infrastructure (SAP and customers), but instead allow for

multiple levels of software development (by SAP, partners, and

customers, and as country versions, industry solutions, and the like).

Definitions and implementations of Business Add-Ins can be created at

each level within such a system infrastructure.

SAP guarantees the upward compatibility of all Business Add-In

interfaces. Release upgrades do not affect enhancement calls from

within the standard software nor do they affect the validity of call

interfaces. You do not have to register Business Add-Ins in SSCR.

The Business Add-In enhancement technique differentiates between

enhancements that can only be implemented once and enhancements that

can be used actively by any number of customers at the same time.

In addition, Business Add-Ins can be defined according to filter

values. This allows you to control add-in implementation and make it

dependent on specific criteria (on a specific Country value, for

example). All ABAP sources, screens, GUIs, and table interfaces

created using this enhancement technique are defined in a manner that

allows customers to include their own enhancements in the standard.

A single Business Add-In contains all of the interfaces necessary to

implement a specific task. In Release 4.6A, program and menu

enhancements can be made with Business Add-Ins. The actual program

code is enhanced using ABAP Objects. In order to better understand the

programming techniques behind the Business Add-In enhancement concept,

SAP recommends reading the section on ABAP Objects

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

df

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

s-Addin.doc

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

c

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/f3683c05ea4464e1000000

0a114084/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e1000000

0a11402f/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e1000

0000a155106/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.

Regards,

Sana.

Reward if found usefull...

4 REPLIES 4
Read only

Former Member
0 Likes
652

Hi ,

Hope it might be helpful to you..

Business Add-Ins

Business Add-Ins are a new SAP enhancement technique based on ABAP

Objects. They can be inserted into the SAP System to accommodate user

requirements too specific to be included in the standard delivery.

Since specific industries often require special functions, SAP allows

you to predefine these points in your software.

As with customer exits (SMOD/CMOD [Page 40]), two different views are

available:

• In the definition view, an application programmer predefines exit

points in a source that allow specific industry sectors, partners, and

customers to attach additional software to standard SAP source code

without having to modify the original object.

• In the implementation view, the users of Business Add-Ins can

customize the logic they need or use a standard logic if one is

available.

In contrast to customer exits, Business Add-Ins no longer assume a

two-system infrastructure (SAP and customers), but instead allow for

multiple levels of software development (by SAP, partners, and

customers, and as country versions, industry solutions, and the like).

Definitions and implementations of Business Add-Ins can be created at

each level within such a system infrastructure.

SAP guarantees the upward compatibility of all Business Add-In

interfaces. Release upgrades do not affect enhancement calls from

within the standard software nor do they affect the validity of call

interfaces. You do not have to register Business Add-Ins in SSCR.

The Business Add-In enhancement technique differentiates between

enhancements that can only be implemented once and enhancements that

can be used actively by any number of customers at the same time.

In addition, Business Add-Ins can be defined according to filter

values. This allows you to control add-in implementation and make it

dependent on specific criteria (on a specific Country value, for

example). All ABAP sources, screens, GUIs, and table interfaces

created using this enhancement technique are defined in a manner that

allows customers to include their own enhancements in the standard.

A single Business Add-In contains all of the interfaces necessary to

implement a specific task. In Release 4.6A, program and menu

enhancements can be made with Business Add-Ins. The actual program

code is enhanced using ABAP Objects. In order to better understand the

programming techniques behind the Business Add-In enhancement concept,

SAP recommends reading the section on ABAP Objects

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

df

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

s-Addin.doc

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

c

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/f3683c05ea4464e1000000

0a114084/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e1000000

0a11402f/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e1000

0000a155106/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.

Regards,

Sana.

Reward if found usefull...

Read only

Former Member
0 Likes
651

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

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

Intro.....

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

diff betweem badi n customer exits........

http://www.sap-img.com/abap/difference-between-badi-and-user-exits.htm

Regards,

Priyanka

Read only

Former Member
0 Likes
651

User Exits are also called as BADI's (Business Aditions)

There are two steps in User Exit creation.

1} Identify the User Exit suitable for the requirement and that is available in the system:

Code SE18 is used to Identify the BADI available.

Look for the string 'CL_EXITHANDLER' in the standard program. This is a class which has a method 'GET_INSTANCE' which is used to trigger BADI's from the Standard Program. The interface parameter for this static method 'EXIT_NAME' is used to pass the BADI to the method.

Open Standard Program and do a global search 'CL_EXITHANDLER'.

SE18 > give the BADI name found through above search.

CUSTOMER_ADD_DATA > which has a method SAVE_DATA.

2} Implement the User Exit identified through above process.

T.Code SE19 is used to Implement BADI.

SE19 > give the implementation name > Give the Definition name as CUSTOMER_ADD_DATA and the Short Text.

Read only

Former Member
0 Likes
651

Dear Hari,

The following is the Step by Step Procedure to Create BADIs.

1.From the SAP menu, choose Tools --> ABAP Workbench --> Utilities -->

Business Add-Ins (transaction SE18).

We would like to explain the procedures using an application

program as an example. There is a string conversion in the

program. You want the add-in users to determine themselves how

their strings are to be converted. The application developer

defines an enhancement. It consists of an interface with a

method. A changing parameter is used to pass on the string.

2.Enter a name with a maximum of 20 characters for the Business

Add-In.

3.Choose Create.

4.On the following screen, enter a short text as the description

for the Business Add-In.

5.Choose the Interface tab. The interface name is generated

automatically and can be changed here.

6.Double-click the interface name field. The system branches to

the Class Builder.

7.Confirm that you want to save the entries you have made. Assign

a package to the Business Add-In.

8.Use the Class Builder to assign a method to the interface.

9.Now define a parameter with the following attributes:

10.Save and activate your entries. Use the pushbutton Back to

navigate back to the Business Add-In definition.

You can now continue with the definition of the Business Add-In

by executing activation in the Class Builder.

A table control now appears on the definition screen for the

Business Add-In. It displays the method you have created for the

interface.

When you maintain the interface methods, the corresponding

executing class is generated. The generated code cannot be

altered in the initial expansion phase.

11.Save your entries and use the Documentation pushbutton to

create a description for your new Business Add-In. Remember that

this documentation is very important for users to be able to

understand the purpose behind the Add-In. For more information,

read the section Documentation of a Business Add-In.

Best Regards,

Raj

<b>Please reward points if found helpful.</b>