Get Example source ABAP code based on a different SAP table
• GRANT SELECT ON ABAP_CDS_DEFINE_ROLE , projection rule • AS PROJECTION ON ABAP_CDS_DEFINE_ROLE • FALLBACK ASSOCIATION ABAP_CDS_DEFINE_ROLE
ABAP_CDS_DCL - DEFINE ROLE>, projection_rule>
ABAP_SYNTAX GRANT SELECT ON cds_entity_projection AS PROJECTION ON cds_entity_base FALLBACK ASSOCIATION fallback_association;>
What does it do? Creates an access rule for the CDS projection view> cds_entity_projection> which is a projection on the base view cds_entity_base>. cds_entity_projection> must be a CDS transactional query>, i.e. a projection view with the provider contract TRANSACTIONAL_QUERY>. At runtime, the access conditions> of the base view are applied to the projection view if all of the following conditions are met:
All CDS elements used in the access conditions of the base view are present in the projection view (aliasing using the keyword AS> is supported).
The access conditions of the base view do not use any parameters ( $parameters>...).
If the access conditions of the base view use path expressions> and an association target> is redirected to another projection view using the keyword REDIRECTED TO>>, using path filters is not allowed. If it is not possible to apply the access conditions of the base view directly to the projection view, all access conditions are rewritten at runtime to point to the association fallback_association>. This association must exist in the projection view and point to the base view.
Latest notes:
The fallback association fallback_association> should be a to-one association to the base view, using the key elements.
The syntax check of the projection rule issues a syntax warning if it detects that the access conditions of the base view could potentially trigger the use of the fallback association at runtime. This check is user-independent and realizes a worst case estimation. Depending on the actual authorizations of a user performing the access controlled action , it is still possible that the fallback association is not used at runtime. NON_V5_HINTS ABAP_HINT_END BEGIN_SECTION SAP_ONLY Since SAP has control over the entire stack, only static (design-time) inheritance is used by SAP development, so that missing elements in higher stack layers are identified immediately by syntax check errors and are then added just before delivery. The flexibility of the runtime inheritance behind projection rules is reserved for customer development scenarios where the fallback association provides functional correctness at the cost of reduced performance. The latter is not the default for SAP deliverables. END_SECTION SAP_ONLY