Skip to Content

How to collectively set visible condition for 50 fields in ABAP Webdynpro

i have 50 fields for which i want to check a value in table and set their visibility.I want to do it WITHOUT creating an attribute of type boolean in node and then binding the Visible property to it.if there is any other solution please suggest.

/Vimal

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 02, 2014 at 11:16 AM

    Hi,

    You can avoid creating extra attribute using set_attribute_property( ) method of context element, but you must bind the visibility property.

    Bind the visibility property to the same attribute to which the value is bound and the use method

        lo_el_context->set_attribute_property(

             attribute_name = 'VAL'     " VAL is the attribute name

             property       = lo_el_context->e_property-visible

             value          = abap_false ).  " make it true or false based on the data check


    You can check this document for reference to bind the property: http://scn.sap.com/docs/DOC-27125


    Or, you must do a dynamic UI element manipulation in WDDOMODIFYVIEW method


    Hope this helps u,


    Regards,

    Kiran

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 02, 2014 at 11:17 AM

    Hi Vimal,

    I understand that you want to do it without using Visibility property binding, but if you go by that way then you will need to create only one attribute in Context and bind all the values with it. Then based on your table value, all the fields can be simultaneously made visible/hidden by just changing that one attribute.

    Regards,

    Harsh bansal

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 02, 2014 at 11:21 AM

    Hi Vimal,

    You can set the visibility property of view ui elements using method SET_VISIBLE( ).

    Make sure that the name of view ui elements and fields in your internal table are same.

    Let us say, your internal table LT_DATA is having columns FIELD_NAME & VIS_VALUE

    You can achieve your requirement as below

    •      let us assume, your internal table has the data as  below

                

    FIELD_NAME VIS_VALUE EMPLOYEE_ID X FIRST_NAME X LAST_NAME

    ie. employee_id & first_name elements will be visible and last_name will be hidden

    • Write the below code in WDDOMODIFYVIEW( ) method

    DATA lo_ui_element TYPE REF TO cl_wd_uielement.

    loop at LT_DATA into ls_data.

         "get ui element

    lo_ui_element ?= view->get_element( id = ls_data-field_name ).

      IF lo_ui_element IS BOUND .

        lo_ui_element->set_visible( value = ls_data-vis_value ).

      ENDIF.

    endloop.

    This will set the visibility property of view ui elements as per your requirement.

    Hope this resolves your issue.

    Regards,

    Rama

    Add comment
    10|10000 characters needed characters exceeded