Skip to Content
avatar image
Former Member

Making attribute invisible

Dear Experts,

Problem : I am trying to make an attribute invisible through code.But its not getting invisible.

I created an attribute in view context and binded this attribute to an input field in view and then in the wddoinit method i wrote the following code to make it invisible but its not working....

DATA lo_el_vis TYPE ref to if_wd_context_element.

lo_el_vis = wd_context->get_element( ).

lo_el_vis->set_attribute_property(

exporting

attribute_name = 'VIS_INVISIBLE'

property = 1

value = space ).

Pls help....

Kind Regards

Sajid

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 20, 2009 at 11:39 AM

    Hi Sajid,

    I have a context node by name NODE & 2 attributes under it. One is for binding to the input field and the other attribute ( name VISIBILITY) is of type WDY_VISIBILITY. I use this attribute for controlling the visibility of my input field. I specify a default value of 2 i.e, visible for this. (Check the domain values for WDUI_VISIBILITY) Now I create a button and within this button action handler I want to toggle between the input fields visibility & invisibility statuses. Check the code snippet below.

    Regards,

    Uday

    method ONACTIONTOGGLE_VISIBILITY .
      data: wd_node type ref to if_wd_context_node,
            lv_value type wdui_visibility.
    
      wd_node = wd_context->get_child_node( name = 'NODE' ).
    
    ***  Read the current value in context attribute VISIBILITY
      wd_node->get_attribute( exporting name  = 'VISIBILITY'
                              importing value = lv_value ).
    *** Toggle between values 01 & 02 to toggle the visibile & invisible states of the inputfield
      if lv_value = '01'.
        wd_node->set_attribute( exporting name  = 'VISIBILITY'
                                          value = '02' ).
      else.
        wd_node->set_attribute( exporting name  = 'VISIBILITY'
                                          value = '01' ).
      endif.
    endmethod.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 20, 2009 at 11:30 AM

    Hi ,

    Your attribute should be type BOOLEAN or WDUI_VISIBILITY. Bind your attribute to the visible property of the of the input field and use this code.

    DATA lo_el_vis TYPE ref to if_wd_context_element.
    
    lo_el_vis = wd_context->get_element( ).
    
    lo_el_vis->set_attribute_(
    exporting
    name = 'VIS_INVISIBLE'
    value = abap_false  ).

    Hope it helps!

    Radhika.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 20, 2009 at 11:30 AM

    Hi,

    Have you created the type of attribute as WDUI_VISIBILITY.

    lv_visible = '01'.                      "InVisible   "type wdui_visibility
        CALL METHOD wd_context->SET_ATTRIBUTE
          EXPORTING
            VALUE = lv_visible
            NAME  = `VISIBLE`.

    What is your requirement.

    Regards,

    Lekha.

    Add comment
    10|10000 characters needed characters exceeded