Introducing The Enhancement Framework (BADI Development) : Anthony Cecchini Information Technology Partners Consulting
Introducing The Enhancement Framework (BADI Development) : Anthony Cecchini Information Technology Partners Consulting
(BADI Development)
Anthony Cecchini
Information Technology Partners Consulting
www.itp-consulting.com
Objectives
The Objective for this session is to:
Educate RICEFW team members responsible for creating
extensions to the delivered SAP standard code, specifically calling
out the use of both Classic and Kernal Badi’s
The purpose of this presentation is to:
Provide an Overview of the Enhancement Framework
Describe what a BADI is……
Classic vs. Kernel BADI’s
Implement a BADI (Classic)
Tips & Tricks
Address feedback and questions from Audience
www.itp-consulting.com 2
Enhancement Framework
www.itp-consulting.com 3
Enhancement Framework
Let us first take a look at how the enhancement technique has evolved so far in
SAP.
User-Exit’ is one of the very first mechanisms provided by SAP to execute custom code in
between the standard SAP control flow. This is implemented as subroutine call (PERFORM
xxx). A classical example for User-Exit is MV45AFZZ include in order processing module of
SAP R/3. Though this include object doesn’t fall under customer namespace, the object
doesn’t get overwritten during upgrade.
‘Customer-Exit’ is better than the user-exit, in the sense that it is implemented using Function
Modules and so has a well defined parameter interface. Also since the custom coding done
as part of these customer-exits is located away from the original SAP code, the maintenance
is easier than user-exits.
The ‘BADI-s’ (Business Add-Ins), as they exist in pre NW04s releases are now called old
classic-BADI’s. This was the first object-oriented way to enhance the ABAP system. This, to
a certain extent, allows multiple implementations with limited filter support. The classic-
BADI’s are implemented using ABAP Objects
www.itp-consulting.com 4
Enhancement Framework
So what's so cool about this new enhancement technology?
www.itp-consulting.com 5
What is a BADI?
Business Add In
BADIs are based upon the concept of object-orientation. The program that incorporates
the enhancement option calls a method of a generated BADI class. During the
implementation procedure, the customer-specific code is written in the relevant
method. The method name is specified via a BADI interface. The name of the interface
is of the form IF_EX_BADI, where BADI is the name of the Business Add-In in
question. For example, in the case of the HR Add-In HR_INDVAL, the involved
interface is IF_EX_HR_INDVAL.
www.itp-consulting.com 6
What is a BADI?
What's important about this diagram is that it reflects both the definition
add-in
www.itp-consulting.com 9
3.Adapter class takes care of calling and filtering out the proper
What is a BADI?
SAP guarantees upward If an BADI is called frequently,
compatibility of all BADI interfaces performance problems can occur
BADIs are not a replacement for (No longer an issue with new
Customer Exits (already existing Kernel BADI’s)
exits were not converted to BADIs) Customers can create BADIs
Enhancements, interfaces & Creating a BADI within a CMOD
generated classes all lie in the SAP project exit can allow multiple
namespace developers to share an exit without
Implementations lie in the stepping on each other’s toes
customer/partner namespace and
are transportable
Standard naming conventions
apply for BADIs – start your
implementations with Z
Object oriented coding rules apply
(i.e. – no header lines on internal
tables)
www.itp-consulting.com 10
Classic vs. Kernel BADI’s
The old classic-BADI’s are implemented purely at the ABAP
Workbench level; that is, both the definition and implementation are
realized as workbench repository objects (global classes and
interfaces)..
Example:
.
www.itp-consulting.com 11
Classic vs. Kernel BADI’s
The new Kernel-BADI takes it to the ABAP language level. Because of this,
the new Kernel-BADI’s are much faster compared to the old classic-BADI’s
There are two new ABAP statements available now to support the Kernel-
BADI’s, namely GET BADI and CALL BADI.
Example:
www.itp-consulting.com 12
Classic vs. Kernel BADI’s
The old classic-BADI used to mix both implementation selection and
method call in the same CALL METHOD statement. The
implementations could only be chosen at run-time because of the
above reason and due to the fact that the BADI handle could only be
gotten from another method call by passing the BADI name.
www.itp-consulting.com 13
Implement a BADI (Classic)
Step 1: Creating an Implementation
The first step involves creating a BADI implementation. Call transaction SE19.
The BADI implementation screen appears, as shown. Enter a suitable name for
your implementation in the field provided, and click the Create button
www.itp-consulting.com 14
Implement a BADI (Classic)
A pop-up screen appears, as shown. Enter the name of the BADI
involved and press the Enter button.
www.itp-consulting.com 15
Implement a BADI (Classic)
Enter an appropriate short text in the field provided. Then, click on the
Interface tab. This shows the name of the class that will be generated
as a result of the implementation. You may change the class if you
like. The Interface tab also contains the name of the BADI method.
www.itp-consulting.com 16
Implement a BADI (Classic)
Then, double-click on the name of the method (in our case
SAP_SCRIPT_TABLES). This takes you to the Class Builder’s
method editor screen. This is the area where you may write the code
that you would like to be executed when the BADI method is called
www.itp-consulting.com 17
Implement a BADI (Classic)
Step 2: Writing the code for the BADI Method
The next step is to write the appropriate coding for the BADI method.
This code incorporates the enhancement logic and is executed by the
application program upon the BADI method call. Most of the ABAP
statements are applicable in this case. However, since the BADI
technology is based upon ABAP Objects, some ABAP constructs are
not allowed.
The method has importing, exporting, and changing parameters. The
enhancement may be achieved by writing code that assigns suitable
values to the changing and exporting parameters of the method. The
main application program uses these values for further processing,
and in this way the desired enhancement effect is achieved
www.itp-consulting.com 18
Implement a BADI (Classic)
Step 2: Activate the BADI!
www.itp-consulting.com 19
Tips & Tricks
How do we find available BADI’s?
Press F4
www.itp-consulting.com 20
Tips & Tricks
Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
Go to the Transaction, for which we want to find the BADI. Click on System-
>Status.
A list of all the programs with call to the BADI’s will be listed.
www.itp-consulting.com 21
Tips & Tricks
Finding BADI Using SQL Trace (TCODE-ST05)
Push the button "Activate Trace". Start transaction in a new GUI session. Go back to the Performance trace session.
www.itp-consulting.com 22
Tips & Tricks
Finding BADI Using Repository Information System (TCODE- SE84)
www.itp-consulting.com 23
Conclusion
www.itp-consulting.com 24
Further Information
Help Portal
http://help.sap.com
Documentation SAP Netweaver (04s) Application Platform
ABAP technology ABAP Workbench Enhancement Framework
SDN
http://sdn.sap.com
www.itp-consulting.com 25
Address Feedback & Questions
from audience
www.itp-consulting.com 26
Copyright 2007 ,
All Rights Reserved
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of IT Partners Inc.. The information
contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP,
Intelligent Miner, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBM Corporation.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.
MaxDB is a trademark of MySQL AB, Sweden.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are
trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are
the trademarks of their respective companies. Data contained in this document serves informational purposes only.
IT Partners Inc. assumes no responsibility for errors or omissions in this document. IT Partners Inc. does not warrant the accuracy or completeness of the
information, text, graphics, links, or other items contained within this material.
This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness
for a particular purpose, or non-infringement.
IT Partners Inc. shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from
the use of these materials. This limitation shall not apply in cases of intent or gross negligence.
The statutory liability for personal injury and defective products is not affected. IT Partners Inc. has no control over the information that you may access through
the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-
party Web pages.
www.itp-consulting.com 27