Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make Authority Check for ALVGrid?!

Former Member
0 Kudos

Hey mates,

i got the problem which is mentioned in the headline. How can i make an authority check for my ALVGrid? I mean i want to restrict special functions to the matching users ( Display, Edit, Delete mode ).

Would be cool if someone can help

Regards Basti

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Basti,

I think you can disable some buttons for the particular users.

First check the login user whether he is permitted or not then based on

condition we can excluse or disable the functions.

If sy-uname = 'SNAME'.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.

append ls_exclude to pt_exclude.

endif.

Hope this will help you.

Thanks & Regards,

Siri

5 REPLIES 5

Former Member
0 Kudos

Hi Basti,

I think you can disable some buttons for the particular users.

First check the login user whether he is permitted or not then based on

condition we can excluse or disable the functions.

If sy-uname = 'SNAME'.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.

append ls_exclude to pt_exclude.

endif.

Hope this will help you.

Thanks & Regards,

Siri

0 Kudos

Hi Siri,

thanks for your answer. just one question, maybe i don t get it right now:

datatype of ls_exclude, pt_exclude?

0 Kudos

Please declare them like below:

data : ls_exclude type ui_func,

pt_exclude type ui_functions.

Then just pass to the method.

call method g_grid->set_table_for_first_display

exporting it_toolbar_excluding = pt_exclude

changing it_fieldcatalog = pt_fieldcat

it_outtab = pt_outtab.

hope this will help you.

Thanks & Regards,

Siri.

0 Kudos

big thx uwe. but i thought you are busy. so you should better work than post here

uwe_schieferstein
Active Contributor
0 Kudos

Hello Bastian

A simple approach would be to define three different transactions (e.g. Z_MYALV01, Z_MYALV02, Z_MYALV03) for editing/deleting, editing only and displaying only. Add the following coding to the report displaying your ALV grid:

  CASE syst-tcode.
    WHEN gc_tcode_create.    " 01
      " Allow all grid functions
 
    WHEN gc_tcode_change.  " 02
      " Suppress grid functions for deleting rows

    WHEN gc_tcode_display.  " 03
      " Suppress grid functions for editing/deleting

    WHEN others.
      RETURN.
   ENDCASE.

Regards

Uwe