cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding fields in Webdynpro

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

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

yury_sichov
Active Contributor
0 Kudos

In standard SAP application you need to make an enchancement on method WDDOMODIFYVIEW.

Answers (1)

Answers (1)

Former Member
0 Kudos

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