Вы находитесь на странице: 1из 7

I.

Kernel-BAdI enhancement
A BAdI
is an anticipated point of extension these points act like sockets and exist
in the original source code.
is a predefined anchor for an Object PlugIn.
has a well-defined interface in contrast to source code plugIns and is
therefore more stable to changes in the original source code.

Kernel BAdIs - New Features

Are integrated directly in the ABAP Language/Runtime


Improved filter support allows non-character filter types (packed, numeric,
string) and complex filter conditions.
Enable reusable implementation instances.
Allow for inheritance of implementations.
Can be switched by the Switch Framework. You have additional control
over which BAdI implementations are processed at runtime.
The new BAdIs are faster than the classic ones.

Special optimizations for BAdIs with

No active implementations:
o GET BADI is ignored while compiling
o CALL BADI just takes the time for a simple if-statement.
One active implementation
o Direct call of that implementation
Only implementations, that are switched on are considered.
Active Flag
o Only active implementations are considered

40-600 times faster than Classic BAdIs


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.
Whereas in the new Kernel-BADI, the active BADI implementations are included
into the load of BADI handle at compile time and the filter criterion are expanded as
IF statements. This is the reason the new Kernel-BADIs are much faster than classicBADIs.

Comparison: Usage of Old BAdIs vs. New BAdIs


With Classic BAdI
DATA: bd TYPE REF TO if_intf.
DATA: flt TYPE flt.
CALL METHOD
cl_exithandler=>get_instance
EXPORTING
exit_name = `BADI_NAME`
CHANGING
instance = bd.
flt-lang = `D`.
CALL METHOD bd->method
EXPORTING
x =10
flt_val = flt.

With New BAdI


DATA bd TYPE REF TO
badi_name.
GET BADI bd
FILTERS
lang = `D`.
CALL BADI bd->method
exporting x = 10.

Obviously getting a new BAdI and calling its methods is much simpler
and needs less code.
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.
Whereas in the new Kernel-BADI, the active BADI implementations are
included into the load of BADI handle at compile time and the filter
criterion are expanded as IF statements. This is the reason the new KernelBADIs are much faster than classic-BADIs.

Steps in Creating a kernel-BAdI.


1. Create a composite enhancement spot SE80 (Right-click on the package
2.
3.

name Create->Enhancement->Composite Enhancement Spot).


Similar to the Step 1, create a simple enhancement spot. Enhancement
technique should be Object Plug-in (BAdI). Put Superordinate Composite
Enhancement Spot as the one created in Step 1.
Create all other components of the BAdI like Interface, methods and filters.

Once the BAdI has been created, it can be used inside the program using the
commands
GET BADI and CALL BADI.

Steps in implementing the BAdI.


1.

Create a composite enhancement implementation just like the composite


enhancement was created previously.
2.
Create a BAdI implementation. (Right click on the BAdI definition name
in the enhancement spot and say Create BAdI Implementation)

3. Use the composite enhancement implementation name as created in Step 1 above.


This will guide you through the process of creation of the BAdI implementation.
4. Create the filter values for the implementation.

Programming Concepts using New BAdI


Since Kernel-BADI is yet another enhancement technology under Enhancement
Framework, we need to create Enhancement Spot in order to hold the BADI definitions.
Similarly, the BADI implementations must also be assigned to Enhancement
Implementations.
Please refer to the package YOTOCN_DEV in BH1 for the examples and screenshots
presented here.

Global Logic

This BAdI can be implemented later


to include country-specific logic
These enhancement implementations should be part of the local country specific package.
All these enhancement implementations can be switched ON or OFF together using
the switch framework.
Advantages of using the Switch framework:
Evaluate the source of a bug at a high level.
Faster country-specific testing by switching on/off enhancements of other
countries.
Support for parallel developments, since they will not be working on the parent
object but on separate BAdI implementations for the BAdI definition available on
the parent object.
Please note that Packages are assigned to Switches. Hence, ALL the switchable objects
in a package can be activated/deactivated by having the switch on/off.

SWITCH FRAMEWORK
The Switch Framework can be used to
Switch on industry solutions / Enterprise Add-ons
Develop new functions without affecting existing ones

Enhance delivered systems at partner and customer site in the context of the
enhancement framework with own functions

Create at least one switch and one Business Function.


Assign the switch to your packages containing Enhancement Implementations. Use
transaction sfw5 to activate and deactivate the Enhancement Implementations.
CREATING A SWITCH AND SWITCHING IT ON/OFF
1. Create a Switch through SFW1. Press on Append Row. Enter the Name
of the Switch, description etc.
2. Double click on the newly entered switch name.
3. Enter the Name of the Package under the Packgs tab. Activate the
Switch. A background job SFW_ACTIVATE_SWITCH is scheduled in the
background to activate it.

Switch ZOTOCN_SWITCH created with the package YOTOCN_DEV assigned to it.


4. Create a business function through SFW2 and enter the name of the
Switch under the Switches tab. Activate it. A background job
SFW_ACTIVATE_BFUNC is scheduled in the background to activate it.

Business Function ZOTOCN_BUSFN created and the switch ZOTOCN_SWITCH


assigned to it. Note the reversible flag ticked.
5. Once the Switch and the business function are activated, the business
function can be sitched on/off using SFW5. After switching on the
business function and then activating it, the switchable objects under the
package(linked to the switch) are activated. Similarly they can also be
deactivated by switching off the business function.
Please note, it takes 30-120 minutes to switch on/off the business
function. There is background job, which gets scheduled.

Business Function Switched on

Do not deactivate a reversible Business Function in


a production system to keep data integrity.

Вам также может понравиться