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

目录
相关文章
|
6月前
|
程序员
开发语言漫谈-ABAP
ABAP是SAP公司专门用于SAP软件环境的专门语言
|
SQL 设计模式 前端开发
【置顶】SAP ABAP开发实战——从入门到精通系列目录
本文章为SAP ABAP开发实战——从入门到精通系列的目录以及关于该教程的后续写作计划表
1577 0
【置顶】SAP ABAP开发实战——从入门到精通系列目录
|
BI
SAP ABAP在线预览文档对象的开发实现
应用场景:有些定制化开发(报表/功能增强等)完成之后,客户需要将其操作手册或者相关文档放在某个报表的初始画面,供实际操作者在线查阅,当然这个功能也同样类似于模板的下载,这里就以在线预览(直接打开)为例进行说明。
225 0
|
前端开发 JavaScript 数据库
如何使用 Restful ABAP Programming 编程模型开发一个支持增删改查的 Fiori 应用(二)
Restful ABAP Programming 编程模式是 ABAP 这门编程语言在不断向前进化的过程中,诞生的一门新的编程模型,简称为RAP模型。
156 0
如何使用 Restful ABAP Programming 编程模型开发一个支持增删改查的 Fiori 应用(二)
|
程序员 BI
也谈SAP业务顾问如何避免被ABAP开发顾问怒打
也谈SAP业务顾问如何避免被ABAP开发顾问怒打
也谈SAP业务顾问如何避免被ABAP开发顾问怒打
abap开发function module时使用tables传递参数报错过时的解决方法
如下图,我写了一个Function Module我要在tables中添加一个参数TABLES参数已过时不管怎么点击保存按钮,一直报错,怎么办呢?不管是不是过时,狂点回车,就保存了
1744 0
|
小程序
ABAP开发基础知识:11)子程序的建立与调用
ABAP子程序(Subrouting)是包含在程序中的一段具有一定功能的代码,能够将某个功能作为一个小程序包含在主程序中,以方便程序分析及阅读。特别是一此程序中多次用到的功能,可以简化代码,增加程序的可读性且便于维护。
1486 0
|
索引 机器学习/深度学习
ABAP开发基础知识:12)ABAP宏的应用
宏(Macros)是一段独立的代码,能实现数据的运算与输出,功能与子程序类似,主要应用于同一程序中某些重复的运算,以简化代码,其定义语法如下:        DEFINE INCREMENT.    "INCREMENT为自定义宏的名称。
924 0
ABAP开发基础知识:10)数据流控制
在SAP业务处理中,存在许许多多数据流,分别管控着不同的业务模式。下面介绍如何通过ABAP语法来实现数据流程管控。     1)使用IF语句实现分支       [Syntax]      IF .
1263 0