Enhancement Framework
- Theory
- Enhancement options
- Enhancement Spots
- BADIs and the enhancement framework
- Enhancements types
- Using enhancement framework options
- FAQ
- How to pass values for the filters?
- How to call BADI from the code?
- How to find BADI?
Theory
The Enhancement Framework enables you to add functionality to standard SAP software without actually changing the original repository objects, and to organize these enhancements as effectively as possible.- Modifications – changes to development objects delivered by SAP with or without the Modification Assistant
- Enhancements – inserting user developments into SAP development objects at predefined positions using customer exits, appends, includes, and classical Business Add-Ins (BAdIs).
Enhancement options
Enhancement options are positions in repository objects where enhancements can be made. The enhancement options are divided into two classes:- Implicit enhancement options are provided by the framework and exist without any particular preparation by a developer, they do not have to belong to a container (an enhancement spot).
- Specific options in ABAP programs – such as the end of the program – which can be enhanced by source code plug-ins.
- Parameter interfaces of function modules, which can be enhanced with parameters.
- Attributes and parameter interfaces of global classes , which can be enhanced with attributes or parameters.
- Enhancement of a Web Dynpro object.
- Explicit enhancement options have to be inserted explicitly in the source code. They are created in an initial system and must be made known to developers in target systems by means of enhancement spots.
Enhancement Spots
Enhancement spots are containers for explicit enhancement options and carry information about the positions at which enhancement options were created. One enhancement spot can manage several enhancement options of a repository object and vice versa; several enhancement spots can be assigned to one enhancement option.BADIs and the enhancement framework
Enhancements types
There are two types of enhancements: explicit enhancements and implicit enhancements.
What you should know is that SAP can control the enhancements by switching the framework: ENHANCEMENT_POINT without the keyword STATIC.If it has STATIC keyword, then it is explicit enhancements, which are inserted at the preordained places in the code.
The navigation path for creating an enhancement: Edit>Enhancement Operations> Create Implementation.
When you create new Enhancement you can group them using the additional attribute Composite Enhancement Spot which is used for semantic reasons.
Using enhancement framework options
Let's review variants abided by the enhancement framework:
- Procedural: usually we are able to change the code in the beginning and in the end, and change parameters of the FM/program.
- Object-Oriented: adding extra parameters and new methods, and changing existing methods in standard SAP classes is the same as it is for the function modules.
- Using BAdIs (BADI stands for Business Add Ins Just like Customer Exits)
- Create an enhancement spot ( T-code SE80):
- Create the BAdI definition:
- Configuring the Definition: Multiple use (? Single is when only one implementation of the BAdI is ever going to be called at any one time), Instance creation mode ( Do you need to buffer your data?);
- Defining Filter and Filter Checks.
- Creating the BAdI interface is the same procedure as defining a normal interface, with the exception that multiple-use BAdIs can only have to import and to change parameters.
- Create a BADI implementation:
- BADI implementation;
- Implementation class;
- Implement methods of the BADI interface ;
- Add filter values, if they were defined.
- Calling BAdIs.
- The first thing you need when creating a BAdI is a container for the BAdI. For that purpose, you need to create a (simple) enhancement spot. This is the container in which you develop your BAdI.
- Create a BAdI within the new enhancement spot, choose the Create BAdI pushbutton
- You need an interface where you can define the methods which determine what you can do with your BAdI
- By completing the steps above, you have created an enhancement spot and a BAdI with an interface. The interface has one method so far.
- However, just building a BAdI is not enough as it does not do anything. You need a BAdI instance and this instance must be called somewhere in the code. Since the BAdI only defines an interface, you need a class that implements this interface.
As you already know, the fallback class is chosen in case no BAdI implementation is available. As you have not created a BAdI implementation so far, the method implementation of the fallback class is used in your example code.
FAQ
How to pass values for the filters?
GET BADI lo_enh_dev_option_one FILTERSdata_type = lv_value_data_type.
How to call BADI from the code?
DATA: lo_monster_badi TYPE REF TO <<BADI DEFINITION>>.
TRY.
GET BADI lo_obj_badi FILTERS filter = lv_filter.
CALL BADI loobj_badi->handle CHANGING co_obj_badi = lo_obj_badi .
CATCH..
...
ENDTRY.
CALL BADI loobj_badi->handle CHANGING co_obj_badi = lo_obj_badi .
CATCH..
...
ENDTRY.
How to find BADI?
В классе cl_exithandler в методе GET_INSTANCE ставим точку останова. В exit_name будет вызываемая в данный момент времени BADI.
Comments
Post a Comment