Friday, 9 June 2017

Writing DCLs on Union Views in CDS – Part 2

Continuing from “Writing DCLs on Union Views in CDS – Part 1” ,

Now , let’s try giving no authorization to display Refregirator products under this role .

SAP ABAP CDS, SAP ABAP DCL, ABAP Tutorials
2. Let’s create DCL ( Access Control ) on the union view :

CASE 1 : AND condition with aspect_pfcg statements in DCL

SAP ABAP CDS, SAP ABAP DCL, ABAP Tutorials

Let’s execute the union view and see the result :

SAP ABAP CDS, SAP ABAP DCL, ABAP Tutorials

RESULT : Since, Refregirator view did not pass through authorization, none of the other product records are displayed too. 

This is not what we wanted.

CASE 2 : OR condition with aspect_pfcg statements in DCL

SAP ABAP CDS, SAP ABAP DCL, ABAP Tutorials

Let’s execute the union view and see the result :

SAP ABAP CDS, SAP ABAP DCL, ABAP Tutorials

RESULT : Since Other product views passed the authorization, even refregirator product records are visible to user due to OR condition. 

This is not what we wanted .

CASE 3 (Solution) : Multiple grant select statements with where condition in a DCL

SAP ABAP CDS, SAP ABAP DCL, ABAP Tutorials

Here multiple grant select statements are written on same view . See the difference from above cases. 

Let’s execute the union view and see the result :

SAP ABAP CDS, SAP ABAP DCL, ABAP Tutorials

RESULT :

The refregirator products are not displayed to the user since there is no authorization and rest all products are visible. 

No comments:

Post a Comment