cancel
Showing results for 
Search instead for 
Did you mean: 

Embedding view in view container UI element

Former Member
0 Kudos

Hello,

I have a requirement which is given below:

I have a MAIN view where there is a view container UI element. This container holds one of 3 views(VIEW1,VIEW2 and VIEW3) depending on user input. Initially VIEW1 is displayed (this is set as the default view). Then the user navigates to VIEW2 and enters some selection criteria and confirms. Then VIEW3 is displayed with the entered selection criteria. Then the user clicks on search on the MAIN view and the RESULT view is displayed. When the user clicks on back functionality in the RESULT view,MAIN view is again displayed but the view container has VIEW1. The user wants to see VIEW3 in the viewcontainer in MAIN view.

Please let me know if there is anyway to achieve this.

Regards

Nilanjan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nilanjan,

You can create a context node which has three attributes: view1_visible, view2_visible, view3_visible. Then bind the visibility property of each view container to those context attributes. Based on user input, you can switch which view is visible or invisible through context attribute.

Thanks,

Duy

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Srilatha,

I am modifying an existing webdynpro application so I have to work within the framework of that application. Please let me know if the same can be achieved using the single view container UI element.

Regards

Nilanjan

Former Member
0 Kudos

Hello Both,

I have a single view container UI element. So I cannot hide and unhide based on the user input. Somehow I have to put VIEW1 in the view container UI element.

Regards

Nilanjan

Former Member
0 Kudos

Hello Nilanjan,

Easy way is to create two more view containers in MAIN View and embed V1, V2 , V3 into those three view containers.

And create 3 context attributes of type WDY_BOOLEAN and bind them to visible property of the view containers.

Then based on your requirement,set the attributes accordingly. Suppose you want to show only V1, then set the attribute corresponding to that view container as abap_true and set the other two attributes as abap_false.

Hope this helps!

Regards,

Srilatha

Former Member
0 Kudos

Hi Nilanjan,

Create three context attributes V1,V2,V3 of type char1.

Default value for V1 is 'X'.

Bind the visible property of each view container to the above attributes like

View1-V1

View2-V2

View3-V3

When you run the application, defaul View1 displays, coz its default values set as 'X'.

Now depends up on the logic, change the value of each attribute as 'X' or SPACE .

Eg:


    DATA lo_el_context TYPE REF TO if_wd_context_element.
    DATA ls_context TYPE wd_this->Element_context.
    DATA lv_v1 TYPE wd_this->Element_context-v1.
    DATA lv_v2 TYPE wd_this->Element_context-v2.
    DATA lv_v3 TYPE wd_this->Element_context-v3.

*   get element via lead selection
    lo_el_context = wd_context->get_element( ).

*   @TODO handle not set lead selection
    IF lo_el_context IS INITIAL.
    ENDIF.

*   set single attribute
    lo_el_context->set_attribute(
      name =  `V1`
      value = 'X' ).

*   set single attribute
    lo_el_context->set_attribute(
      name =  `V2`
      value = '' ).
*   set single attribute
    lo_el_context->set_attribute(
      name =  `V3`
      value = '' ).

or


*   set single attribute
    lo_el_context->set_attribute(
      name =  `V1`
      value = '' ).

*   set single attribute
    lo_el_context->set_attribute(
      name =  `V2`
      value = 'X' ).
*   set single attribute
    lo_el_context->set_attribute(
      name =  `V3`
      value = '' ).

or


*   set single attribute
    lo_el_context->set_attribute(
      name =  `V1`
      value = '' ).

*   set single attribute
    lo_el_context->set_attribute(
      name =  `V2`
      value = '' ).
*   set single attribute
    lo_el_context->set_attribute(
      name =  `V3`
      value = 'X' ).

Regards,

Amarnath S