Ansicht
Dokumentation

ABENCDS_F1_SIMPLE_CASE_EXPRESSION - CDS F1 SIMPLE CASE EXPRESSION

ABENCDS_F1_SIMPLE_CASE_EXPRESSION - CDS F1 SIMPLE CASE EXPRESSION

PERFORM Short Reference   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.
SAP E-Book

- simple_case_expr

... CASE operand
         WHEN operand1 THEN result1
        $[WHEN operand2 THEN result2$]
         ...
        $[ELSE resultn$]
    END ...


Effect

Simple case distinction (simple case) in a SELECT statement of a CDS view. The case distinction compares the values of operand operand with operands operand1, operand2, ... and produces the operand result as the result after the first THEN for which the comparison is true. If no matches are found, the result specified after ELSE is selected. If ELSE is not specified, the result is the zero value.

  • The following can be specified for operand:

  • The following can be specified for operand1, operand2, ... :

  • Fields of a data source data_source of the current CDS view

  • A further case distinction

  • The following can be specified for result1, result2, ...:

  • Fields of a data source data_source of the current CDS view

  • A further case distinction

The operand operand must be comparable with operand1, operand2, ... When the CDS view is activated, a result type is determined from the operands result1, result1, ... that covers their types. The operands must be compatible with each other.

The operands cannot have the type LCHR, LRAW, STRING, RAWSTRING, or GEOM_EWKB.

Notes

Example

Case distinction in a SELECT list.

case partner.bp_role
    when '01' then 'customer'
    when '02' then 'supplier'
end as partner_role





BAL Application Log Documentation   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 7326 Date: 20240418 Time: 151936     sap01-206 ( 33 ms )