Enhancements enable us to enhance standard or custom Web Dynpro components by UI or by code. Whatever changes that we make are stored in the enhancement and all changes will be reverted back once the enhancement has been deleted.
There are two types of changes that can be implemented – UI changes and Code changes.
We can enhance both standard and custom web dynpro applications. For ease of explanation I will be enhancing a custom application.
Here is an example of a custom web dynpro application created by me for which I have implemented enhancements.
I would like to enhance this custom application by creating a new UI element (new input field)
In order to enhance a view in a WD component, navigate to the required view and click on the following icon.
Enter the name of the enhancement in the pop up that appears.
Insert the required UI element (Label and input field) into the view and activate the component.
In the following screenshot a new label and an input field has been inserted.
The Active(Enhanced Implemtn ZENH_ZWEB_1 Active) notification on top of the editor tells us that we are currently working on enhancement ZENH_ZWEB_1. One component can have multiple enhancements.
A new folder Enhancement Implementations has been created. This folder contains information for all the changes that were incorporated in this enhancement.
After inserting the UI element you activate and test the application in the browser. A new label and input has been added to component.
Now if we want do a code related enhancement to component, navigate to the respective view and re-select the enhance option (ctrl + f4) and choose the enhancement created by you.
Go to the methods tab and observe the new Pre-Exit, Post-Exit and Overwrite Exit that are visible against the standard WD methods.
Click on the create button under the column where you want to write the exit code.
- Pre-Exit is used to write code which will be executed before the existing method code.
- Post-Exit is used to write code which will be executed after the existing method code.
- Overwrite-Exit completely overwrites the previously existed code for that method.
If we were to create a Post-Exit code for WDDOINIT method, click on the create button under the post-exit column. Following screen would appear and the method name would be system generated.
Save and activate the method, the enhanced method will have the enhanced icon instead of the create icon under the post-exit column.
This enhancement technique can be very useful while enhancing standard or custom SAP Web dynpro components. There is lot more that we can do with these enhancements depending on our requirements.