2007 Oct 17 7:52 PM
Hi
I want a function module which says whether a user acess to particular transaction code.
I am using this FM, but it says the user has authorization to a particular transaction code although he/she is not having access to that transaction
SUSR_AUTHORITY_CHECK_SIMULATE
CALL FUNCTION 'SUSR_AUTHORITY_CHECK_SIMULATE'
EXPORTING
user_name = usr21-bname
object = 'S_TCODE'
field1 = 'TCD'
val1 = lv_tcode_val ( transaction is ME21N)
IMPORTING
sy_subrc = lv_rc
EXCEPTIONS
not_authorized = 1
user_not_exists = 2
internal_error = 3
OTHERS = 4.
can anybody tell how to handle this situation?
2007 Oct 17 8:23 PM
Hi,
Instead of use this
AUTHORITY-CHECK OBJECT 'S_TCODE'
ID 'TCD' FIELD c_tcode. " << your T Code
ID 'ACTVT' FIELD '02'.
IF sy-subrc = 0.
end if.
a®
2007 Oct 17 9:06 PM
Try using the FM SUSR_GET_TCODES_WITH_AUTH
You can pass the User Id in the table. It will return all the User Id for which the user has the authorization. You can check the required Tcode from the table.
Regards,
Abhishek Jolly
2007 Oct 17 9:18 PM
Hi,
Try this..
call 'AUTH_CHECK_TCODE'
id 'TCODE' field 'ZTEST1'. " Pass your t code here..instead of ZTEST1
If sy-subrc <> 0.
Message e208(00) WITH 'Error'.
endif.
Thanks
Naren
2007 Oct 17 9:42 PM
Hi,
Please try these FM.
AUTHORITY_CHECK_TCODE
AUTH_CHECK_TCODE
SUSR_AUTHORITY_CHECK_S_TCODE
Also check standard program RSUSR002.
Regards,
Ferry Lianto
2007 Oct 18 8:38 PM
Hello Folks,
To be precise my requirement is when creating a PO i am maintaining some field value which is "SAP Userid" and I have to check the whether that Userid is having authorization to a particular transaction or not and not for the userid id with which the PO is getting created.
Hope I am clear.
Thanks,
Krishna.
2007 Oct 18 8:55 PM
The answer provided by Abhishek Jolly looks correct to me. Does it not work for you?
Rob
2007 Oct 19 2:55 AM
Hello Folks,
Thank you all for your answers.... I got it.
Actually I copied that code from 4.6c to 4.7 and making some changes.
The function module which I am using is
'SUSR_AUTHORITY_CHECK_SIMULATE' and in 4.7 SAP has given additional exporting parameter which is missing in 4.6c
The parameter is "dummies" and you have pass "0000" to it and it works as expected.
I got the info from OSS notes.
Thankyou all for your time.
Thanks,
Krishna
2007 Oct 18 8:55 PM
Hi,
DID you try..this is what standard sap checks..when you enter a transaction code in the command field..
call 'AUTH_CHECK_TCODE'
id 'TCODE' field 'ZTEST1'. " Pass your t code here..instead of ZTEST1
If sy-subrc <> 0.
Message e208(00) WITH 'Error'.
endif
Thanks
Naren