Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Webdynpro ABAP

Enhancing a Component and Window

 

Enhancing a component:

 

In the previous two posts enhancement for view and controller we studied what are the options can be done by enhancing a view and a controller. If you see the first two examples the modifications can only done in that view.

 

In order to create a new view or window we need to enhance a component. We can also add component usage to the component by enhancing a component.

 

 

Enhancing a Window:

 

Enhancing a window includes adding a view in the window.  Creating a new navigation link and suppressing the existing link are the part of the enhancement in window.

 

Note: Creating a window comes under the enhancement of component.

 

 

Now let’s see an example which will demonstrates how to enhance a component and a window.

 

 

In the previous two posts for enhancement of the view and the controller we used a sap standard component for educational purpose demotree.

 

Scenario: We will create a view and embed it in the view by creating a view container UI element in the window.

 

In this post also we will use the same component.

 

Step 1: Go to the Tcode SE80 and select the root of the component demotree and click on enhance button.

 

image

Since we have already created an enhancement for the component, we will use the same enhancement.

 

image

 

Note: Enhancement is just an individual object in which we put the modifications we do in the component it is not that necessary that the we need to enhance view in a different enhancement object and component in a different enhancement object. The benefits of putting every kind of enhancement in a separate enhancement object will be when you want to reverse the enhancement you cannot deactivate it instead you have to delete the enhancement. When kept separately that particular enhancement alone can be deleted.

 

 

Once you have enhanced the component then you can start working on the component just like the custom one you have developed.

 

Step 2: Right click on the view controller and create the view as enhancement.

image

Choose the enhancement and press enter.

image

Provide the name and description for the view and press enter.

 

image

You can see the view created in the enhancement and not in the component itself.

image

Insert text view UI element and add the text property as enhanced view.

image

 

Step 3: Go to the view controller and add a view container UI element by clicking on enhance button.

image

 

Step 4: Go the window controller and click on enhance button. Assign the enhancement project we develop and press enter.

image

Add the view to be embedded as view2 which we created as the part of the enhancement. Make you activate you enhancement project before doing this step otherwise your view will not be displayed.

 

image

Save and activate the whole component and test the application.

 

Output:

image

 

Recap:

View enhancement:

Hiding or adding UI element, Creating action for UI element, Inbound plug and outbound plug.

Controller Enhancement:

Methods, Attributes and context.

Component enhancement:

Adding a view, window and component usage

Window enhancement:

Embedding a view in a window, Creating the navigation link or suppressing the existing one.

Practice the following scenario which includes the all the enhancement types.

Take the standard component WDT_FLIGHTLIST. The output of the component is as below.

image

1.      Add the flight date as the Input criteria and modify the method for the search accordingly.

2.      Make the column airline as link to action and on the click of the link the details of the airline must be displayed in the popup.

 

image

 

 

                                                                                                                         

About Arun

0 Comments:

Post a Comment

Powered by Blogger.