Skip to Content

How to give Authorization?

I have created a 'Z' application which consists of create, change and display User interface.Whenever the user selects craete all fields go editable, change will have some fields editable and display all uneditable.I used only one view and i handled all three modes using invisible and enable property.

Now i want to allow only certain users to access create and change but display for all users.How to give this kind of autorization in webdynpro????

Please explain me about authorization in webdynpro taking my scenario?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Aug 02, 2010 at 10:28 AM


    I hope you are aware of authority checks in ABAP in general. In your scenario, what you can do is: create one context attribute IS_AUTHORIZED of type WDY_BOOLEAN.

    And in WDDOINIT of the component controller or view controller,

    do the authorization check using AUTHORITY-CHECK stmt and if the check fails i.e. sy-subrc is not equals to 0, then

    set the attribute IS_AUTHORIZED to false. Otherwise set it to true.

    And you have to bind the enabled property of the buttons to this context attribute IS_AUTHORIZED.

    Please refer to the following code sample:

        DATA lo_nd_selection_type TYPE REF TO if_wd_context_node.
        DATA lo_el_selection_type TYPE REF TO if_wd_context_element.
        lo_nd_selection_type = wd_context->get_child_node( name = wd_this->wdctx_flex_config ).
        lo_el_selection_type = lo_nd_selection_type->get_element( ).
      ID <name1> FIELD <f1>
      ID <name2> FIELD <f2>.
      IF sy-subrc <> 0.
    * Prohibhit the user from modifying config
          name =  `IS_AUTHORIZED`
          value = abap_false ).
          name =  `IS_AUTHORIZED`
          value = abap_true ).

    Hope this helps!



    Add comment
    10|10000 characters needed characters exceeded