SAP CDS DCL ROLE INHERITED RULE



Get Example source ABAP code based on a different SAP table
  


VERSION 5 OUT
• GRANT SELECT ON INHERIT ABAP_CDS_DEFINE_ROLE

ABAP_CDS_DCL - DEFINE ROLE, inherited_rule (Obsolete)

Obsolete Syntax
GRANT SELECT ON cds_entity INHERIT parent_role $[AND$|OR cds_cond$] ...;

What does it do?
Obsolete inherited access rule in the statement DEFINE ROLE in the CDS DCL. An inherited access rule GRANT SELECT ON with the addition INHERIT inherits the access rules of an existing CDS role parent_role for a CDS entity cds_entity. The same applies to cds_entity as to a conditional access rule.
As an option, access conditions cds_cond can be added to the inherited access rule using AND or OR. A CDS role can only contain one inherited access rule, but can contain additional conditional or full access rules. The existing CDS role parent_role can only contain a single access rule for exactly one CDS entity, which itself can be an inherited access rule.
The inherited access conditions inherited from parent_role must match the CDS entity cds_entity. Full access rules cannot be inherited.



Latest notes:

Inherited access rules are obsolete. Inheritance conditions should be used as access conditions instead.
There is currently no check to determine whether the CDS entity cds_entity contains as a data source the CDS entity for which the role parent_role is defined.
Changes to the CDS entity for which the role parent_role is defined can lead to errors in the inheriting roles.
ABAP_HINT_END

ABAP_EXAMPLE_VX
This example demonstrates how an obsolete inherited access rules is used. The example for inheritance conditions shows how access conditions should be applied instead.
The following CDS view entity uses the CDS view entity DEMO_CDS_AUTHORITY_LIT_PFCG_VE from the example for conditional access rules as the data source:
DDLS DEMO_CDS_AUTH_INH_OBS_VE
The view entity DEMO_CDS_AUTHORITY_LIT_PFCG_VE is assigned to the CDS role DEMO_CDS_ROLE_LIT_PFCG_VE. This role is inherited in the following CDS role and hence passes its access rules to the view DEMO_CDS_AUTH_INH_OBS_VE. An additional literal condition allows access to another currency.
DCLS DEMO_CDS_ROLE_INH_OBS_VE
The language element INHERIT inherits the access conditions of the existing role and combines them with the additional condition. Expressed explicitly, the resulting access condition looks like this: ... where (carrid) =
aspect pfcg_auth (s_carrid, carrid, actvt='03') and
currcode = 'EUR' or
currcode = 'USD' ...
ABAP_EXAMPLE_END