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

log on into the function module with different user name.

Former Member
0 Likes
2,442

hi,

i log on into the system with my user id suppose 'mukka' and i have to check the authorization of another user say 'you' using the function module "authority_check_tcode". but here i am getting the problem that when i assigned sy-uname to 'you' and execute the function module it is entering into the function module with 'mukka' user name only.

sample code:-

sy-uname = p_uname.

CALL FUNCTION 'AUTHORITY_CHECK_TCODE' "#EC"

EXPORTING

tcode = v_tcode

EXCEPTIONS

ok = 1

not_ok = 2.

when i am changing the sy-uname with p_uname the sy-uname is changed but when i entered into the function module authority_check_tcode in the debugging mode at the below the sy-uname variable is showing as 'mukka' only. but i need to check the authorizations of user 'you' pls give me solution to my problem.

5 REPLIES 5
Read only

Former Member
0 Likes
1,407

Hi,

Why would you want to check the authorisation of another user and not the one currently logged in? The idea of authorisations is to check the current user is able to perform a certain activity. The majority of fields on SYST are constantly updated to have the correct values (partly so you can't fiddel authorisation checks like this

Maybe if you explain to us what you are trying to do we can offer some other help.

Gareth.

Read only

0 Likes
1,407

hi,

i am developing one basis tool. in that one i have to validate the transaction codes assigned to particular user. so that i need this check.

Read only

Former Member
0 Likes
1,407

This is because the system variables store the current values at any point of time and change on execution of every statement.

Here when you change the sy-uname, it will change for that step only, once the statement call function is executed the variable will be re-initialised to the logged in user name.

Hope it helps.

Lokesh

Read only

0 Likes
1,407

hi,

thank you for your answer. but in 5.0 version this same code is working fine when we execute the program directly with out enter in to the debugging mode. and checks the authorization of transaction codes to the different users. but when i tried in debugging mode it is not giving the same result.

Read only

Former Member
0 Likes
1,407

Hi Mukka,

You cant change system variables with such values.

Instead use a local variable & pass the data to the FM with local variable.

Best regards,

Prashant