Application Development and Automation 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: 
Read only

AUTHORITY-CHECK for other user

Former Member
0 Likes
11,098

Hi,

I would need to run an AUTHORITY-CHECK on a certain authority object, but I have to run the AUTHORITY-CHECK not for the currently logged in user, but for a different sap userId. How can I do this?

AUTHORITY-CHECK does not allow you to supply a userId as parameter. Changing sy-uname is probably not possible, and even if it was, this solution would just be too stupid and ugly for me to even try. There must be some simpler/better solution?

The Business Case for this is very simple: In my dialog program the currently logged in user is presented with a form to enter a SAP-userId, and attach a document. The user should only be allowed to post this form, if the supplied userId is authorized to receive this kind of document.

Thanks for any help in advance,

-Hans

1 ACCEPTED SOLUTION
Read only

Former Member
4,957

Hans,

You can use the function module 'authority_check' to check whether a specific user has authorization for the required authorization object.

Thanks

Giridhar

7 REPLIES 7
Read only

former_member517
Participant
0 Likes
4,957

Hi Hans,

I think there are little chances to switch the user context. The only solution I see, is based on batch jobs, which you could run under a different user. But this contradicts a dialog application.

Best regards

Rabanus

Read only

0 Likes
4,957

Hi Hans,

You can do the posting part in RFC. In the RFC you can pass the user id and checks and all will be executed for that user with which RFC is being accessed.

Thanks,

Anuranjan

Read only

0 Likes
4,957

Hi Hans!

Sounds like an own authority-check (is there a standard transaction where you can enter the user-id?). Why don't you just add user-id as a field in the authority object?

The test would be, if your user is allowed to send to this user-id, so maintenance might be a little strange.

If it's really own development, then your check is not necessarily going for authority: you might test for a 'customizing' entry in an own table.

Regards,

Christian

Read only

FredericGirod
Active Contributor
0 Likes
4,957

Hi Hans,

have a look to this function : SUSR_USER_AUTH_FOR_OBJ_GET

Regards

Frédéric

Read only

ramki_maley
Active Contributor
0 Likes
4,957

Hans,

Please follow the link below to see my answer for an earlier post on the same subject.

Cheers,

Ramki Maley.

Read only

Former Member
4,958

Hans,

You can use the function module 'authority_check' to check whether a specific user has authorization for the required authorization object.

Thanks

Giridhar

Read only

Former Member
0 Likes
4,957

Hi,

Thanks a lot for all your replies. The FM authority_check seems to be the way to go

-Hans