CNEX0002 - PS Authorization check ** HELP

Question: Hi All,

I am in the middle of implementing the CNEX0002 enhancements and we are running into all sorts of issues with different transactions. The documentation that SAP provides for this enhancement is not the best in the world. I am pasting some code that I put into the PRPS portion of the enhancement and was wondering if anyone could paste any of there code that they have used in any or all of the components for this enhancement.

What troubles me is that once you activate this enhancement you can really bring down the logistics module re: authorization errors or lack thereof.

You can paste your code here or email me at frankp118@yahoo.com

Regards,
Frank

clear gv_xstat.
if sap_prps-xstat is initial.
select single xstat into gv_xstat
from prps
where pspnr = sap_prps-pspnr.
if sy-subrc = 0.
sap_prps-xstat = gv_xstat.
endif.
endif.

* Check if WBS Element is Statistical
case sap_prps-xstat.
****************************
* Statistical
****************************
when 'X'.
if sap_prps-stufe = 1.
* Perform the authorisation check on Company Code.
authority-check object 'F_KNA1_BUK'
id 'BUKRS' field sap_prps-pbukr.
* Issue and Error Message and Leave Transaction
if sy-subrc ne 0.
perform s_err_message using sy-tcode.
leave program.
else.
* Display the Line
sap_x_actvt = 'X'.
endif.
* Perform the authorisation check on the Segment Profit center.
authority-check object 'C_PRPS_PRC'
id 'PRCTR' field sap_prps-prctr.
* Issue and Error Message and Leave Transaction
if sy-subrc ne 0.
perform s_err_message using sy-tcode.
leave program.
else.
* Display the Line
sap_x_actvt = 'X'.
endif.
elseif sap_prps-stufe = 2.
sap_x_actvt = 'X'.
endif.

****************************
* Non Statistical
****************************
when space.
* Level 1 WBS's
if sap_prps-stufe = 1.
* Perform Authorisation check on Company Code.
clear sap_x_actvt.
perform s_check_sec_access using sap_prps-pbukr
sap_prps-prctr
sap_prps-werks
sap_prps-pgsbr
changing gv_flag.
if gv_flag ne 'X'.
sap_x_actvt = 'X'.
else.
gv_non_stat_err = 'X'.
endif.

* If an Error happened in any of the Authorization checks, check if the
* user is a RR User if not end the process with an error message. Also
* Do not show the Level 1 WBS
if gv_non_stat_err = 'X'.
authority-check object 'S_TCODE'
id 'TCD' field 'ZCJRR'.
if sy-subrc <> 0.
perform s_err_message using sy-tcode.
leave program.
else.
export gv_non_stat_err from gv_non_stat_err to memory id
'ZZXCN1U06WBSCHECK'.
endif.
endif.

endif.

* Level 2 WBS's or also known as WBS Line Items
if sap_prps-stufe = 2.
clear gv_non_stat_err_new.
import gv_non_stat_err to gv_non_stat_err_new from memory id
'ZZXCN1U06WBSCHECK'.
if gv_non_stat_err_new = 'X'.
perform s_check_sec_access using sap_prps-pbukr
sap_prps-prctr
sap_prps-werks
sap_prps-pgsbr
changing gv_flag.
if gv_flag ne 'X'.
* Show the WBS Element Record
sap_x_actvt = 'X'.
else.
* Dont show the WBS
clear sap_x_actvt.
endif.
else.
sap_x_actvt = 'X'.
endif.
endif.
endcase.

* Gray out the WBS Element Number on the Screen
if sy-tcode = 'CJ02' and
sap_actvt = '45'.
sap_x_actvt = space.
endif.

Answer:
At quick glance, it appears you may always get an error on your authorization check with an obscure error code. the feed tot he authority-check is not complete and may cause errors on the check regardless of the user's access.

Authorization object 'F_KNA1_BUK' has two fields, not one. the other field is ACTVT. SAP generally requires both field to be sent even it one is <dummy>. (see ABAP F1 help on authority-check). If you feed the dummy and not a specific activity ( which appears to be in the code '45' which has a value in the PS_ACTVT field and is not the same as the ACTVT 45) . IF the is correct you will have to add the "blank" activity to the possible values in order to select ONLY the blank. if not you have to supply an asterisk or let PFCG put it in the authorization by leaving the light yellow and generate the role.
_________________
John A. Jarboe

Answer:
This is duplicated in the ABAP forum
_________________
Kind Regards

Rosie Brent

Please remember to search the forum and check the FAQ before posting questions, thank you.

Tuly Idiot most of the time, part-time Guru
Copyright ?2007 - 2008 www.jt77.com