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

Former Member
0 Likes
506

Hi all,

Is there any BADI to Copy Inspection Results of Inspection Lot. My FC has given this BADI -- 'QEC_SELECTION'. But I dont know how to Implement this BADI in SAP. Anybody plz tell me stepwise how to do it or how to Implement this BADI..................

Thanks in Advance.

Pradip Pawar.

ABAP

Message was edited by:

PRADIP PAWAR

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
440

Hi Pradip,

Please go thru the stuff below.

<b>BADI</b> is just an object-oriented version of user-exit. Instead of entering program code into some function module (as in customer-exit), you define some class which has to implement predefined methods and those methods are fired at predefined points just like an old user-exit. Some BADI can have multiple independent implementations which is much better for software deployment as several developers can implement the same BADI independently.

<b>Difference between BADI and User Exits</b>

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 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-level infrastructure (SAP and customer solutions), but instead allow for a multi-level system landscape (SAP, partner, and customer solutions, as well 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.

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.

Consider the following example...

Here we have created the Filter Dependent BADI 'z_delta_7_badi_prg2'.

and created Implementation for the same in which we define the method as follows:

Method ZIF_EX_DELTA_7_BADI_PRG2-GET_BURKS.

IF FLT_VAL = ‘0001’.

Z_TAX_RATE = ‘0.15’.

ELSEIF FLT_VAL = ‘1000’.

Z_TAX_RATE = ‘0.20’.

ENDIF.

Endmethod.

This method was defined while creating the BADI, and its method was written in Implementation.

REPORT z_delta_flt_val_demo.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETER : p_burks LIKE t001-burks. “Parameter for company code

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

DATA: l_badi_instance TYPE REF TO zif_ex_delta_7_badi_prg2,

l_tax_rate TYPE string.

*Call BADI within the Program

CALL METHOD cl_exithandler=>get_instance

EXPORTING

exit_name = 'z_delta_7_badi_prg2'

CHANGING

instance = l_badi_instance

EXCEPTIONS

OTHERS = 1.

*Call Method GET_BURKS Passing the Company Code and Tax Rate is *returned

CALL METHOD l_badi_instance->get_burks

EXPORTING

flt_val = p_burks

IMPORTING

z_tax_rate = l_tax_rate.

IF l_tax_rate IS INITIAL.

WRITE:/ 'Tax Rate Not Returned For Company Code: ', p_burks.

EXIT.

ELSE.

WRITE:/ 'Tax Rate For Company Code: ', p_burks 'is' , l_tax_rate.

EXIT.

ENDIF.

<b>Check the below links:</b>

http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/badi-vs-user-exit-405324

http://www.sapfans.com/forums/viewtopic.php?t=172792

Difference between BADI's & User-Exit.

1. Check the replies for your question which asked by another person.

http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/569786

2. Similar thread.

http://www.sapfans.com/forums/viewtopic.php?p=559472&sid=99caa729618b18a8f7c46cc2f047af52

3. Same question explained

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

Badi Tutorials

1. Sample program.

http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm

2. Implementing BADI.

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

Hope it helps.

3. From help.sap.com

http://help.sap.com/saphelp_nw04/helpdata/en/5f/071eed117c11d5b37d0050dadef62b/frameset.htm

<b>

Rewards Points if Useful</b>

Regards

Gokul

Hi all,

Is there any BADI to Copy Inspection Results of Inspection Lot. My FC has given this BADI -- 'QEC_SELECTION'. But I dont know how to Implement this BADI in SAP. Anybody plz tell me stepwise how to do it or how to Implement this BADI..................

Thanks in Advance.

Pradip Pawar.

ABAP

Message was edited by:

PRADIP PAWAR

2 REPLIES 2
Read only

Former Member
0 Likes
441

Hi Pradip,

Please go thru the stuff below.

<b>BADI</b> is just an object-oriented version of user-exit. Instead of entering program code into some function module (as in customer-exit), you define some class which has to implement predefined methods and those methods are fired at predefined points just like an old user-exit. Some BADI can have multiple independent implementations which is much better for software deployment as several developers can implement the same BADI independently.

<b>Difference between BADI and User Exits</b>

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 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-level infrastructure (SAP and customer solutions), but instead allow for a multi-level system landscape (SAP, partner, and customer solutions, as well 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.

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.

Consider the following example...

Here we have created the Filter Dependent BADI 'z_delta_7_badi_prg2'.

and created Implementation for the same in which we define the method as follows:

Method ZIF_EX_DELTA_7_BADI_PRG2-GET_BURKS.

IF FLT_VAL = ‘0001’.

Z_TAX_RATE = ‘0.15’.

ELSEIF FLT_VAL = ‘1000’.

Z_TAX_RATE = ‘0.20’.

ENDIF.

Endmethod.

This method was defined while creating the BADI, and its method was written in Implementation.

REPORT z_delta_flt_val_demo.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETER : p_burks LIKE t001-burks. “Parameter for company code

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

DATA: l_badi_instance TYPE REF TO zif_ex_delta_7_badi_prg2,

l_tax_rate TYPE string.

*Call BADI within the Program

CALL METHOD cl_exithandler=>get_instance

EXPORTING

exit_name = 'z_delta_7_badi_prg2'

CHANGING

instance = l_badi_instance

EXCEPTIONS

OTHERS = 1.

*Call Method GET_BURKS Passing the Company Code and Tax Rate is *returned

CALL METHOD l_badi_instance->get_burks

EXPORTING

flt_val = p_burks

IMPORTING

z_tax_rate = l_tax_rate.

IF l_tax_rate IS INITIAL.

WRITE:/ 'Tax Rate Not Returned For Company Code: ', p_burks.

EXIT.

ELSE.

WRITE:/ 'Tax Rate For Company Code: ', p_burks 'is' , l_tax_rate.

EXIT.

ENDIF.

<b>Check the below links:</b>

http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/badi-vs-user-exit-405324

http://www.sapfans.com/forums/viewtopic.php?t=172792

Difference between BADI's & User-Exit.

1. Check the replies for your question which asked by another person.

http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/569786

2. Similar thread.

http://www.sapfans.com/forums/viewtopic.php?p=559472&sid=99caa729618b18a8f7c46cc2f047af52

3. Same question explained

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

Badi Tutorials

1. Sample program.

http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm

2. Implementing BADI.

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

Hope it helps.

3. From help.sap.com

http://help.sap.com/saphelp_nw04/helpdata/en/5f/071eed117c11d5b37d0050dadef62b/frameset.htm

<b>

Rewards Points if Useful</b>

Regards

Gokul

Read only

Former Member
0 Likes
440

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

Also do refer,

http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/ebb541c5b63031e10000000a155106/content.htm

http://sap.ittoolbox.com/groups/technical-functional/sap-dev/custom-badi-implementation-324215

We can have multiple implementations for BADI

that property of BADI makes it different from user exits

see the BADI Doc

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

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

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

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

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,

srinivas