Information About BADI

download Information About BADI

of 10

Transcript of Information About BADI

  • 7/31/2019 Information About BADI

    1/10

    Information about Badi

    Understanding Business Add-ins (BADI)

    By Vikram Chellappa

    Basic concept

    SAP has introduced new enhancement technique Business Add-ins from release 4.6A.

    Business Add-in is the new enhancement technique based on ABAP Objects. BADI is an exit pointin a source that allows specific industry sectors, partners, and customers to attach additionalsoftware to standard SAP source code with out modifying the original object.

    The users of Business Add-ins can customize the logic according to requirement or they can use

    the standard logic one available.

    SAP guarantees the upward compatibility of all Business Add-in interfaces. Release upgrades donot affect enhancement calls from within the standard software nor do they affect the validity of callinterfaces.

    Basic skills required

    Work Experience/Knowledge on ABAP Objects (Object orientation of ABAP) is mandatory.

    Experience on SAP enhancement technique.

    BADI in detail

    Business Add-ins infrastructure is multi-level system landscape (SAP, partner, customer solutions,as well as country versions, and industry solutions). Definitions and implementations of Business

    Add-ins at each level within system infrastructure.

    Different Views

    The different views of the BADIs are:

    1. Definition view, Application Programmer can predefine the exit points inthe source in which specific industry sector customers can attachadditional software to standard SAP source code with out having to modify

    the original object.2. Implementation view, the users of Business Add-ins can customize thelogic they need or use a standard logic if available.

    Architecture

  • 7/31/2019 Information About BADI

    2/10

    User defined BADIs:

    i. First define a Business Add-In, application developer creates an interface for the add-in.ii. Enhancement management creates an adapter class that implements the interface and

    thus provides the interface for implementation by the customer, partner and so on.iii. The programmer/developer creates an instance of the adapter class in the application

    program and calls the corresponding method at the appropriate time.

    Standard BADIs:

    i. For Standard Business Add-ins, the interface and adapter class will be predefined by SAP.

    The adapter class that implements the interface and provides the interface forimplementation by the customer, partner specific to business.

    Each Business Add-in will have one interface and an adapter class that implements interface.Depending on the business requirement user will implement the interface. The generated class(Adapter class) has the following tasks:

    1. Control, the adapter class calls the active implementations

    2. Filtering, If the Add-in has to be executed under certain conditions, then the adapter class

    ensures that only certain implementations will be executed.

    Technical Details

    a. BAdIs are contained in the system and are fully operational as of Release 4.6B. SAPcreates Add-ins for specific programs, menus, and screen enhancements for standard R/3applications. This Add-ins doesnt contain any functionality. Instead you can add-onfunctionality onto these hooks.

    b. Customers can find the enhancements in their system in the implementation guide and in the

    component hierarchy. If customer wishes to use a Business Add-in, he has to first create animplementation. The customer must implement the methods and the enhancements, and

  • 7/31/2019 Information About BADI

    3/10

    afterwards activate the implementation of the enhancement. The enhancements activecomponents are then called at runtime.

    c. Business Add-in contains an interface and other additional components such as functioncodes for menu enhancements. Business Add-ins also includes enhancements forscreens. The enhancement, interface and generated classes are all located in theappropriate application development namespace. Business Add-in implementations arecreated in the respective implementation namespace.

    Defining and Implementing Business Add-ins (BADI) (Step-by-step with screenshots)

    By Vikram Chellappa

    Defining a Business Add-in

    SAP provides the BADIs where are applicable in the standard applications. Applicationprogrammer whoever wishes to have a Business Add-ins in a particular program can define theinterface for an enhancement in the Business Add-in builder. Programmer has to program theinterface call in the program at the appropriate place. Customers can select the add-in andimplement it accordingly to their business needs.

    1. From SAP menu, choose Tools -> ABAP Workbench -> Utilities -> Business Add-ins ortransaction code SE18. The example, which is illustrated, is the string conversion in theprogram. And giving the provision to the users to determine themselves how their stringsare to be converted. Application developer define an enhancement, consists of interfacewith a method with changing parameter used to pass the string.

    2. Enter the BADI name and choose create

    3. Enter the short text, choose the interface tab.

  • 7/31/2019 Information About BADI

    4/10

    4. Double click on the interface name field. The system branches to the class builder.

    5. In the class builder assign a method to the interface and define a parameter with theattributes.

  • 7/31/2019 Information About BADI

    5/10

    6. Save and activate the interface and navigate back to the Business Add-in definition. Now in

    the BADI screen, displays the method you have created for the interface. When youmaintain the interface methods, corresponding executing class (Adapter class) isgenerated.

    7. Save your entries and document the description of the Business Add-in. Documentation isimportant for the users to understand the purpose of the Add-in.

    Implementation of BADI

    1. The list of Business Add-ins available in the system can be found through SAP ReferenceImplementation guide (IMG) or in component hierarchy. BADIs definition is included in IMGso that the customer/partner can create suitable, company-specific implementations

    2. In the SAP menu, choose ABAP Workbench -> Utilities -> Business Add-

    ins or transaction code SE19.3. Enter the implementation name and click on the create button.

  • 7/31/2019 Information About BADI

    6/10

    4. Enter the BADI name

    5. Enter the short description for the BADI implementation and implement the interface in theclass appearing in the BADI implementation screen.

    6. Double click on the implementation class and insert the desired source code for the

    implementation between the method ZIF_EX_BUSINESSADDIN~CONVERSION. AndMethod. In this particular example enter the statement translate parameter to uppercase. Save and activate your entries and return to the change implemention screen.

  • 7/31/2019 Information About BADI

    7/10

    7. Choose Activate, now you can use this implementation when the application program is

    executed. Several implementations may exist for a Business Add-in but that is not used inmultiple use basis. However only one implementation can be activate at any one time. But

    in case ofmultiple use of the BADI, we can have multiple implementations activate. Theinstance generation of the implementing class must set the attribute as public and not asprivate, protected or abstract. System will give dump if you do so.

    8. Following is the code for the class ZCL_CONVERSION_BADI_IMPL methodCONVERSION

    Method ZIF_EX_BUSINESSADDIN~CONVERSION.translate parameter to upper case.endmethod.

    Calling BADI in the Application

    1. When we define BADI, enhancement management generates a class that implements theinterface. The application developer uses a factory method to create an instance of adapterclass in the application program and calls corresponding method. The adapter classmethod generated by the enhancement management decides by checking the entries inthe table whether one or several active implementations need to be called. If required, theimplementations are subsequently executed. The application program ensures only theadapter class method is called. The application program doesnt know whichimplementations are called.

    2. Call the string conversion Business Add-in, the program calling the Business Add-in.Following is the ABAP source code

    REPORT ZMPTEST_BADI.* Declaring the handlerclass: cl_exithandler definition load.* Interface Referencedata: badi_interface type ref to ZIF_EX_BUSINESSADDIN.* Stringdata: w_str(15) type c value 'baddi test'.*****************************************************Start of Selection Event.....................************************************************start-of-selection.call method cl_exithandler=>get_instance

    changinginstance = badi_interface.

    write: / 'Please click here'.*****************************************************At line-selection Event.....................************************************************at line-selection.write: / 'original word', w_str.if not badi_interface is initial.call method badi_interface->conversion

    changing parameter = w_str.endif.write: / 'Converted word', w_str.

    Filter dependent Badi

  • 7/31/2019 Information About BADI

    8/10

    1. Business Add-in definition level (for example a country, industry sector) we can have filterdependent option. If an enhancement for country specific versions then it is likely that differentpartners can implement this enhancement. The individual countries can create and activatetheir own implementation.

    2. In the enhancement definition, all the methods created in the enhancements interface need tohave filter value as their importing parameter. The application program provides the filtervalues for the implementation method.

    3. Filter dependent BAdi is called using one filter value only, it is possible to check activeimplementation for the filter value using the function module SXC_EXIT_CHECK_ACTIVE.

    Multiple use Badi

    1. There are multiple use and single use Business Add-ins. This option can be choose atBusiness Add-in definition.

    2. The distinction is base on the procedure or event character of an enhancement. In the firstcase the program waits for the enhancement to return a return code. Typical example isbenefit calculation in HR depending on the implementation, alternative calculations can beexecuted. In case of multiple use add-ins, an event that may be interest to other componentsin program flow. Any number of components could use this event as a hook to hang their ownadditional actions on to.

    3. There is no sequence control for multiple-use implementations of BAdis. Sequence control istechnically impossible, at the time of the definition the interface does not know whichimplementations parameters will be change the implementations.

    4. The concept of multiple use of the Business Add-in is that has been implemented oncealready can be implemented again by right of the software chain.

    Business add-ins are enhancements to the standard version of the system.

    Business Add-In is a new SAP enhancement technique based on ABAP Objects.They can be inserted into the SAP system based on specific user requirements.Each Business Add-In has: at least one Business Add-In definition a Business Add-In interface a Business Add-In class that implements the interface

    In order to enhance a program, a Business Add-In must first be definedSubsequently two classes 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 BADIname.

    The Application developer creates an interface for this Add-In.

    There are multiple ways of searching for BADI.

    Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE Finding BADI Using SQL Trace (TCODE-ST05).

  • 7/31/2019 Information About BADI

    9/10

    Finding BADI Using Repository Information System (TCODE- SE84).

    1. Go to the Transaction, for which we want to find the BADI, take the example of TransactionVD02. Click on System->Status. Double click on the program name. Once inside the programsearch for CL_EXITHANDLER=>GET_INSTANCE.

    Make sure the radio button In main program is checked. A list of all the programs with call to theBADIs will be listed.The export parameter EXIT_NAME for the method GET_INSTANCE of class CL_EXITHANDLERwill have the user exit assigned to it. The changing parameter INSTANCE will have the interfaceassigned to it. Double click on the method to enter the source code.Definition of Instance wouldgive you the Interface name.

    2. 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 view V_EXT_IMP and V_EXT_ACT)Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to thePerformance 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 SAPprefix for BADI class interfaces. The BADI name is after the IF_EX_.So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA

    3. Go to Maintain Transaction (TCODE- SE93).Enter the Transaction VD02 for which you want to find BADI.Click on the Display push buttons.Get the Package Name. (Package VS in this case)

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

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

    Have a look athttp://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm

    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htmhttp://support.sas.com/rnd/papers/sugi30/SAP.ppthttp://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htmhttp://members.aol.com/_ht_a/skarkada/sap/http://www.ct-software.com/reportpool_frame.htmhttp://www.saphelp.com/SAP_Technical.htmhttp://www.kabai.com/abaps/q.htmhttp://www.guidancetech.com/people/holland/sap/abap/http://www.planetsap.com/download_abap_programs.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htmhttps://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3430

    http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htmhttp://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htmhttp://support.sas.com/rnd/papers/sugi30/SAP.ppthttp://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htmhttp://members.aol.com/_ht_a/skarkada/sap/http://www.ct-software.com/reportpool_frame.htmhttp://www.saphelp.com/SAP_Technical.htmhttp://www.kabai.com/abaps/q.htmhttp://www.guidancetech.com/people/holland/sap/abap/http://www.planetsap.com/download_abap_programs.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htmhttps://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3430http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htmhttp://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htmhttp://support.sas.com/rnd/papers/sugi30/SAP.ppthttp://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htmhttp://members.aol.com/_ht_a/skarkada/sap/http://www.ct-software.com/reportpool_frame.htmhttp://www.saphelp.com/SAP_Technical.htmhttp://www.kabai.com/abaps/q.htmhttp://www.guidancetech.com/people/holland/sap/abap/http://www.planetsap.com/download_abap_programs.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htmhttps://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3430
  • 7/31/2019 Information About BADI

    10/10

    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3506https://www.sdn.sap.com/irj/sdn/thread?threadID=11927&tstart=0http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htmhttp://www.sap-img.com/abap/difference-between-badi-and-user-exits.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htm

    Hope this resolves your query.

    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3506https://www.sdn.sap.com/irj/sdn/thread?threadID=11927&tstart=0http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htmhttp://www.sap-img.com/abap/difference-between-badi-and-user-exits.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htmhttps://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3506https://www.sdn.sap.com/irj/sdn/thread?threadID=11927&tstart=0http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htmhttp://www.sap-img.com/abap/difference-between-badi-and-user-exits.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htm