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: 

Role/Auth Check in a Program

Former Member
0 Kudos

All,

i have a Z prgm(dialog),have X users..Ecryone have access to T-code which runs this prgm..but when usr 1 runs he should have full access(edit/upload/download etc)..other user(no.2) only should be able to Edit some fields...i thought i can do this by Checking The Roles of Both Users..and using the following code..

i Looked at T-code Found Roles Associated with it..

Say 'YYYY'.

then looking for users who has that role..

SELECT * FROM AGR_USERS

  • INTO TABLE T_ROLES

  • WHERE UNAME = SYST-UNAME.

  • IF NOT T_ROLES[] IS INITIAL.

  • SORT T_ROLES.

  • READ TABLE T_ROLES WITH KEY AGR_NAME = C-YYYY IF SYST-SUBRC <> 0.

  • LOOP AT SCREEN.

  • IF SCREEN-NAME = 'XXXX'.

  • SCREEN-INPUT = '0'.

  • MODIFY SCREEN.

  • ENDIF.

  • ENDLOOP.

  • ENDIF.

  • ENDIF.

Problem with above code is...It explicitly looking for the role(say YYYY),But Most users have access to this T-code,Have a diffrent role?????I do not know how roles work..Is there a another way to do this??

thanks for any Input...

Regards..

Siva.

2 REPLIES 2

Former Member
0 Kudos

I think you need to create your own authorization object and check for the values of the authorization object in your program(PBO), and decide based on that. Assign the authorization object to all the roles that have this tcode assigned but use different values for user 1 vs. user 2.

Srinivas

Former Member
0 Kudos

Hi,

I think u have to create a new authorization object and in that assign the activity type ( 01 = Create, 02 = Change, 03= Display ) to the users that are involved. Use this object in statement AUTHORIY-CHECK and depending on the results disable/enable the functionalities.