cancel
Showing results for 
Search instead for 
Did you mean: 

Visibility Text/label/Dropdown/Container

Former Member
0 Kudos

Hi ,

I have Designed 3 container each containing two attributes . Container2 / Container3 have a Text above it and a Lable along with a dropdown. When i select any of the line (Record) in the first container , based on this condition the related layout of container 2 and container3 should be invisible/visible . Can you give some sample code please .

Thanks,

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Take context attribute for VISIBILITY as WDUI_VISIBILITY bind this to the respective container of

VISIBLE property and fill that attribute based on condition.

Here I have one textview and other is TCO. based on the condition Im setting the visibility of the UI elements by taking two context attributes.

Sample code written in WDDOMODIFYVIEW -

DATA:
    lv_no_projects     type wdui_visibility,                  "Visibility for No projects textview
    lv_projects        type wdui_visibility,                    "Visibility for TCO projects
***UI element reference objects
    lr_txtview         type ref to cl_wd_text_view,             "Text view
    lr_tcoproj         type ref to cl_wd_transparent_container, "Transparent container
    lr_view_ele        type ref to if_wd_view_element.          "View UI element

 if lt_projects is initial.
    lv_no_projects = '02'.                     "VISIBLE
    CALL METHOD wd_context->SET_ATTRIBUTE
      EXPORTING
        VALUE = lv_no_projects
        NAME  = wd_assist->gc_NO_PROJECTS.

    CALL METHOD VIEW->GET_ELEMENT
      EXPORTING
        ID      = wd_assist->gc_TXV_NO_PROJECT
      RECEIVING
        ELEMENT = lr_view_ele.
    lr_txtview ?= lr_view_ele.

    CALL METHOD LR_TXTVIEW->SET_VISIBLE
      EXPORTING
        VALUE = lv_no_projects.
  else.

    CALL METHOD VIEW->GET_ELEMENT
      EXPORTING
        ID      = wd_assist->gc_TCO_PROJ
      RECEIVING
        ELEMENT = lr_view_ele.
    lr_tcoproj ?= lr_view_ele.
    lv_projects = '02'.                     "VISIBLE
    CALL METHOD wd_context->SET_ATTRIBUTE
      EXPORTING
        VALUE = lv_projects
        NAME  = wd_assist->gc_PROJECTS.

    CALL METHOD LR_TCOPROJ->SET_VISIBLE
      EXPORTING
        VALUE = lv_projects.
  endif.

Regards,

Lekha.

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

->Bind the Visible property of Container 2 and Container3 with two context Attribute of type Wdui_visibility.

-> Now according to values in First drop down, set the visiblity property of Container 2 or 3.

-> For making Visible , set the context attribute value as 02.

-> You can do set the attribute using Code wizard ( control + F7).

Thanx.

former_member402443
Contributor
0 Kudos

Hi Kumar,

For this you have to create 2 attribute in your context of type WDUI_VISIBILITY and map them to the visible property of both the container in your view.

After that based on some condition on an action you can set the value of visibility attribute to '02'.

For example:

Suppose

DATA lo_el_context TYPE REF TO if_wd_context_element.

DATA ls_context TYPE wd_this->element_context.

DATA lv_visible LIKE ls_context-visible.

if lt_data[] is not initial. "Based on some condition

lv_visible = '02'.

lo_el_context->set_attribute(

EXPORTING

name = `VISIBLE`

value = lv_visible ).

endif.

Hopes this will helps you.

Regard

Manoj Kumar