Creatign a Custom Badi

Download Creatign a Custom Badi

Post on 18-Jan-2016




1 download

Embed Size (px)


inShare creatign a custom badi This question is Assumed Answered.

mohammad afzal Oct 8, 2007 3:52 PM hai freinds i want to create a custom badi, i am doing through se18 and giving zdemo and create but it gives error that create option is possible for enhancment spots only can any one help me how to create the custom badiregardsafzal 2168Views Topics: abap Average User Rating(0 ratings) Re: creatign a custom badi

Murali Poli Oct 8, 2007 3:58 PM (in response to mohammad afzal) Business Add-InsOverviewBAdi DefinitionBAdi ImplementationCalling BAdiFilter Dependent BadiNew SAP enhancement technique To accommodate user requirements not available / too specific to be included in the SAP standard ProgramBased on ABAP Objects It has Interfaces & MethodsGuaranteed upward compatibility of all Business Add-In interfaces Release upgrades do not affect enhancement calls from within the standard software nor do they affect the validity of call interfacesThough different enhancement technique, BAdi has following distinct features-Uses Object oriented approach-Two parts - Definition and its Implementation - definition can either be SAP provided or user may also create it-no longer assumes a two-system infrastructure (SAP and customers)-allows multiple levels of software development (by SAP, partners, and customers, and as country versions, industry solutions, and the like)-Can have multiple representations specific one will be executed based on some criteria (filter)-No SSCR registrationApplication Programmer defines an interface for the Business Add-InsEnhancement management takes this interface & generates an adapter class for implementing it, thus opening path for implementationAs per need, BAdi is suitably implementedDeveloper then creates an instance of the adapter class in the application program and calls the corresponding method at the appropriate timeApplication program simply calls the adapter class methods; it does not know which implementations are actually being calledAdapter class methods generated by add-in management decide which implementation is to be calledLook for BAdi in IMG and in component hierarchyCreate own implementation of the add-in (complete coding for Methods) and activate Enhancement's active components are called at runtime. BAdi DefinitionTo include Business Add-Ins in the program- Define an interface for the enhancement in the SAP menu under Tools-> ABAP Workbench -> Utilities -> Business Add-Ins (transaction SE18) -Call the interface at the appropriate point in application program-Customers can then select the add-in and implement it according to their needsLets plan a simple task:We want to convert strings in your application program is a specific way through Business Add-Ins techniqueAs the application developer, first task is to define an enhancement consisting of an interface & a method with a changing parameter to transfer valueChoose Tools ->ABAP Workbench -> Utilities -> Business Add-Ins (transaction SE18) from the SAP menuCreate a new Business Add-In containing a maximum of 20 characters and move to Interface TabName of the interface is proposed by the system but may be changed Save and double-click on the interface name to add a methodSystem branches to the Class BuilderAssign a method to the interface (default is Instance Method)Add a parameterSave and ActivateDefinition screen(SE18) will now contain the method assigned to the interfaceDocumentation may be created to describe the intended functionality of this Add-InsBAdi Implementation ABAP Workbench ->Utilities -> Business Add-Ins (transaction SE19) Find the suitable Business Add-Ins present in system (Use IMG or Component hierarchy)Use Add-Ins Documentation to understand functionality & to decideImplement the Add-Ins -a class is created with the same interface -Finalize coding for the methodImplementations are discrete transport objects and lie within the namespace of the person or organization implementing themWork on Simple Badi project ContinuedAlready structure of the interface defined In order to create an implementation for the text conversion example, the add-in (in this case, the interface's method) needs to be filled with logic that converts the string. This logic will be run through every time the add-in is called from the application programChoose ABAP Workbench ->Utilities -> Business Add-Ins (transaction SE19) Create a new implementation and select the appropriate definition in the dialog boxAdd a short text and move to Interface tabSaveDouble-click the method name when the system will take you to the code window for the methodInsert the desired source code for the implementation between the method if_ex_businessaddin~method. and endmethod. statements automatically provided to you by the system. Save and return to the Change Implementation screenOn Activation, this implementation may be executed from the application programSample code to call Add-In from ABAP ProgramTo call static method of a global class directly, class definition load statement is neededInstance of the Adapter class is created and its method is executedIf enhancement needs to be different based on some parameter (e.g. country-specific or company-code specific), separate implementation of the same Add-In can be created and activatedAt run time, the specific implementation will be executePossible through Filter-Dependent BadiHow it works-Switch on Filter-dependency while defining the interface-Select a suitable filter element-All methods created in the interface will have filter 'FLT_VAL' as one import parameter-Application program provides the filter value to the enhancement method-The method then selects the active implementation for that valueWhat qualifies as a FilterA Data elementUnderlying domain may contain a maximum of 30 characters and must be of Character typeThe data element must -Either have a search help with a search help parameter of the same type as the data element and this parameter must serve as both the import and export parameter or-the element's domain must have fixed domain values or a value table containing a column with the same type as the data elementCustom data element with the criteria may also be usedImplementing a Filter-Dependent Business Add-InImplement the Add-In for each relevant filter valueHowever, multiple filter values may use the same implementationEnter a characteristic filter value for the implementationCalling a Filter-Dependent Business Add-In Same as beforePass the filter value as export parameter to the methodBAdi some useful informationThere can be more than one implementations of the same BADI definition, and in that case only the active implementations will be executedYou can activate or de-activate any of the implementations after creationEnhancement, interface, and associated classes generated all lie in the appropriate application development namespaceBusiness Add-In implementations lie in the respective namespaces of the people who created themChanges made to the interface and changes made to the Business-Add-In definition are always incompatible-If implementations already exist for a Business-Add-In definition, they are invalidated if you make changes to the interface. This means that their syntax is no longer correct. No statements can be given on the runtime behavior. Avoid making changes to the interface or the Business-Add-In definition after the transport has taken place. -If changes to the interface are inevitable, navigate to the Class Builder for all implementing classes and clean up the method includes of these classes (Utilities > Clean up > Method includes)Please give me reward point If it is usefulThanksMurali Poli Alert Moderator Like (0) Re: creatign a custom badi

Aneesh Nandi Oct 8, 2007 4:09 PM (in response to mohammad afzal) Afzal,Check this link to create your own BADI.BADIRegardsAneesh. Alert Moderator Like (0) Re: creatign a custom badi

mohammad afzal Oct 9, 2007 6:07 AM (in response to mohammad afzal) hii

ABAP DevelopmentPrevious post Next post

Custom BADI to replace User/Customer-exitsPosted by Bharat Vaddi in ABAP Development on Apr 30, 2012 3:36:12 PM inShare I have decided to write this blog after I saw there are some old-school user- exits still being used while enhancing standard SAP functionalities with some customer specific requirements. The idea behind this blog is to avoid keeping so many IF conditions inside the user-exits for calling different requirements based on certain conditions. Instead, we can create our own BADI definition with required filter combination and also we can create multiple implementations based on different filter combination. So that it will be easy to separate the implementations and maintenance will be easy if any problem occurs in any of the implementations. The defined BADI can be called from user-exit by passing runtime filter values, so that system determines the corresponding implementation for execution.Introduction: The common meaning extracted from this saying is that too many people working on a single task tend to make a mess of it. Lets think of situation where too many developers working on a single piece of ABAP code. What will happen in that case??? Yes... it will go for a big mess. This issue is especially difficult to deal with when there are multiple functional requirements leveraging the same custom code object, form-based user-exit, or function-based user-exit.While current releases of SAP have good control of doing enhancements and customizations via BADIs, Implicit and explicit enhancement points, there still exists many user-exits (Form based / Function based) For customer specific requirements especially in case of IDOC extensions.Standard SAP solution for latest IDOCs: In case of latest IDOCs for few cases SAP provided BADI definitions (With / without filters) for making different implementations spe