Implementing an Enhancement in a view is nothing but the modifying the layout of the view or changing the properties of the existing UI elements. Take any standard component and if you go to the layout tab of any view you can see the list of UI elements available in those views and the way they are formatted in the layout. You cannot edit any of these and hence to modify you need an enhancement.
Is enhancing a Webdynpro component is a big deal? Does it require a lot of efforts? The answer is no, you just create an enhancement object and start doing whatever you want just like the way you work on with the component you created. All the modifications which you are doing will be recorded in the independent object developed for the Enhancement.
What kind of enhancement we can do in the view is as below.
1. Creating a new UI element
2. Suppressing existing UI element
3. Add Actions, Inbound Plugs and Outbound Plugs.
Creating a UI element:
You can create new UI elements and the procedure is no different. You can simply insert a new UI element in the layout and process it as usual.
Suppressing Existing UI element:
We cannot remove the existing UI element from the hierarchy. Instead if we don’t want the UI element to be displayed we can suppress its visibility. Choose the UI element you want to hide, right click on the UI element and select remove UI element. The UI element will not disappear in the hierarchy instead in the property of the UI element a new line gets added with the following information.
The properties of the UI element before removing it from the hierarchy.
The properties of the UI element after removing it from the hierarchy.
Actions, Inbound and Outbound plugs:
For each view we can additionally create plugs and an action for the UI elements.
Now let us see an example program on how to enhance a view.
Let us take a standard component demotree and enhance it. The output of the component is as below.
Lets hide the subtype of petrol and add a button UI element create an action for it and on click on the button we will display a message that view has been enhanced.
Step 1: Go to the Tcode SE80 and Choose the component DEMOTREE.
Go to the layout tab of the view controller and click on the enhance button in the application tool bar to create the enhancement.
System will prompt for enhancement name and description. Enter the name and description for the enhancement and provide the name for composite enhancement framework and click on create. Else provide the name for composite enhancement and click on enter.
Enter the description for the composite enhancement framework and press enter.
After the composite enhancement implementation is created press enter again for the enhancement implementation for the Webdynpro component to be created. After creating the enhancement you can see the status of the view changed as below.
Now to remove the subtype, right click on the node of the tree UI element type and choose remove node element.
Once you have done that you will be now able to see the properties of the node type changed as below. However these elements do not disappears in the UI elements hierarchy as I explained above in the post.
Right click on the root UI element container and select insert element to add the button UI element.
Create an action for the button UI element.
In the event handler method for the button write the coding to display the message.
DATA LO_API_CONTROLLER TYPE REF TO IF_WD_CONTROLLER.
DATA LO_MESSAGE_MANAGER TYPE REF TO IF_WD_MESSAGE_MANAGER.
LO_API_CONTROLLER ?= WD_THIS->WD_GET_API( ).
CALL METHOD LO_API_CONTROLLER->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = LO_MESSAGE_MANAGER
.
* report message
CALL METHOD LO_MESSAGE_MANAGER->REPORT_MESSAGE
EXPORTING
MESSAGE_TEXT = 'View Have been enhanced'
.
Save and activate the component and test the application for output.
Output:
You can see the subtype for petrol and diesel now been hidden.
Click on display.
How deactivate the enhancement explained by you.
ReplyDeleteHow to deactivate the enhanced webdynpro application
ReplyDelete