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

User Authorization to a specific transaction

Former Member
0 Likes
1,276

Hi All,

I want to check programmatically whether a specific user has authorization to a specific transaction. The statement AUTHORITY-CHECK OBJECT 'S_TCODE' works only for the current user.

Is there any function module where i can pass the User name and transaction and check whether the user have access to the transaction ?

Thanks in advance

Kasi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,142

The program checks whether an authorization object is assigned to the transaction code. If this is the case, the program checks whether the user has an authorization for this authorization object. The transaction code/authorization object assignment is stored in table TSTCA.

The system performs authorization checks in the ABAP program using the ABAP statement AUTHORITY-CHECK.

Call 'AUTHORITY_CHECK'

EXPORTING

USER = <USER>

OBJECT = 'S_TCODE'

FIELD1 = 'TCD'

VALUE1 = <TRANSACTION CODE>

IMPORTING

SY-SUBRC = <VAL>.

Hi All,

I want to check programmatically whether a specific user has authorization to a specific transaction. The statement AUTHORITY-CHECK OBJECT 'S_TCODE' works only for the current user.

Is there any function module where i can pass the User name and transaction and check whether the user have access to the transaction ?

Thanks in advance

Kasi

6 REPLIES 6
Read only

Former Member
0 Likes
1,142

Hi,

you can use the additional

... FOR USER user

option with

AUTHORITY-CHECK OBJECT

Read only

Former Member
0 Likes
1,142

hi,

UST04 table can used to get the list of users for specific authorization.

Read only

Former Member
0 Likes
1,143

The program checks whether an authorization object is assigned to the transaction code. If this is the case, the program checks whether the user has an authorization for this authorization object. The transaction code/authorization object assignment is stored in table TSTCA.

The system performs authorization checks in the ABAP program using the ABAP statement AUTHORITY-CHECK.

Call 'AUTHORITY_CHECK'

EXPORTING

USER = <USER>

OBJECT = 'S_TCODE'

FIELD1 = 'TCD'

VALUE1 = <TRANSACTION CODE>

IMPORTING

SY-SUBRC = <VAL>.

Read only

Former Member
0 Likes
1,142

check this thread

Read only

Former Member
0 Likes
1,142

Hi,

try this short report:


SELECT * FROM USR01.
*
  CALL FUNCTION 'AUTHORITY_CHECK'
    EXPORTING
      USER                = USR01-BNAME
      OBJECT              = 'S_TCODE'
      FIELD1              = 'TCD'
      VALUE1              = 'FB01'
    EXCEPTIONS
      USER_DONT_EXIST     = 1
      USER_IS_AUTHORIZED  = 2
      USER_NOT_AUTHORIZED = 3
      USER_IS_LOCKED      = 4
      OTHERS              = 5.
*
  WRITE: / USR01-BNAME.
*
  CASE SY-SUBRC.
    WHEN 2.      WRITE: 'USER_IS_AUTHORIZED'.
    WHEN 3.      WRITE: 'USER_NOT_AUTHORIZED'.
    WHEN OTHERS. WRITE: 'ERROR', SY-SUBRC.
  ENDCASE.
*
ENDSELECT.

regards, Dieter

Read only

Former Member
0 Likes
1,142

Thanks a lot guys

Cheers,

Kasi