BAPI VS BADI in SAP
BAPI VS BADI in SAP
BAPI VS
BADI
IN SAP
A BAPI is a point of entry to the System- that is, a point at which provides access to business data
and processes.
Each object in a BOR can have many methods, one or more of which can be implemented as
BAPIs.
BAPIs can have various functions:
Create an object
Retrieving the attributes of an object
Changing the attributes of an object
A BAPI is an interface that can be used for various applications: - Internet Application
Components, which make individual R/3 functions available on the Internet or an intranet for
users with no R/3 experience.
R/3 Components compositions, which allows communication between the business objects of
different R/3components(applications).
Visual Basic/JAVA/C++ - external clients (for ex- alternative GUIs) that can access business data
and processes directly.
BAPI EXPLORER:
We can display more information on business objects and the BAPIs that belong to them using
the BAPI Explorer Information.
If we expand a sub-tree for a business object in the BAPI Explorer, the system displays
the following:
Key Attributes: This provide an unique identifier for each business object.
Instance-specified Methods: These are the methods that are bound to the instance identified
by the key attributes.
Non-Instance Specified Methods: These can be called by all instances of an object type.
If we expand a substructure for a method,the system returns the names of its import and export
parameters. We can obtain more detailed information on the typing of interface parameters by
choosing the TOOLS tab, then choosing the ABAP Dictionary. BAPI interface parameters are
always typed using ABAP Dictionary types.
BAPIs usually have an export parameter called RETURN.This can be a structure or an internal
table.The return parameter contains information on errors that occurred while the BAPI was
being processed.There are no exceptions for BAPIs.
To display complete information on a business object type, use the Business Object Builder
tool.The system displays a tree structure for the business objects type, including non-API
methods.
To search for an business object use the Business Object Repository(BOR) tool.This tool
displays the component hierarchy with all the business objects that belongs to it.
STANDARD BAPIs
BAPIs with standardized names contains standard methods.Three of the most important are
listed :
GetList: Returns the contents of the key fields for the object we have chosen.
GetDetail: Returns detailed in formations for the required object.
CreateFromData: Create a new object in the R/3 and returns information about it.
BAPI : Exception Handling
Every BAPI contains an interface parameter, RETURN which contains information about errors
that occurs.This parameter is always of an ABAP Dictionary type. This means that we must
include a structure of an identical type in our program.
Comments
BADI (Business Add-In) is a new SAP Object Oriented enhancement technique which is used to
add our own business functionality to the existing SAP standard functionality.
BADI's are available in SAP R/3 from the system release 4.6c
Why BADI?
In contrast to the earlier enhancement techniques, BADI follows Object Oriented approach to
make them reusable. A BADI can be used any number of times where as standard enhancement
techniques can be used only once.
For example if we assign an enhancement to one custom project, then that enhancement cannot
be assigned to any other custom projects. To overcome this drawback SAP has provided a new
enhancement technique called BADI.
Transaction code for BADI Definition:
SE18
When you create a BAdI definition, a class interface will be automatically created and you can
define your methods in the interface. The implementation of the methods can be done in SE19
transaction.
When a BAdi is created following are automatically generated:
An interface with 'IF_EX_' inserted between the first and second characters of the BAdi name
An adapter class with 'CL_EX_' inserted between the first and second characters of the BAdi
name.
While creating a BADI using the T-code SE18, it provides the pop-up screen to select the type of
BADI to be used is as shown below.
With this option, any number of active implementations can be assigned to the same definition
BADI. By default this option is checked.
If we want the BADI for multiple use
If you have multiple-use BADI definitions, the sequence must not play any role.
The drawback in Multiple use BADI is, it is not possible to know which BADI is active especially
in country specific version.
2) Filter dependent BADI:
Using this option we can define the BADI's according to the filter values to control the add-in
implementation on specific criteria.
Ex: Specific country value.
4. Run any transaction on which we want find the BADI's say VA01.
7. You can find the BADI name in field EXIT_NAME and if you double click on it, we can get the
corresponding BADI name before hit the corresponding screen. Based on the requirement find
the BADI name and accordingly implement your functionality using the transaction se19.