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

Fetching roles from the table

Former Member
0 Likes
446

Hi all,

I am working on an issue ... where I have to restrict a user to execute a set of code based on his role, so basically what I need to look out for the role of user from table agr_users... and if the user falls in a particular role ..let's say ztest_role then he shouldn't have the right to execute the code and should exit out but otherwise he should be able to do that.

Can you please help me with this.

Thanks,

Rajeev

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
411

Hello Rajeev

Normally you would check the authorization for an AUTH object contained within this z-role.

However, if you want to particularly check for a role assignment you could use

BAPI_USER_GET_DETAIL

to read the role assignment.

In order to implement this in a more general way you may create a function module or class containing a method where the interface looks like this:

ID_ROLE (IMPORTING parameter)
RD_SUBRC (RETURNING parameter) or raise an exception

Within the fm or method you call the BAPI and check for the required role assigment.

Regards

Uwe

Hello Rajeev

Normally you would check the authorization for an AUTH object contained within this z-role.

However, if you want to particularly check for a role assignment you could use

BAPI_USER_GET_DETAIL

to read the role assignment.

In order to implement this in a more general way you may create a function module or class containing a method where the interface looks like this:

ID_ROLE (IMPORTING parameter)
RD_SUBRC (RETURNING parameter) or raise an exception

Within the fm or method you call the BAPI and check for the required role assigment.

Regards

Uwe

1 REPLY 1
Read only

uwe_schieferstein
Active Contributor
0 Likes
412

Hello Rajeev

Normally you would check the authorization for an AUTH object contained within this z-role.

However, if you want to particularly check for a role assignment you could use

BAPI_USER_GET_DETAIL

to read the role assignment.

In order to implement this in a more general way you may create a function module or class containing a method where the interface looks like this:

ID_ROLE (IMPORTING parameter)
RD_SUBRC (RETURNING parameter) or raise an exception

Within the fm or method you call the BAPI and check for the required role assigment.

Regards

Uwe