2007 Mar 28 9:39 AM
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
2007 Mar 28 9:45 AM
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
2007 Mar 28 9:45 AM
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
2007 Mar 28 9:53 AM
Hi Siri,
thanks for your answer. just one question, maybe i don t get it right now:
datatype of ls_exclude, pt_exclude?
2007 Mar 28 9:58 AM
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.
2007 Mar 28 9:59 AM
big thx uwe. but i thought you are busy. so you should better work than post here
2007 Mar 28 9:48 AM
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