SAP CDS DCL CONTEXT NODE EXISTS



Get Example source ABAP code based on a different SAP table
  


SAP_ONLY
• CONTEXT_NODE_EXISTS ABAP_CDS_DCL_STATEMENT

ABAP_CDS_DCL - CONTEXT_NODE_EXISTS

ABAP_SYNTAX
CONTEXT_NODE_EXISTS(
${ container => container $| namespace => namespace $}
$[, nodepath => nodepath$] )

What does it do?
This function queries the existence of a node in the access control context. The node is addressed by either the predefined container name container or by a namespace namespace, optionally followed by a path to the node nodepath. For nested nodes, the node names in nodepath are concatenated using the period character (.).
This function can only be queried by the operators IS NOT INITIAL or IS INITIAL and then determines whether the given context node exists or does not exist respectively.

ABAP_EXAMPLE_VX5 GRANT SELECT ON E
WHERE
CONTEXT_NODE_EXISTS( CONTAINER => GROUP_BY, NODEPATH => C ) IS NOT INITIAL;
This rule provides full access when the framework has specified that a grouping exists for field C (as in the example structure above).
ABAP_EXAMPLE_END

ABAP_EXAMPLE_VX5 GRANT SELECT ON E
WHERE
CONTEXT_NODE_EXISTS( NAMESPACE => namespace1, NODEPATH => node2.node22 ) IS NOT INITIAL;
This rule also provides full access given the access control context from the example above. Note that the node names are not case- sensitive, as is the path concatenation in the nodepath parameter.
If the last path component had been specified as .node23, the result would have been denied access because such a node does not exist.
ABAP_EXAMPLE_END