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

目录
相关文章
|
9月前
|
程序员
开发语言漫谈-ABAP
ABAP是SAP公司专门用于SAP软件环境的专门语言
|
BI
SAP ABAP在线预览文档对象的开发实现
应用场景:有些定制化开发(报表/功能增强等)完成之后,客户需要将其操作手册或者相关文档放在某个报表的初始画面,供实际操作者在线查阅,当然这个功能也同样类似于模板的下载,这里就以在线预览(直接打开)为例进行说明。
251 0
|
SQL 设计模式 前端开发
【置顶】SAP ABAP开发实战——从入门到精通系列目录
本文章为SAP ABAP开发实战——从入门到精通系列的目录以及关于该教程的后续写作计划表
1828 0
【置顶】SAP ABAP开发实战——从入门到精通系列目录
|
前端开发 JavaScript 数据库
如何使用 Restful ABAP Programming 编程模型开发一个支持增删改查的 Fiori 应用(二)
Restful ABAP Programming 编程模式是 ABAP 这门编程语言在不断向前进化的过程中,诞生的一门新的编程模型,简称为RAP模型。
175 0
如何使用 Restful ABAP Programming 编程模型开发一个支持增删改查的 Fiori 应用(二)
|
程序员 BI
也谈SAP业务顾问如何避免被ABAP开发顾问怒打
也谈SAP业务顾问如何避免被ABAP开发顾问怒打
也谈SAP业务顾问如何避免被ABAP开发顾问怒打
abap开发function module时使用tables传递参数报错过时的解决方法
如下图,我写了一个Function Module我要在tables中添加一个参数TABLES参数已过时不管怎么点击保存按钮,一直报错,怎么办呢?不管是不是过时,狂点回车,就保存了
1770 0
ABAP开发基础知识:1) ABAP基础程序类型(ABAP Elementary Data Types)
ABAP程序共包含8种基本数据类型定义,下表 数据类型名称 描述 属性 C Character Text(字符类型) 默认长度=1,默认值=blank,最大长度无限制 N Numeric Text(数字类型) 默认长度=1,默认值=“0.
864 0
ABAP开发基础知识:2) 变量的声明(Declaring Variables)
本篇文件主要讲解的是在ABAP编程过程中如何声明变量。     1.按类型定义变量     ABAP的变量需要通过关键字DATA进行声明,当同时声明多个变量时,需要在DATA后面加冒号,如“DATA:”,每个变量可以分配默认值,使用"VALUE ‘默认值’"进行定义,基本语法如下:     DATA  (长度)  TYPE   VALUE  . 例如:定义一个C类型变量“TEST1”,长度为10,默认值为“Hello Sap” 。
1663 0
ABAP开发基础知识:3) 自定义数据类型(User-Defined Data Types)
在前面曾经介绍过,ABAP共有8种基本数据类型,但是这些数据类型属性太为单一,为了方便开发人员操作和理解,SAP还提供自定义数据类型,让用户能自行定义数据类型的名称及属性,通过关键字TYPES能够实现自定义功能,其语法格式与变量定义类似,通过TYPES声明的参数可以被其它常量、变量引用,不能直接赋值。
1094 0