Sei sulla pagina 1di 3

A Tour of the New Business Add-Ins (BAdIs)

Below is a snippet from one of hundreds of articles available to ERPtips subscribers.


If you would like a complimentary copy of the full article, please email
Mark.Downs@ERPtips.com
(include the title of the article in your email)

To subscribe to ERPtips, go to
www.ERPtips.com/Subscribe.asp.

ERPtips Journal is published by Klee Associates, Inc.


ERPtips University provides both public and onsite training for SAP clients.
For more about ERPtips University, including the current schedule, click here:
www.ERPtips.com/WorkshopSchedule.asp

A Tour of the New Business Add-Ins (BAdIs)

Pssstt…wanna check out something HOT in SAP? Take a look at the newly enhanced BAdIs available in

Click here to read this Snippet


SAPtips4On ABAP / J2EE
A Tour of the New Business Add-Ins (BAdIs):
Page 

April/ May 2008 Volume VI Issue 2

A Guide for SAP Developers and Consultants


®

By Rehan Zaidi, Siemens Pakistan

Editor’s Note: Pssstt…wanna check out something HOT This article is primarily intended for ABAP developers.
in SAP? Take a look at the newly enhanced BAdIs avail- I will assume that the reader is familiar with ABAP
able in ECC 6.0. Rehan Zaidi addresses the benefits of programming, as well as the Classic BAdIs. For more
the new Business Add-Ins, how they differ from previ- information, refer to the SAP documentation on
ous versions, their implementation, single vs. multi-use http://help.sap.com. All the screenshots in this article have
BAdIs, and even answers this question: What is an been taken from ECC 6.0.
Enhancement Spot? Take a tour with Rehan and learn
how you can get the most out of the BAdIs in your SAP
system.

Introduction: These BAdIs are faster in


Over time, SAP has improved the ways it allows cus-
tomer-specific requirements to be incorporated into the performance and are easy to
standard R/3 functionality. The enhancement options
are no exception. One example of such an improvement define and implement.
is the introduction of the new BAdIs.

These BAdIs are faster in performance and are easy to


define and implement. For these reasons, having the
knowledge of the new BAdIs is an absolute must for
developers and consultants. New Business Add-Ins (BAdI): An Overview
SAP has provided an improved and faster BAdI technol-
The aim of this article is to discuss the new Business ogy in the ECC 6.0 release. The new BAdIs are based
Add-ins (BAdIs) provided by SAP since ECC 6.0. I will upon the same concept of object orientation as classic
begin with an overview of the new features, and then BAdIs. However, there are a few differences. The new
discuss the characteristics of multiple- and single-use BAdIs are provided as part of the new Enhancement
BAdIs. The structure of the new BAdIs will be examined Framework. In the new Enhancement Framework,
and examples will be presented. How to implement the the BAdI becomes an optional enhancement, or an
new BAdIs will be explained in detail. anchor point into which coding may be plugged. The
SAPtipsJournal

new BAdIs reside in containers known as Enhancement


These are some of the questions this article will address: Spots. Each BAdI has an Interface composed of the
BAdI method(s). It is this method which is accessed in
• What are the benefits of the new Business Add-ins? the program.
How do they differ from classic BAdIs?
Note: An entire discussion of Enhancement Framework
• What is the new Enhancement Framework, and what is beyond the scope of this article. It will be discussed,
is an Enhancement Spot? however, in an upcoming article. For more on Classic
BAdIs, see my article Enhancing Standard Programs
• What would a typical call for the new BAdI look like? Quickly & Easily Via Business Add-Ins (BADIs) in the
“ABAP, Java, and J2EE Development” category in the
• How do single-use and multiple-use BAdIs differ? SAPtips Document Library.

• How are the new BAdIs implemented? In addition to the benefits provided by the Classic BAdI,
one major advantage that comes with the new BAdIs is
that they are faster in execution.

SAPtips.com SAPtips © 2008 Klee Associates, Inc.


SAPtips4On ABAP / J2EE
Page 

April/ May 2008 Volume VI Issue 2

BAdIs may be developed by SAP or may be custom • The GET BADI statement is used to generate a new BAdI
defined. We refer to the developer of the BAdI or any object, and assigns the reference to this object to the
other enhancement option as the Option provider. The specified variable (in our example, g_BADI_ME59_
methods and their signatures (or the parameters) for EXCLUDE). This is also termed as the handle to the
each respective method’s imports, exports, changes, or BAdI object.
returns, are defined by the BAdI developer. The meth-
ods defined in the BAdI interface are implemented Prior to the GET BADI statement, the variable used must
by the BAdI implementer. The option provider (BAdI be defined based on the BAdI that is to be used.
creator) defines what has to be done, but it is the
implementer who carries out the actual implementation In case you have defined filters for your BAdI, you may
of the BAdI. Within the new BAdIs, the actions of the include suitable filter values in your GET BADI statement.
implementer are controlled by the option provider, who The GET BADI statement will be changed as shown below:
controls the class upon which the BAdI is based.
GET BADI myobject filter = filters.
A developer must use BAdI when he or she wants a par-
ticular procedure to be executed at a particular position, • The CALL BADI statement is then used to call the rel-
but does not want to specify the exact content of that evant BAdI method. This method call may involve
procedure. This might happen if the procedure details importing, exporting, and changing parameters (see
used are different among various potential implement- Figure 1).
ers. It might also occur if the procedure details are so
specific that the developer is not familiar with them, or Multiple- and Single-Use Business Add-Ins
if adding different implementations at a later stage. The new Business Add-ins may either be Single-use or
Multiple-use. These two types of BAdIs are quite dif-
Note: In addition to BAdIs, the new Enhancement ferent. In single-use BAdIs, the business logic requires
Framework provides another option of enhancement exactly one single calculation result. The program’s
known as Source Code Plug-ins. The possibility of next steps may need this result; therefore at least one
attaching a source code plug-in is allowed when an BAdI implementation is needed. In this case, exactly
enhancement point in the code is inserted by the option one result is required because there is no way to handle
provider. The implementer may add her or his own many return values. The system takes care that there is
code at this enhancement point. This has a few dis- exactly one active implementation in a single-use BAdI.
advantages. Because the written code
is generally implemented later in the
development, the option provider has
no control over it. All the variables that
are visible in the enhanced modulariza-
tion unit may be accessed by the code
within this source code plug-in. There-
SAPtipsJournal

fore, the implementer is able to modify


the value of any variables. This may be
undesirable in some cases, and cannot
be prevented by the option provider.
In this case, there is no control over
the implementer. On the other hand,
the BAdIs provide more control to the
option provider.

A typical call of the new BAdI is shown


in Figure 1.

The BAdI method is accessed using two


new ABAP commands, namely GET BADI
and CALL BADI. Let us take a closer look
at the use of these two commands:
Figure 1: A New BAdI Call

SAPtips.com SAPtips © 2008 Klee Associates, Inc.

Potrebbero piacerti anche