WRITTEN BY: supportmymoto.com STAFF
Writer: Abyson Joseph Chavara
Created on : 26.09.2013
The BADI(Enterprise Add-in’s) is an object-oriented enhancement possibility. The BADI defines an interface that may be carried out by BADI-implementations which might be transport objects of their very own. The brand new BADI or Kernel BADI is totally built-in into the Enhancement Framework. Throughout the Enhancement Framework a BADI is an enhancement possibility or an anchor level for an object plug-in.
Kernel BAdI’s Options
- Are built-in straight within the ABAP Language/Runtime
- Improved filter help permits non-character filter sorts and complicated filter situations
- Allow reusable implementation situations (Stateful BAdI)
- Management of the lifetime of implementations (BAdI-context)
- Enable for inheritance of implementations
- Might be switched by the Swap Framework
On this doc, I’ve demonstrated the assorted steps for making a Kernel BADI and calling it in our personal Customized program.
1. First create a Enhancement spot from SE18. Kernel Badi’s belong to an enhancement spot.
Enhancement spots carry details about the positions at which enhancement choices had been created. One enhancement spot can handle a number of enhancement choices of a Repository object. Conversely, a number of enhancement spots will be assigned to at least one enhancement possibility.
Enter the outline and if you’d like you may assign the brand new enhancement spot to a composite enhancement spot. Composite enhancement spots are used for the semantic grouping of easy enhancement spots. A composite enhancement spot accommodates both a number of easy enhancement spots and/or a number of composite enhancement spots of the related sort. You need to use composite enhancement spots to mix easy enhancement spots into significant models.
2. On creating the Enhancement spot, you can be directed to Enhancement Spot Editor. Now we have to create a brand new BADI Definition.
3. Click on on the create BADI button.
4. One can find sure choices for the BADI definitions as under.
Usability – A number of use – that’s, there will be a number of lively implementations
Restricted Filter Use – This makes the BADI Filter-dependent – that’s, you apply a filter worth to every methodology referred to as (for instance, a rustic). A special (lively) implementation is then referred to as for every worth. Attainable filter values are characterised by the filter sort.
Occasion Technology Mode – This property controls the instantiation of the thing plug-ins throughout execution of the assertion GET BADI.
The primary two specs outline context-free BAdIs.
Newly Created Instantiation – New object plug-ins are created at every execution of the assertion GET BADI.
Reusing Instantiation – An object plug-in that was used as soon as within the present inside mode is reused, whether it is required greater than as soon as.
Context-Dependent Instantiation – A context have to be specified for GET BADI. This context controls the instantiation. Just one object plug-in is created for every context and implementing class. Every time there may be one other GET BADI with the identical context, it’s reused. A context is an occasion of a category that implements the tag interface if_badi_context. The specification takes place within the type of a reference to such an occasion.
Fallback Class – Fallback class for a BADI is used if there isn’t a lively BADI implementation. This implies: The GET BADI command returns a deal with to an occasion of the fallback class and the respective CALL BADI calls the strategies of the fallback class occasion. As quickly as there may be an lively BADI implementation, the fallback class isn’t used any longer at runtime.
5. Now we have to add an interface to the BADI. Broaden the Node of BADI definition identify and double click on on node Interface. You may both add present interface or will probably be prompted to create.
Save, activate and comeback to the BADI definition display and activate the Enhancement Spot.
7. Subsequent we have to implement the Enhancement spot and BADI. Proper click on on the BADI definition and choose Create BADI Implementation.
8. First the system will ask for enhancement implementation identify. Please enter a reputation and outline.
11. You’ll be directed to the enhancement implementation display, proven under. Double click on on the Interface methodology and you can be prompted to create implementation for the tactic.
12. On clicking sure, you can be navigated to editor for the tactic. Add the next code for exhibiting a message or something as per your requirement. Reserve it and activate.
So the BADI definition and implementation half is full.
Subsequent we are going to see how we will name this Kernel BADI in our Customized program.
13. Create or open an present program in SE38. Level to the road the place you have to add enhancement possibility. Proper click on and choose Create Choice.
(Please word, to name a Kernel BADI in a Customized program we don’t want any enhancement choices, as we will simply write the code wherever. Simply meant to point out reader the creation of enh possibility and a degree in a program. Whereas creating an possibility both you might use an present enh spot imp or can create a brand new one there. Quite than explaining the subject in an environment of actual enterprise situation, I targeted on giving the reader an understanding within the ideas.)
14. Give an Enhancement level or part identify and Enhancement spot implementation identify. Right here I’ve opted an Enhancement level and have entered Enhancement spot implementation identify as ‘ZENH_IMP_TEST’ (which we have now created earlier than).
A brand new line will probably be added to the prevailing code as proven under.
15. Then add the under code which is proven within the pink field under.
Aside from Traditional BADI’s that are been referred to as by Proxy class cl_exithandler, Kernel BADI’s are referred to as straight with the reference to the BADI definition through GET BADI and CALL BADI statements. That is likely one of the the reason why Kernel BADI is quicker than basic BADI. Additionally in Traditional BADI, whereas we name it through cl_exithandler, we use the reference to the interface fairly than BADI definition
16. Now activate this system and execute it. When the cursor reaches the enhancement level, the place the BADI is named it’ll set off all of the lively implementations of that BADI. Right here we have now just one implementation and that will probably be triggered, which exhibits the under message as we have now written within the BADI implementation.
If this system fails to set off the BADI implementation, please recheck whether or not every little thing related to it’s ‘Activated’ after the creation.