Skip to Content
avatar image
Former Member

Hiding fields in Webdynpro

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    May 23, 2014 at 02:47 AM

    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

    How to Hide UI Elements & Adjust View Layout Dynamically in Web Dynpro ABAP

    Hope this helps you.

    Regards,

    Rama

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 26, 2014 at 04:44 AM

    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

    Add comment
    10|10000 characters needed characters exceeded