on 01-02-2014 10:47 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.