cancel
Showing results for 
Search instead for 
Did you mean: 

DCL - Grant select on - what happens if?

Arul77
Discoverer
0 Kudos
165

Hi Gurus,

I have a custom CDS view ZEntity1 for which I defined a role with the same name as CDS view - ZEntity1 using DCL. According to the books the 'Grant select' should be on the CDS view, however in my DCL code of ZEntity1 the Grant Select is on another standard view "I_SalesDocumentItem".

Can some please explain if the DCL will control the view ZEntity1 or I_SalesDocumentItem? Is there any use in doing this way?

Code Snippet:
@EndUserText.label: 'DCL for ZENTITY1'
@MappingRole: true
define role ZENTITY1{
grant select on I_SalesDocumentItem
where ( _SalesDocument.SalesDocumentType ) =
aspect pfcg_auth ( v_vbak_aat,
auart,
actvt = '03' )

View Entire Topic
umasaral
Participant
0 Kudos

Hi 

In your scenario, you have defined a custom CDS (Core Data Services) view ZEntity1 and associated a DCL (Data Control Language) role ZENTITY1 with it.


However, in the DCL code, you are granting SELECT privileges on a standard view I_SalesDocumentItem instead of ZEntity1.

Update the DCL Role: Modify the DCL role to grant SELECT on ZEntity1 instead of I_SalesDocumentItem.


Here is how the updated DCL role might look:
@EndUserText.label: 'DCL for ZENTITY1'
@MappingRole: true
define role ZENTITY1{
grant select on ZEntity1
where ( _SalesDocument.SalesDocumentType ) =
aspect pfcg_auth ( v_vbak_aat,
auart,
actvt = '03' )
}
By applying the GRANT SELECT on ZEntity1 in the DCL role, you directly control access to the CDS view as intended, ensuring that the role manages access to the correct data.

Arul77
Discoverer
0 Kudos

Hi Umasaral,

Thank you for the reply. I already understand that it has to be Zentity1 in the Grant select, however my question is what happens if I use another CDS I_SalesDocumentItem instead of Zentity1?

BR,

Arul