on 05-23-2014 12:20 AM
Hello Experts,
Could you please let me know how to hide some fields for certains users in a view in WDA. Please share you inputs on this.
Hi Radhika,
You need to maintain a custom table in which the fields to be hidden against the users is stored.
In WDA, dynamically you can fetch data from the custom table and based on the entries, you can hide the fields of the given view.
Create a custom table with fields USER_NAME, FIELDS, & other required information
" get the fields to be hidden for the user
select *
from Zcust_table
into table lt_fields
where user_name = sy-uname.
In method WDDOMODIFYVIEW( ) of view, you can hide the fields as below
data lo_uielement type ref to CL_WD_UIELEMENT.
data lo_root type ref to cl_wd_uielement_container.
lo_root ?= view->get_root_element.
loop at lt_fields into ls_fields.
lo_uielement ?= lo_root->get_child( id = ls_fields-name ).
if lo_uielement is bound.
lo_uielement->set_visible( value = cl_wd_uielement->e_visible-none ).
endif.
endloop.
Note: When you hide fields, the layout of view also need to be adjusted.
Please refer the below document, which clearly explains of how to hide fields and adjust the layout dynamically
Hope this helps you.
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 Radhika,
Adding to Rama, if it's an Custom WDP, you can also hide fields in view based on authorization object instead of maintaining entires in Z-Table.
Authorization objects will make your task easier.
Thanks
Katrice
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.