Symptom
Custom logic implementation fails for SAP_WFRT user due to authorization issues.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Go to the Custom Fields and Logic app
- Create new custom logic for an implementation that will use the workflow user SAP_WFRT
- Examples are Workflow Agent Determination
- The Custom Logic will have a SELECT statement to get data from a CDS view
- Test the logic, which will be successful
- Now when the logic is actually being called (example of creating a new purchase requisition) the logic may fail
Cause
The business user testing the logic has authorization to select data from a CDS View, but the user SAP_WFRT does not have authorization.
Resolution
In this case adding 'WITH PRIVILEGED ACCESS' to the SELECT statement will allow the user SAP_WFRT to select data from CDS view.
As an example for I_ProfitCenter it would look like:
SELECT SINGLE profitctrresponsibleuser FROM I_ProfitCenter WITH PRIVILEGED ACCESS INTO CORRESPONDING FIELDS OF [ ... ]
See Also
Keywords
Custom Fields and Logic, Custom Logic CDS View, SELECT WITH PRIVILEGED ACCESS, workflow, BAdI , KBA , MM-IV-INT-WF , Workflow , BC-SRV-APS-EXT-BL , Custom Business Logic , Problem