08-22-2007 8:19 AM
Hey Guys,
I have a little authorization problem...
I created a role with authorizationobject P_PCR.
Payroll Area B8
Activity Change
In my program i have following code to check authorization :
GET pernr.
AUTHORITY-CHECK OBJECT 'P_PCR'
ID 'ABKRS' FIELD pernr-abkrs
ID 'ACTVT' FIELD '02'.
IF sy-subrc NE 0.
REJECT.
ENDIF.
* further processing..
Everytime i execute this code, sy-subrc eq 4... :(.
When i look into SU53 :
The authorization check failed
Authorization obj. <i>P_PCR</i> HR: Payroll Control Record
Object Class <i>HR</i> Human Resources
B8
Activity 02
My user is added to the role, so i don't see anymore why i can't execute this report ... Does anyone has an idea for me ?
Thanks,
Kind Regards,
Tom
08-22-2007 9:03 AM
Hi Tom,
It seems that - under the GET PERNR, it is fetching multiple records, you have the change authority for Payroll Accounting Areas = B8.
But during the execution of this block of code if the value of PERNR-ABKRS is anything other than B8, you will end up with sy-subrc 4.Just make sure that your program is designed to fetch the records related to Payroll Area B8 only.
08-22-2007 9:03 AM
Hi Tom,
It seems that - under the GET PERNR, it is fetching multiple records, you have the change authority for Payroll Accounting Areas = B8.
But during the execution of this block of code if the value of PERNR-ABKRS is anything other than B8, you will end up with sy-subrc 4.Just make sure that your program is designed to fetch the records related to Payroll Area B8 only.
08-22-2007 9:10 AM
Hi SKC,
Thanks for your reply. That's idd a good point, but in my selection screen i enter that i only wanne treat records with ABKRS eq 'B8'.
But also, records with ABKRS eq 'B8', will result in an sy-subrc = 4 ...
Tom
08-22-2007 9:20 AM
Bon... Found the error...
AUTHORITY-CHECK OBJECT 'P_PCR'
ID 'ABKRS' FIELD pernr-abkrs
ID 'ACTVT' FIELD '02'.
IF sy-subrc NE 0.
REJECT.
ENDIF.
In object P_PCR the field is not AB<b>KR</b>S, but the field is AB<b>RK</b>S.
So, problem solved...
Greetz,
Tom