SAP CDS DCL CONTEXT NODE VALUES



Get Example source ABAP code based on a different SAP table
  


SAP_ONLY
• CONTEXT_NODE_VALUES ABAP_CDS_DCL_STATEMENT

ABAP_CDS_DCL - CONTEXT_NODE_VALUES

ABAP_SYNTAX
CONTEXT_NODE_VALUES(
${ container => container
$| namespace => namespace $}
$[, nodepath => nodepath $]
$[, quantifier => ALL $| EXISTS $]
$[, datatype => datatype $] )

What does it do?
This function expands the current node values as left-side host expressions and evaluates the condition individually for the elements set. 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 (.).
The optional keyword parameter quantifier can be either ALL or EXISTS:
EXISTS: The overall condition is true if the condition is true for any of the node values.
ALL: The condition must be true for all node values.
If it is not specified, the implicit default is EXISTS.
The optional keyword parameter datatype specifies a DDIC data element datatype that is used to represent the context node values at runtime before they are used in the comparison operations. For example, this allows the runtime to correctly handle leading zeros (for the base type NUMC ) or the position of the sign for integer types.
All possible relational expressions that can be used with the function CONTEXT_NODE_VALUES are listed in the topic CDS DCL - CONTEXT_NODE_VALUES, Use .



Latest notes:

If the access control context contains values that cannot be represented in the given data type (for example a text value for a numeric data type), a runtime error occurs as soon as the DCL function is evaluated.
The ABAP class for creating of the access control context has a corresponding parameter DATATYPE. When using DATATYPE in the DCL function, it should be used there with the same value as well. This way, typing errors can be detected and handled by the ABAP code when the access control context is created.
NON_V5_HINTS
ABAP_HINT_END