cancel
Showing results for 
Search instead for 
Did you mean: 

How to develop BADI

Former Member
0 Kudos

Hi

Could you tell me how to develop business add ins(BADI's) . Please give me sample code of some simple BADI.

thanX

Vinod Ahir

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi All,

Can someone tell me BAdi implementation, Road Plan for the for the users exits in BW.

Thanks a lot in advance.

Ranjan

Former Member
0 Kudos

Thanks. It really helps.

Former Member
0 Kudos

Hi,

I also interested in this BADI stuff. My question is how to create a new BADI.

For example, I create a custom program and I want to create a hook for a new BADI, so that for further enhancement of my custome program, other developer just need to implement the BADI, instead messing around with the original program.

Has anyone done this? Any pointers are greatly appreciated.

ssimsekler
Active Contributor
0 Kudos

Hi Iwan

You can use the transaction SE18 to define a new BAdI definition which may be implemented by other developers later. It is not so challenging. Here is the roadmap:

A. BAdI Definition

1. SE18

2. Enter the name for the BAdI to be created in customer namespace and press "Create".

3. Enter a definition for your BAdI and on the interface tab enter a name for the BAdI interface. SAP proposes a name and it is pretty good. Meanwhile a BAdI class is also created which is not in our concern.

e.g for "ZTEST", SAP proposes "ZIF_EX_TEST" for the interface and "ZCL_EX_TEST" for the class.

4. Save your BAdI.

5. Double-click on the interface name. It will pass to a Class Builder session to make you implement your interface. If you are not familiar to the Class Builder; it's a bit like Function Builder and it will be easy to discover its procedure.

6. Save and activate your interface.

B. Calling your BAdI from an application program

1. Declare a reference variable with reference to the Business Add-In interface.

e.g. DATA exit_ref TYPE REF TO zif_ex_test.

2. Call the static method GET_INSTANCE of the service class CL_EXITHANDLER. This returns an instance of the required object.

e.g.

CALL METHOD CL_EXITHANDLER=>GET_INSTANCE

CHANGING instance = exit_ref .

3. After those two steps, you can now call all of the methods of the BAdI where it is required in your program. Make sure you specify the method interfaces correctly.

C. BAdI Implementations

1. SE19

2. Enter the name for the BAdI implementation to be created in customer namespace and press "Create".

3. It will request the BAdI definition name to which this implementation will be tied.

4. Enter a definition for your implementation and on the interface tab enter a name for the implementing class. Again SAP proposes a name and it is pretty good.

e.g for "ZIMPTEST", SAP proposes "ZCL_IM_IMPTEST".

5. Save your implementation.

6. To implement a method, just double-click on the method name and you will be taken to the Class Builder to write the code for it. Here you redefine the BAdI interface methods.

7. You must activate your implementation to make it executable. You can only activate or deactivate an implementation in its original system without modification. The activation or deactivation must be transported into subsequent systems

That's all. For further details, i.e. filter-dependence, multi-usage, menu nehancements etc... you can have a look at course materials of BC425 "Enhancements and Modifications".

*--Serdar

0 Kudos

GREAT Serdar

Former Member
0 Kudos

Hi Serdar,

Is there a way to find 'where used' for a specific BADI? I dont get any results when I try from SE19.

Thanks in advance,

Jay Viswanathan.

TMNielsen
Contributor
0 Kudos

Hello Vinod Ahir

Do you want to crate a new BAdI definition(SE18) or do you want to implement a SAP standard BAdI (SE19) ?

Normally the BAdI definition is made by SAP.

BAdI's are the ABAP OO version of enhancements.

Enhancements are used/implemented by adding code to a SAP standard function module via an include file in customer name range (Zxxxxxxxx)

BAdI are used/implemented by adding code to a SAP standard class - not via the class builder but via SE19.

You could say that:

SE18 is the ABAP OO version of SMOD

SE19 is the ABAP OO version of CMOD

Best regards

Thomas Madsen Nielsen

Former Member
0 Kudos

Hi,

1. look into your code whats the name of your BADi

2. using Transaktion se19 to create a new enhancement (something starting with Z*** or Y***)

3. on next screen enter into field "Definition name" the name of the BADi from step 1

4. it generates you a new class with BADi Name as interface

5. now you can fill on or all of the 3 methods provide with your code

hope this helps Matthias