SAP CDS SIMPLE CASE EXPRESSION V1



Get Example source ABAP code based on a different SAP table
  



ABAP_CDS_DDL - DDIC-Based View, simple_case_expr

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

What does it do?
Simple case distinction (simple case) in a SELECT statement of a ABAP_CDS_V1_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 null value.
The following can be specified for operand:
Fields of a data source data_source of the current CDS view
Parameters
Session variables
Path expressions that identify a field of a data source data_source
Built-in functions
Arithmetic expressions
The following can be specified for operand1, operand2, ... :
Literals without a domain prefix
Fields of a data source data_source of the current CDS view
Path expressions that identify a field of a data source data_source
Built-in functions
A further case distinction
The following can be specified for result1, result2, ...:
Literals without a domain prefix
Fields of a data source data_source of the current CDS view
Path expressions that identify a field of a data source data_source
Aggregate expressions
Casting expressions
Built-in functions
Arithmetic expressions
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.



Latest notes: