Professional Documents
Culture Documents
BADI Documentation
BADI Documentation
Lesson Objectives
After completing this lesson you will be able to
Introduction
PRESENTATION
Field Exits
Screen Exits
Menu Exits
APPLICATION
Programs -> Program exits -> call customer function -> Include
DATABASE
BAdIs
Business Add-Ins are a new SAP enhancement technique based on [[ABAP Objects]]
They can be inserted into the SAP system based on specific user
requirements
Events that can be used to bundle program, menu and screen enhancements into a single add-in.
can be used
grouped together
the form of interface methods and can be used with or without Menu Enhancements or Screen
Enhancements
Menu Enhancements: Function codes can be entered for a BAdI for the
Screen enhancements can be implemented for these in the form of subscreen screens.
Defining BAdIs
For Application developers to include BAdIs in their program they need to define an interface for
their enhancement in the Business Add-Ins Initial Maintenance Screen.
Defining BAdIs
into the class builder where you can define the methods, parameters and exceptions for that
interface
Defining BAdIs Interface methods
Method name
Method type
Specify the methods in the Class Builder for the interface
Instance methods can access all of the attributes of a class, and can trigger all of the events of
the class
Static methods can only access static attributes and trigger static events
Click on the Parameters button to specify any Import/Export parameters for the method
Exceptions
You can specify any exceptions in the Exceptions section.
For class based exceptions, check the checkbox Exception Classes.
BADI Implementation
SE19
Enter Implementation name
Click on create
Enter the BAdI
Definition name
To create an implementation, proceed as follows:
o Choose ABAP Workbench -> Utilities -> Business Add-Ins (transaction SE19) from the
SAP menu
o Enter a name for the implementation and choose Create.
o Enter the name of the BAdI you want to create an implementation for in the dialog box
that appears.
BAdI Implementation
During implementation creation, a class for implementing the enhancement's interface is also
created
Navigate to the Class Builder by double-clicking the method.
Modify the method code within the METHOD/ENDMETHOD statements and activate
Insert the source code between the method and endmethod statements and activated.
Exception handling for the method can be handled in this section.
Using a BAdI
When a BAdI is created, the enhancement manager automatically generates a class that
implement the interface
In order to be able to call static methods, you must declare the corresponding class in ABAP
Objects using the class definition load statement
In the example having created a BAdI for division, you can program the call for the BAdI in the
following manner:
o Create an Interface Reference Variable in the program L_BADI_INSTANCE
o Perform the statement call method cl_exithandler using the BAdI and the
L_BADI_INSTANCE.
invoked
The changing parameter INSTANCE will have the interface assigned to it.
BAdIs
Copyright IBM Corporation 2003
21 ABAP | Confidential | 15_BAdl v1 .ppt | 10/29/2003
Business Consulting Services
Copyright IBM Corporation 2003
Finding a BAdI Source program
Do a search on
CL_EXITHANDLER=>
GET_INSTANCE
call, you can find out the BAdI name by removing the prefix IF_EX_ from the interface name.
o
o
o
Enter description
Enter the description for the custom implementation
Click on the Activate button to activate the implementation
custom implementation.
executed.
Multiple use
Button checked
SAP defined BAdI CUSTOMER_ADD_DATA
CUSTOMER_ADD_DATA is an SAP defined BAdI that is invoked by the transaction VD02
Multi Use BAdIs Custom Implementation for BAdI CUSTOMER_ADD_DATA
Create a second implementation for BAdI CUSTOMER_ADD_DATA
Specify BAdI name
Click on CREATE
Create a second implementation for BAdI CUSTOMER_ADD_DATA
Multi Use BAdIs Interface method SAVE_DATA
Double click on method
SAVE_DATA
Double click on method SAVE_DATA TO enter the class builder where you can enter custom
code for this method.
Both BAdIs will be triggered when the customer data is modified in transaction VD02 and
saved.
only on one filter value but on various values, you can enter the name of a structure into the
Filter type field. The structure can consist of several data elements that fulfill the above
conditions for data elements Filter Dependent BAdIs BAdI Definition
SE18
Click checkbox for
Filter Dependent BAdIs
Enter Filter type
A filter type can be a data element or a structure. A data element must fulfill the following
criteria:
o The data element's domain may contain a maximum of 30 characters and must be
of type Character.
The data element must 1). either have a search help with a search help parameter of the
same type as the data element and this parameter must serve as both the import and
export parameter or 2). the element's domain must have fixed domain values or a value
table containing a column with the same type as the data element.
implementation.