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: 

issue reg running a program

Former Member
0 Kudos

have created an object class using su21,

then by double clickingit i have created an auth object,with auth field actvt and werks and permitted values as all.

then i went to pfcg, i created a role and then a profile,then i clicked change auth data -then i selected do not select templates and then i added manually my auth object , i have given a plant and actvt as full auth

and generated a profile and then in the user tab i gave my userid, and i comapree it

everything looks in green

now i called the authcheck in my as

AUTHORITY-CHECK OBJECT 'ZFT'

ID 'ACTVT' FIELD '02'

ID 'WERKS' FIELD 'ABC'.

if sy-subrc eq 0.

write : SY-UNAME , 'Suceess ZFT'.

else.

write:/ SY-UNAME , 'Fail ZFT'.

endif.

Q1) DOES IT CHECK WITH SY-UNAME

I HAVE AUTH TO ME WHEN I RUN THE PRGM UNDER MY LOGIN I GET SUCESS (SY-SUBRC EQ 0)

Q2)WHEN I RUN THE SAME UNDER A DIFFERENT LOGIN THE O/P IS FAIL ZFT

SO FAR ITS WORKING FINE BUT FOR THIS CONDITION I AM GETTING A SY-SUBRC OF 12 WHICH SHOULD BE 4 AS PER THE HELP DOCUMENT

· 0: The user has an authorization for all specified values.

· 4: The user does not have the authorization.

· 8: The number of specified fields is incorrect.

· 12: The specified authorization object does not exist.

DO LET ME KNOW IF IAM MISSING ANYTHING.

Q3) INSTEAD OF THIS CAN I USE S_PROGRAM. LET ME KNOW WHAT EXACTLY IT DOES.

THANKS

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

If sy-subrc has value 12 it means the user hasn't that authorization object, if it's 4, it means the user has the aut object but he hasn't the authorization.

So if in my profile there's the object 'ZFT', if I've the authorizazion for plant ABC, sy-subrc'll be 0 else 4.

If in my profile there isn't the object 'ZFT', sy-subrc'll be 12.

Max

1 REPLY 1

Former Member
0 Kudos

Hi

If sy-subrc has value 12 it means the user hasn't that authorization object, if it's 4, it means the user has the aut object but he hasn't the authorization.

So if in my profile there's the object 'ZFT', if I've the authorizazion for plant ABC, sy-subrc'll be 0 else 4.

If in my profile there isn't the object 'ZFT', sy-subrc'll be 12.

Max