Ansicht
Dokumentation

ABENCDS_SIMPLE_CASE_EXPRESSION_V1 - CDS SIMPLE CASE EXPRESSION V1

ABENCDS_SIMPLE_CASE_EXPRESSION_V1 - CDS SIMPLE CASE EXPRESSION V1

Fill RESBD Structure from EBP Component Structure   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

- DDIC-Based View, 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 . 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, result2, ... 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






CPI1466 during Backup   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 7461 Date: 20240419 Time: 010825     sap01-206 ( 47 ms )