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

FUnction module to check authorization

Former Member
10,552

HI,

PLease suggest me any function module whihc will check the user's authorization against a T_code (Ex: VA02).

It will be appriciated if, usage direction are suggested.

Thanks,

Jaleel.

1 ACCEPTED SOLUTION
Read only

Former Member
4,926

<b>You can do it without Function using AUTHORITY-CHECK</b>Syntax

AUTHORITY-CHECK OBJECT <object> ID <name1> FIELD <f1>

ID <name2> FIELD <f2>

...

ID <name10> FIELD <f10>.

There is a check if the program user has all the authorizations defined in authorization object <object>. <name1>,..., <name10> are the authorization fields of the authorization object. <f1>,... <f1>, ..., <f10> are data objects of the program. The value of the data objects is checked against the authorization fields.

FM: AUTHORITY_CHECK_RFC for Authorization check

If the RFC communication takes place in one system in the same user context - that is, using the same client and user ID - the system does not carry out an RFC authority check. For more information on this topic, see

SXPG_COMMAND_EXECUTE: Check Authorization for and Execute an External Command

Regards,

Vishal

6 REPLIES 6
Read only

Former Member
0 Likes
4,926

hi..

Just execute transaction VA02 for user. Afterwards call transaction SU53 and you will get an overview of all missing authorizations.

thanks

Ashu

Read only

Former Member
0 Likes
4,926

HI Ashu,

Thanks for the responce. I need to check this programatically.

Check if user is auth to execute VA02.

If yes. call Transaction VA02.

Else. Call transaction VA03.

HOpe this gives u clear idea.

Please suggest.

Read only

0 Likes
4,926

hi..

this u can write by using the if condition na...using sy-subrc first check and then u can use the if condition..am not that much clear. anyway u please try..

Thanks

Ashu

Read only

0 Likes
4,926

AUTHORITY_CHECK_TCODE

Read only

Former Member
4,927

<b>You can do it without Function using AUTHORITY-CHECK</b>Syntax

AUTHORITY-CHECK OBJECT <object> ID <name1> FIELD <f1>

ID <name2> FIELD <f2>

...

ID <name10> FIELD <f10>.

There is a check if the program user has all the authorizations defined in authorization object <object>. <name1>,..., <name10> are the authorization fields of the authorization object. <f1>,... <f1>, ..., <f10> are data objects of the program. The value of the data objects is checked against the authorization fields.

FM: AUTHORITY_CHECK_RFC for Authorization check

If the RFC communication takes place in one system in the same user context - that is, using the same client and user ID - the system does not carry out an RFC authority check. For more information on this topic, see

SXPG_COMMAND_EXECUTE: Check Authorization for and Execute an External Command

Regards,

Vishal

Read only

Former Member
4,926

Hi,

You can use function module AUTHORITY_CHECK_TCODE for this. Some thing like,

CALL FUNCTION 'AUTHORITY_CHECK_TCODE'

EXPORTING

TCODE = <Your Tcode here>

EXCEPTIONS

OK = 0

NOT_OK = 1

OTHERS = 2.

IF sy-subrc <> 0.

****No Authorization

ENDIF.

Hope this helps..

Regards