Ansicht
Dokumentation

ABENCDS_CASE_EXPRESSION_APV - CDS CASE EXPRESSION APV

ABENCDS_CASE_EXPRESSION_APV - CDS CASE EXPRESSION APV

RFUMSV00 - Advance Return for Tax on Sales/Purchases   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

- 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:

  • 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.

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:

  • 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.





ABAP Short Reference   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 10372 Date: 20240511 Time: 160148     sap01-206 ( 96 ms )