enhancement framework badi development

Upload: jyotsana-sharma

Post on 08-Aug-2018

236 views

Category:

Documents


4 download

TRANSCRIPT

  • 8/22/2019 Enhancement Framework Badi Development

    1/27

    www.itp-consulting.com

    Introducing the Enhancement Framework

    (BADI Development)

    Anthony Cecchini

    Information Technology Partners Consulting

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    2/27

    -

    Objectives

    The purpose of this presentation is to: Provide an Overview of the Enhancement Framework

    Describe what a BADI is

    Classic vs. Kernel BADIs

    Implement a BADI (Classic) Tips & Tricks

    Address feedback and questions from Audience

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    3/27

    -

    Enhancement Framework

    SAP is known for delivering business software easily adaptable by

    customers for their specific needs. Typically the software (for

    example, mySAP ERP) can be adapted by one of the following

    techniques:

    Customizing (defining system behavior through standard SAP providedmechanism without coding),

    Enhancement (adding custom code at strategic hook positions provided bySAP)

    Modification (modifying SAP supplied code directly often called Core-Mod

    .

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    4/27

    -

    Enhancement Framework

    Let us first take a look at how the enhancement technique has evolvedso far in SAP.

    User-Exitis one of the very first mechanisms provided by SAP to executecustom code in between the standard SAP control flow. This is implemented assubroutine call (PERFORM xxx). A classical example for User-Exit is MV45AFZZ

    include in order processing module of SAP R/3. Though this include objectdoesnt fall under customer namespace, the object doesnt get overwritten duringupgrade.

    Customer-Exit is better than the user-exit, in the sense that it is implementedusing Function Modules and so has a well defined parameter interface. Alsosince 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 nowcalled old classic-BADIs. This was the first object-oriented way to enhance theABAP system. This, to a certain extent, allows multiple implementations withlimited filter support. The classic-BADIs are implemented using ABAP Objects

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    5/27

    -

    Enhancement Framework

    So what's so cool about this new enhancement technology?

    Source Code enhancement Function Group enhancement Class enhancement Kernel-BADI Enhancement

    The first three methods, viz., Source Code enhancement, Function

    Group enhancement, and Class enhancement are brand new ways

    to enhance the ABAP system. The final one Kernel-BADI is an

    improvement of the old classic-BADI now integrated into theEnhancement Framework. Remember that all of these

    techniques are considered enhancing and not modifying the

    system.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    6/27

    -

    What is a BADI?

    Business Add In

    Business Add-Ins may be simply defined as an object-oriented extension of the SAP.They consist of special hooks provided by SAP core developers for incorporatingcustomer (or company) specific logic. (BADI Definition) The process of adapting yourprogram according to your specific scenario is known as implementation of the BADI.

    BADIs are based upon the concept of object-orientation. The program that incorporatesthe enhancement option calls a method of a generated BADI class. During theimplementation procedure, the customer-specific code is written in the relevantmethod. The method name is specified via a BADI interface. The name of the interfaceis of the form IF_EX_BADI, where BADIis the name of the Business Add-In inquestion. For example, in the case of the HR Add-In HR_INDVAL, the involvedinterface is IF_EX_HR_INDVAL.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    7/27

    -

    What is a BADI?

    BADI Architecture in SAP

    What's important about this diagram is that it reflects both the definition

    of a classic BADI as well as its implementation.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    8/27

    -

    What is a BADI?(Definition)

    1.CORE SAP Application developers define an interface for the

    add-in

    2.SAP generates an adapter class for implementing the add-in

    thus opening a path for customer or partner implementations

    BADI Architecture in SAP

    1 2

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    9/27

    -

    What is a BADI?(implementation)

    1.Customer/partner developer creates an interface of the adapter class

    2.The interface definition ensures that consistent data is passed to the

    different add-in implementations

    3.Adapter class takes care of calling and filtering out the proper

    BADI Architecture in SAP

    1

    3

    2

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    10/27

    -

    What is a BADI?

    If an BADI is called frequently,performance problems can occur

    (No longer an issue with newKernel BADIs)

    Customers can create BADIs

    Creating a BADI within a CMOD

    project exit can allow multipledevelopers to share an exit withoutstepping on each others toes

    SAP guarantees upwardcompatibility of all BADI interfaces

    BADIs are not a replacement forCustomer Exits (already existingexits were not converted to BADIs)

    Enhancements, interfaces &

    generated classes all lie in the SAPnamespace

    Implementations lie in thecustomer/partner namespace andare transportable

    Standard naming conventions

    apply for BADIs start yourimplementations with Z

    Object oriented coding rules apply(i.e. no header lines on internaltables)

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    11/27

    -

    Classic vs. Kernel BADIs

    The old classic-BADIs are implemented purely at the ABAPWorkbench level; that is, both the definition and implementation are

    realized as workbench repository objects (global classes and

    interfaces)..

    Example:.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    12/27-

    Classic vs. Kernel BADIs

    The new Kernel-BADI takes it to the ABAP language level. Because of this,the new Kernel-BADIs are much faster compared to the old classic-BADIs

    There are two new ABAP statements available now to support the Kernel-BADIs, namely GET BADI and CALL BADI.

    Example:

    data bd_hdl type ref to badi_name.

    GET BADI bd_hdl filters filt_1 = VALUE.

    CALL BADI bd_hdl->method

    exporting param_1 = 10.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    13/27-

    Classic vs. Kernel BADIs

    The old classic-BADI used to mix both implementation selection andmethod call in the same CALL METHOD statement. Theimplementations could only be chosen at run-time because of theabove reason and due to the fact that the BADI handle could only begotten from another method call by passing the BADI name.

    Whereas in the new Kernel-BADI, the active BADI implementationsare included into the load of BADI handle at compile time and thefilter criterion are expanded as IF statements. This is the reason thenew Kernel-BADIs are much faster than classic-BADIs.

    Some of the other new features of Kernel-BADIs are, Improved Filters with complex filter condition editor Possibility to inherit the implementations Switchable using Switch Framework

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    14/27-

    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

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    15/27-

    Implement a BADI (Classic)

    A pop-up screen appears, as shown. Enter the name of the BADIinvolved and press the Enter button.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    16/27-

    Implement a BADI (Classic)

    Enter an appropriate short text in the field provided. Then, click on theInterface 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.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    17/27-

    Implement a BADI (Classic)

    Then, double-click on the name of the method (in our caseSAP_SCRIPT_TABLES). This takes you to the Class Builders

    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

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    18/27-

    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

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    19/27-

    Implement a BADI (Classic)

    Step 2: Activate the BADI!

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    20/27-

    Tips & Tricks

    How do we find available BADIs?

    There are multiple ways of searching for BADIs. First there is

    the obvious

    Go to Transaction Code SE18 (Definition)

    Press F4

    Search by package, Hierarchy, or by program.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    21/27-

    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.

    Double click on the program name.

    Once inside the program search for CL_EXITHANDLER=>GET_INSTANCE.

    Make sure the radio button In main program is checked.

    A list of all the programs with call to the BADIs will be listed.

    The export parameter EXIT_NAME for the method GET_INSTANCE ofclass CL_EXITHANDLER will have the METHOD assigned to it. Thechanging parameter INSTANCE will have the interface assigned to it.

    Double click on the method to enter the source code.

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    22/27-

    Tips & Tricks

    Finding BADI Using SQL Trace (TCODE-ST05)

    Start transaction ST05 (Performance Analysis).

    Set flag field "Buffer trace"Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially viewV_EXT_IMP and V_EXT_ACT)

    Push the button "Activate Trace". Start transaction in a new GUI session. Go back to the Performance trace

    session.

    Push the button "Deactivate Trace".

    Push the button "Display Trace".

    The popup screen "Set Restrictions for Displaying Trace" appears.Now, filter the trace on Objects: V_EXT_IMP

    V_EXT_ACT

    Push button "Multiple selections" button behind field ObjectsFill: V_EXT_IMP and V_EXT_ACT

    All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADIclass interfaces. The BADI name is after the IF_EX_.

    So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    23/27-

    Tips & Tricks

    Finding BADI Using Repository Information System (TCODE- SE84)

    Go to Maintain Transaction (TCODE- SE93).

    Enter the Transaction for which you want to find BADI.

    Click on the Display push buttons.

    Get the Package Name.

    Go to TCode: SE84->Enhancements->Business Add-inns->Definition, enter the Package Name and Execute.

    Here you get a list of all the Enhancement BADIs for the given package

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    24/27-

    Conclusion

    I reviewed the rudiments of Business Add-Ins and their benefits for

    SAP users and developers. Then, I discussed in detail the steps

    required in implementing an add-in.

    I hope this presentation will provide you with some breadcrumbs tohelp you in adapting standard SAP programs quickly and easily using

    BADIs!

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    25/27-

    Further Information

    Help Portalhttp://help.sap.com

    Documentation SAP Netweaver (04s) Application Platform

    ABAP technology ABAP Workbench Enhancement Framework

    SDN

    http://sdn.sap.com

    http://www.itp-consulting.com/http://help.sap.com/http://sdn.sap.com/http://sdn.sap.com/http://help.sap.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    26/27-

    Address Feedback & Questionsfrom audience

    http://www.itp-consulting.com/http://www.itp-consulting.com/
  • 8/22/2019 Enhancement Framework Badi Development

    27/27

    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 arethe 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 theinformation, 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, fitnessfor 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 fromthe 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 throughthe 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.