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

View switch


View switch is used to toggle between views in the contextual panel.

 

Example display of view switch:

 

clip_image001[4]

 

 

The procedure for the veiw switch is no way different from the navigation list in the contextual panel except that the provide the index as importing paramter instead of context_element.

 

Let us proceed from the component created for the navigation list. Refer to the link for navigation list. <<Link to be added>>

 

Step 1: In the layout tab of the view controller swap the navigation element into view switch element as shown below.

 

clip_image002[4]

 

Provide the type as the view switch UI element.

 

clip_image003[4]

 

 

Step 2: Go to the Actions tab and synchronize the UI parameters transferred from the browser.

 

For the action on select, select the parameter from the UI select the index and press enter. This parameter will be added as an importing parameter to the event handler method. This parameter will provide the index selected based on which we can trigger the outbound plug of the veiws.

 

clip_image005[4]

 

 

 

 

 

 

 

 

 

Modify the code in the method as below.

 


   
DATA : LV_STRING TYPE STRING.

    LV_STRING
= INDEX.

   
CONCATENATE 'You have selected the index ' LV_STRING into lv_string.

   
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
       
.


   
CALL METHOD LO_MESSAGE_MANAGER->REPORT_MESSAGE
     
EXPORTING

        MESSAGE_TEXT             
= lv_string.

 

Output:

clip_image006[4]

 

Even after selecting the list 2, list 1 is highlighted. This example is only for you to know which index in the view switch have been selected and proceed with processing logic according to it. To change selected to list 2 you need to set the attribute list according to the index after the processing logic is done.

About Arun

0 Comments:

Post a Comment

Powered by Blogger.