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

authorization to custom t code

Former Member
0 Likes
856

Hi all,

I HAVE A MODULE POOL PROGRAM AND I NEED TO PROVIDE AUTHORIZATION TO ACCESS THE THE Z TCODE FOR THAT MODULE POOL.

I have to write code checking sy-uname or is there any other way that can be used to provide access.

Thanks

swathi

6 REPLIES 6
Read only

Former Member
0 Likes
739

Hi Swathi,

You have to write a code in your program or you can request your basis/security team to provide the access for the Z Tcode to whom ever required.

If you are writing the code, check this:

w_repid = sy-repid.

  • Authorization check

AUTHORITY-CHECK OBJECT 'Authobj name'

ID 'ACTVT' FIELD '16' " Execute

ID 'REPID' FIELD w_repid " Program Name

ID 'WERKS' DUMMY " Dummy

ID 'BUKRS' DUMMY. " Dummy

IF sy-subrc <> 0.

MESSAGE e278(rt).

ENDIF.

Shylesh

Read only

Former Member
0 Likes
739

For new transaction you do not have to develop any checks in your program (if you want to check access rights for that transaction code only), just update your auth. profiles for object S_TCODE.

Read only

Former Member
0 Likes
739

Hi Swathi,

you can use the following code:

AUTHORITY-CHECK OBJECT 'ZTCODE'

ID 'ACTVT' FIELD '16'

ID 'TCODE' FIELD <Transcation code for report/program>

Regards

Shiva

Read only

0 Likes
739

Hi ,

THANKS FOR YOUR REPLIES .

CAN ANYONE BE MORE CLEAR .

IF I HAVE USER XYZ THEN WHERE SHOULD I GIVE XYZ IN ORDER TO HAVE ACCESS FOR XYZ IN THE FOLLOWING CODE

AUTHORITY-CHECK OBJECT 'ZTCODE'

ID 'ACTVT' FIELD '16'

ID 'TCODE' FIELD <Transcation code for report/program>

THANKS

SWATHI

Read only

0 Likes
739

Swathi,

You can maintain profiles via for example PFCG, reports are available in SUIM. If it is a new transaction, you do not have to develop any checks in your program. System will check automatically access rights using object S_TCODE. Your user must have in its profile this object and your transaction code.

Read only

Former Member
0 Likes
739

Hi Swati,

Basis/Security team (depends on your organisation) creates an object and assigns to the profile of the user 'XYZ' thru txn PFCG.

Just put similar piece of code in your module pool :

AUTHORITY-CHECK OBJECT 'ZOBJECT' "Object

ID 'TCODE' FIELD 'ZTCODE' "Your tcode

ID 'ACTVT' FIELD '16'. "Activity

IF SY-SUBRC NE 0.

MESSAGE E001 with 'User does not have

authorisation'.

ENDIF.

Cheers,

Vikram

Pls reward for helpful replies!!!