Ansicht
Dokumentation
ABENCDS_ELEMENT_APV - CDS ELEMENT APV
CL_GUI_FRONTEND_SERVICES - Frontend Services Vendor Master (General Section)This documentation is copyright by SAP AG.
- element, Analytical Query
... $[@element_annot1$]
$[@element_annot2$]
...
${ field
$[AS alias$] $}
$| ${ path_expr.element
$[AS alias$]$[: LOCALIZED$]$}
$|
${ arith_expr
AS alias $}
$| ${ builtin_func
AS alias $}
$| ${ case_expr
AS alias $}
$| ${ VIRTUAL calculated unit
AS alias $}
$| ${ parameter
AS alias $}
$| ${ session_variable
AS alias $}
$| ${ typed_literal
AS alias $}
$| ${ cast_expr
AS alias $}
$| ${ $projection.reuse_exp AS alias
$}
Additions
1. ... AS alias
2. ... LOCALIZED
3. ... VIRTUAL
Effect
Defines an element in the element list of a CDS analytical projection view.
Elements in the element list of an analytical projection view can be analytical formulas, selections, dimensions, text fields or attributes, or CDS amount and quantity fields. See the topic about the conceptual background of analytical queries for further details.
- The rules for propagation of element annotations in CDS projection views apply.
- field exposes an element from the projected entity. AS can be used to define an alternative element name alias.
- In analytical projection views, measure fields can be exposed multiple times with different alias names. Dimension fields can be exposed only once.
- Analytical measure fields and analytical dimension fields from the projected entity stay analytical dimensions and measures, their type must not be changed in the projection layer.
- path_expr.element exposes an element of an association target of the projected entity. If no alternative element name alias is defined, the original element name of the element picked by the path expression is reused. For details, see the topic about path expressions in analytical queries.
- arith_expr can be used to specify an arithmetic expression. The annotation Aggregation.default: #FORMULA is mandatory when an arithmetic expression is included as field in the element list. Arithmetic expressions are evaluated by the analytical engine when the analytical query is accessed. An alternative element name alias must be defined with the keyword AS.
- Arithmetic expressions must not have any path fields, specified using path_expr.element, as operands.
- The following built-in functions builtin_func are supported:
- CURR_TO_DECFLOAT_AMOUNT
- GET_NUMERIC_VALUE
- The annotation Aggregation.default: #FORMULA is mandatory for built-in functions.
- case_exp can be used to specify case distinctions. In an analytical query, case distinctions define analytical formulas or restricted measures. See topic case_expr, analytical query for further details.
- Calculated units can be defined using the keyword VIRTUAL in CDS analytical projection views. By that, the analytical runtime automatically fills in the required value for the unit.
- parameter can be used to specify a parameter from the parameter list. An alternative element name using the keyword AS must be defined and it cannot be the name of the parameter. In analytical queries, parameters must have either a numeric data type (except for NUMC), or a unit or currency key. The annotation Aggregation.default: #FORMULA is mandatory when a parameter of a numeric data type is included as field in the element list. No annotation is required when a parameter is used as operand in a formula.
- session_variable can be used to specify a session variable. AS must be used to define an alternative element name alias. In the element list of analytical queries, the following session variables are supported: system_date and user_date. The annotation Aggregation.default: #FORMULA is mandatory when a session variable is included as field in the element list. No annotation is required when a session variable is used as operand in a formula or selection.
- typed_literal can be used to declare a typed literal. AS must be used to define an alternative element name alias. In analytical queries, typed literals must have either a numeric data type (except for NUMC), or a unit or currency key. The annotation Aggregation.default: #FORMULA is mandatory when a numeric typed literal is included as field in the element list. No annotation is required when a typed literal is used as operand in a formula or selection.
- untyped literals are not supported in the element list of analytical projection views.
- cast_expr can be used to specify cast expressions. For a cast expression, an alias name must be specified with the keyword AS.
- $projection.reuse_exp reuses an expression defined in the SELECT list in another operand position of the same analytical projection view. An alternative element name specified using AS is required.
- Exposing associations from the projected entity is not allowed.
- It is not allowed to define key fields using KEY.
Example
The following CDS analytical projection view DEMO_ANALYTICAL_QUERY_ELEM defines an analytical query. It is based on the cube view
DEMO_CDS_CUBE_VIEW.
Addition 1
... AS alias
Effect
Defines an alternative element name for the projected element. The alternative element name replaces the actual name of the element from the
projected
entity. The view field is created under the alternative element name in the CDS projection view. Accordingly, the alternative element name must comply with the general syntax rules for
names.
Addition 2
... LOCALIZED
Effect
The keyword LOCALIZED must be used to
display text elements in the current system language. See CDS Projection View, proj_element.
Addition 3
... VIRTUAL
Effect
The keyword VIRTUAL defines a CDS virtual element in a CDS projection view. In general, CDS virtual elements calculate field values during runtime, see topic CDS Projection View, VIRTUAL.
In analytical queries, a virtual element is mostly used to define a calculated unit for a calculated quantity. By using VIRTUAL, the analytical runtime automatically fills in the required value for the unit by interpreting the referred calculated quantity.
In an analytical query, the annotation @ObjectModel.virtualElementCalculatedBy, which connects the virtual element to an ABAP class that calculates a value at runtime, is not supported.
General Material Data Addresses (Business Address Services)
This documentation is copyright by SAP AG.
Length: 18458 Date: 20240511 Time: 172614 sap01-206 ( 214 ms )