Ansicht
Dokumentation
ABENCDS_CASE_EXPRESSION_APV - CDS CASE EXPRESSION APV
RFUMSV00 - Advance Return for Tax on Sales/Purchases rdisp/max_wprun_time - Maximum work process run timeThis documentation is copyright by SAP AG.
- case_expr, Analytical Query
Selection-related case expression (restricted measure)
1. ... CASE
WHEN cds_cond
THEN result
END ...
Formula-related case expression
2. @Aggregation.default: #FORMULA
CASE
WHEN cds_cond
THEN result1
ELSE result2
END ...
Effect
Case distinction in the element list of an analytical query. Either a selection-related case expression (restricted measure) or a formula-related case expression.
Example
The following CDS analytical projection view DEMO_CDS_ANALYTIC_CASE defines an analytical query. It is based on the cube view
DEMO_CDS_CUBE_VIEW. The projection view defines one selection-related case expression and one formula-related case expression.
Selection-Related Case Expression (Restricted Measure)
... CASE
WHEN cds_cond
THEN result
END ...
Effect
Case expression in a CDS analytical projection view that defines a selection. Must have exactly one WHEN branch, no ELSE branch is allowed.
result specified after THEN must be a field of a data source specified as analytical measure, or a literal of a measure-like data type. A literal is only allowed if the element is annotated with AnalyticsDetails.query.onCharacteristicStructure: true and when this annotation is used, a literal is mandatory.
The following rules apply to the condition cds_cond specified after WHEN:
- All comparison operators except for <> are supported. BETWEEN, LIKE, and IS INITIAL are supported.
- The Boolean operators AND and OR are allowed. Identical fields must be combined with OR, different fields must be combined with AND. NOT is not supported.
- lhs expects a field of the projected entity. The field must be classified as analytical dimension.
- rhs can be a parameter, a session variable, or a typed literal.
- Path expressions are not supported as operands.
Formula-Related Case Expression
...
@Aggregation.default: #FORMULA
CASE
WHEN cds_cond
THEN result1
ELSE result2
END ...
Effect
Formula-related case expression in the element list of an CDS analytical projection view. The case distinction evaluates the condition cds_cond and returns either the operand result1 specified after THEN, or the operand result2 specified after ELSE. result2 can also be the zero value.
There must be exactly one WHEN branch, one THEN branch, and one ELSE branch. The annotation @Aggregation.default: #FORMULA is mandatory for formula-related case expressions.
Result1 and result2 must be specified as field of a data source with a data type valid for analytical measures, numeric typed literal (except for data type NUMC), or numeric parameter (except for data type NUMC).
The following rules apply to the condition specified after WHEN:
- All comparison operators except <> are supported. IS INITIAL is supported. BETWEEN, LIKE, and IS NULL are not allowed.
- The Boolean operators AND and OR are allowed.
- lhs expects either a field of the projected entity that has a data type valid for analytical measures, a built-in function, or an input parameter.
- rhs can be a field of a data source specified as analytical measure, a built-in function, a parameter, or a typed literal of one of the following data types: DEC, DECFLOAT16, DECFLOAT34, FLTP, DF16_DEC, DF34_DEC, DF16_RAW, DF34_RAW, INT1, INT2, INT4, INT8, DATS, DATN, TIMN, TIMS.
- Path expressions are not supported as operands.
ABAP Short Reference Addresses (Business Address Services)
This documentation is copyright by SAP AG.
Length: 10372 Date: 20240511 Time: 160148 sap01-206 ( 96 ms )