Enhancement framework offers unique way to enhance the class and interface. Lets take a deep dive.
Class Enhancement using Implicit
You can enhance the method of the class using the implicit enhancement points. This is exactly same as the enhancement points on the subroutines / Function Modules. The points are available at the beginning of the method and end of the method.
To implement the implicit points in the class,
1. Display the class in SE24
2. Display the method source code – Navigating to source code is important if you want to implement the implicit points. If you are on class overview screen, the menu options will not be displayed.
3. Get into the enhancement mode
4. Menu Edit > Enhancement Operations > Show implicit points
Once points are available, you can implement the points the way you implement any implicit point.
Enhance a class
Class enhancement has more power than implicit points. As part of the class enhancement, you can create
- Pre Exit – This implementation would be called before the original method call
- Post Exit – This implementation would be called after the method call
- Overwrite Exit – This implementation would replace the original method call with the newly implemented method
- Parameter enhancement – Additional parameters to the method signature
- Additional Attributes – Additional Attributes
- Additional Methods – Additional new methods within the class
Once you are in the enhancement mode, you will see the table control open for changes. You can add the new methods, new attributes etc in the Enhancement Mode.
You can’t create the exit methods for the methods inherited from the super class. But you can create the exit methods for the redefined methods.
Enhance A Class
For class enhancement,
1. Display the class in SE24 and Select menu Class > Enhance
2. Enter the Implementation name and save.
3. Upon save, you will notice the editor to display PreExit, PostExit and OverwriteExit with Enhancement columns.
4. Select menu Edit > Enhancement Operations > Insert Pre-Method. Here you will find functions to create and remove each of the three exit.
5. Click on the editor icon to enter your code
Adding New Method Parameters
To add the new method parameter, head to the method signature. Here you would find that the table control is open for changes. You can add the parameters. The parameters would be Optional as they are new and would not be called from different places where method is called.
Adding New Attributes
Similarly, you can add the new attribute. The attribute could be as same as the any other attribute.
Class Enhancement Vs Method Implicit implementation
You can achieve the Pre-Exit and Post-Exit related implementation using the method’s source code implementation. As you can see, the class enhancement has more functions like Overwrite Method, New methods, new Attributes, New parameters to the methods.
Next Article
Enhancement Framework – Class enhancement source code and debugging
Table of Content – Enhancement Framework
- Enhancement Framework – Introduction
- Enhancement Framework – Explicit Enhancement-POINT Implementation
- Enhancement Framework – Debugging Implementation
- Enhancement Framework – Explicit Enhancement-SECTION Implementation
- Enhancement Framework – Implicit Enhancement Options
- Enhancement Framework – Class Enhancement
- Enhancement Framework – Class Enhancement – How designed
- Enhancement Framework – Function Module Enhancement
- Enhancement Framework – Table Enhancement Category
- Enhancement Framework – Table Enhancement – Append Structure
- Enhancement Framework – Append Search Help
- Enhancement Framework – Extension Index
- Enhancement Framework – Fixed Value Append
Very handy. I’ve not enhanced class attributes or method parameters so this can be very useful! Or very dangerous!!
Thanks much!
Hi,
I am new in ABAP and few days back i come across this nice learning website for SAP.
I have a question related to enhancement .
Which enhancement technique is better i.e BADI or Exits?
Other question is little complex i hope u understand.
When we r implementing BADI we r writing code in Interface methods and for exits in some includes
for a particular transaction.
My question is if i add code using BADI , Is it affect Exits and vice versa ?
Is there any dependency between them?
Thanks
Alok