‎2007 Nov 14 10:40 AM
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.
‎2007 Nov 14 11:18 AM
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.
‎2007 Nov 14 11:39 AM
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.
‎2007 Nov 14 11:25 AM
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
‎2007 Nov 14 11:48 AM
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.
‎2007 Nov 14 11:48 AM
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