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: 

Authorization issue

marcela_martinez
Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member589029
Active Contributor
0 Kudos

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

2 REPLIES 2

former_member589029
Active Contributor
0 Kudos

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

0 Kudos

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.