06-02-2010 8:12 PM
Hi experts,
During a program execution I need to get al the WERKS where the user has authorization. Can you explain me if there is a table or a MF for getting this?
Thanks & kind regards.
06-02-2010 8:46 PM
Basically what you need to do is to select all existing WERKS from table T001W into an internal table and then loop at that table. For every entry do an authorization check using e.g. authorization object M_MATE_WRK.
AUTHORITY-CHECK OBJECT 'M_MATE_WRK'
ID 'ACTVT' FIELD lv_activity
ID 'WERKS' FIELD lv_werks.
where lv_activity is the activity you want to check (display(03), change(02) etc) and lv_werks the current WERKS value in the loop.
In case the user is not authorized for this WERKS just delete the entry from the internal table. After the loop the internal table will only contain the WERKS the user is authorized for.
If you are using a different authroization object to check for authorization you need to change the authority-check statement accordingly to use that object.
Hope that helps,
Michael
06-02-2010 8:46 PM
Basically what you need to do is to select all existing WERKS from table T001W into an internal table and then loop at that table. For every entry do an authorization check using e.g. authorization object M_MATE_WRK.
AUTHORITY-CHECK OBJECT 'M_MATE_WRK'
ID 'ACTVT' FIELD lv_activity
ID 'WERKS' FIELD lv_werks.
where lv_activity is the activity you want to check (display(03), change(02) etc) and lv_werks the current WERKS value in the loop.
In case the user is not authorized for this WERKS just delete the entry from the internal table. After the loop the internal table will only contain the WERKS the user is authorized for.
If you are using a different authroization object to check for authorization you need to change the authority-check statement accordingly to use that object.
Hope that helps,
Michael
06-02-2010 8:48 PM
Thanks Michael for the answer. I thougt previously in this option but I think that is another one very much direct.
Thanks again and regards.