How to develop BADI

 

-> vinod ahir

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

-------------------------------------------------------------------------------------------------------------------

-> Matthias Böttger

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

-------------------------------------------------------------------------------------------------------------------

-> Thomas M. Nielsen

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

-------------------------------------------------------------------------------------------------------------------

-> Iwan Santoso

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.

-------------------------------------------------------------------------------------------------------------------

-> Serdar Simsekler

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值