Application Development 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: 

Transaction codes executable for user

Former Member
0 Kudos

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?

8 REPLIES 8

former_member194669
Active Contributor
0 Kudos

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.

former_member195698
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try these FM.

AUTHORITY_CHECK_TCODE

AUTH_CHECK_TCODE

SUSR_AUTHORITY_CHECK_S_TCODE

Also check standard program RSUSR002.

Regards,

Ferry Lianto

Former Member
0 Kudos

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.

0 Kudos

The answer provided by Abhishek Jolly looks correct to me. Does it not work for you?

Rob

0 Kudos

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

Former Member
0 Kudos

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