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: 

AUTHORITY CHECK Always subrc 0

AJeB
Participant
0 Kudos
451

why the authority check is not working properly it is always subrc 0
in PFCG->Change authorization data . i changed the field value of WERKS to PLANT5 and PLANT6 only and the ACTVT value display,create,change are ticked

the authority check i inserted in my program should be sy-subrc=4 but why the AUTH is returning sy-subrc = 0
i also run the tcode st01 but the RC is also 0

      AUTHORITY-CHECK OBJECT 'M_MSEG_LGO'
FOR USER sy-uname
ID 'WERKS' FIELD 'PLANT1'
ID 'ACTVT' FIELD '03'.
IF sy-subrc NE 0.
write 'no auth'.
else.
write: 'success'.
ENDIF.
7 REPLIES 7

jens_michaelsen
Participant
397

Maybe the current user has the profile 'SAP_ALL'?

AJeB
Participant
0 Kudos
397

AJeB
Participant
0 Kudos
397

but why my custom Authorization Object is Working fine the user profile has SAP_ALL?

the name of my custom Auth object starts with Z = Z_MSEG_LGO

raymond_giuseppi
Active Contributor
0 Kudos
397

Use the SU53 transaction, it displays authorization failures but also successes and therefore profiles/roles containing the requested authorization.

0 Kudos
397

it is always successful

0 Kudos
397

So you can find the profile/role in SU53 successes in green/yellow (in, your case profile SAP_ALL)

Also read Authorization Profile SAP_ALL

Sandra_Rossi
Active Contributor
0 Kudos
397

User has authorization profile "SAP_ALL" means user has "all authorizations".

I hope you understand now.