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

authority-check for Transaction

Former Member
0 Likes
15,532

Hi all,

I have created custom transaction, in that depending on authorization i am calling two different FMs.For that i have created two users both are having acces for the transaction.But one is having display and other change authorization. In the program i am writing following code:

<b>AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD' FIELD 'ZG'.

ID 'ACTVT' FIELD '02'.

IF sy-subrc = 0.

Displaying 1st FM

else.

Displaying 2nd FM

endif.</b>

TCD value is maintained at table level but ACTVT is not maintained.

Is this a right code.

Regards,

Nilesh

4 REPLIES 4
Read only

Former Member
0 Likes
5,634

Hi,

there is no ACTVT in this object.

It's used like this.

AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD' FIELD '__________'.

Look via SU21 and Class AAAB or via doubleclick on S_TCODE in abap.

Regards, Dieter

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
5,634

Hi Nilesh i think u shud use the Tcode SU24.

Here are the steps:

1. Go to transaction SU24.

2. In the t-code give ZTCODE & press execute button.

3. Then press the Change 'Check Indicator'

4. There you can maintain the ACTVT for ur T-Code against the TCD value.

Please award points if u find this helpful.

Suhas

Read only

Former Member
0 Likes
5,634

Thank you Suhas for your reply.

I checked SU24 but no values are maintained for ACTVT. but there is another object S_TABU_DIS related with ACTVT , then what should be the nature of my code :

AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD' FIELD c_tcode.

ID 'ACTVT' FIELD '02'.

IF sy-subrc = 0.

end if.

Is this right.

Regards

Nilesh

Read only

Former Member
0 Likes
5,634

The authorisation object S_TCODE does not work in the way you are trying to use it. S_TCODE is checked automatically when any transaction is called and has a simple yes or no result, either user can or cannot run the transaction.

If your transaction has a display and change option you will need to create a new authorisation object (transaction SU21) with field ACTVT and code this check into your program. Then give each user the relevant value in their authorisation role.

Alternatively you could create two transactions, one change and one display, then you can use S_TCODE.

Regards,

Nick