How to develop BADI (abap)

简介: You can use the transaction SE18 to define a new BAdI definition which may be implemented by other developers later.
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".

转:https://www.sdn.sap.com/irj/sdn/thread?threadID=11927&tstart=0

目录
相关文章
|
3月前
|
数据库
什么是 SAP ABAP 的 Draft Handling 特性
什么是 SAP ABAP 的 Draft Handling 特性
20 0
|
2月前
|
监控
什么是 SAP ABAP workflow
什么是 SAP ABAP workflow
23 0
|
3月前
|
UED 开发者
ABAP Draft handling 在 SAP 现代 Fiori 应用中的重要作用
ABAP Draft handling 在 SAP 现代 Fiori 应用中的重要作用
16 0
|
5月前
|
测试技术
什么是 SAP ABAP Cross Customizing Client
什么是 SAP ABAP Cross Customizing Client
37 0
|
5月前
|
存储 程序员 数据库
什么是 SAP ABAP 的 Conversion Exits
什么是 SAP ABAP 的 Conversion Exits
22 0
|
7月前
如何在 ABAP Development Tool 创建新的 ABAP Cloud 项目
如何在 ABAP Development Tool 创建新的 ABAP Cloud 项目
53 0
|
XML Android开发 数据格式
ABAP Development Tool前后台交互的原理
ABAP Development Tool前后台交互的原理
134 0
ABAP Development Tool前后台交互的原理
使用ABAP代码动态创建一个新的BAdI Enhancement Implementation
使用ABAP代码动态创建一个新的BAdI Enhancement Implementation
128 0
|
JavaScript 前端开发 API
SAP ABAP BSP related
BSP page repository O2PAGDIR
109 0
SAP ABAP BSP related
SAP ABAP实用技巧介绍系列之could not create BAdI implementation
SAP ABAP实用技巧介绍系列之could not create BAdI implementation
84 0