Enhancements in Web Dynpro ABAP-Part II
In part I , we have seen about enhancing the view and window of the standard web Dynpro ABAP component, in this Part we will be seeing about Enhancement of controller and deleting an Enhancement.
Enhancement of controller:
Enhancement of controller consist of enhancements of Context Nodes, Attributes, methods and actions.
Context Node Enhancement:
Each controller will be having the context assigned to it, Context nodes/attributes can be enhanced or new nodes/Attributes can be assigned to the context.
There will be two kinds of nodes,
- Nodes without Dictionary structure mapping
- Nodes with Dictionary structure mapping
IF the node is without DD mapping then you can add the attributes to it by right click on it -> create – > attribute.
Before to this step enable the enhancement implementation.
IF the node is with DD mapping then you can add the attributes to it by right click on it -> create using wizard- > attributes from components of structure.
Similarly you can add new nodes or attributes also to the same context by right click on the root context.
To enhance the attributes tab go to the required controller, and enable the enhancement implementation.
Then the attributes tab will be enabled with Edit mode hence whatever the new additions are required or Existing attribute Edit( Except standard WD attribute) we can do here.
Enhancements of method and actions:
There will be two possible things we can do in methods, Enhancing the existing method or adding new method
First enable enhancement implementation for the methods tab.
Then the tab will be converted into Edit mode hence we can add new methods here like normal Edit.
Enhancement of the existing methods can be done in any of the following 3 ways.
- Pre Exit
- Post Exit
- Overwrite Exit
We are not going to change the code of the existing method, instead we will select the Exit option & a new method will be created there we can write our business logic’s.
This method will be called before the execution of actual method, this will be called by wd_this reference by the controller and later actual method will be called.
This is just an opposite of Pre Exit, this method will be called after the execution of actual method with wd_this reference by the controller.
Overwrite method will replace the execution of actual method hence in this case actual method will not even get called.
Similarly if you wants to delete the newly created methods you can use the delete options which will be available just above to the methods.
Deleting Enhancement Implementation
To delete the Enhancement implementation, follow these steps
- Go to transaction SE80
- Select the package which you have saved the Enhancement object
- Select the implementation and delete it like it showed here.