cancel
Showing results for 
Search instead for 
Did you mean: 

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

vimal
Active Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

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_NAMEVIS_VALUE
EMPLOYEE_IDX
FIRST_NAMEX
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

Harsh_Bansal
Contributor
0 Kudos

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