Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  Open SQL →  Open SQL - Read Accesses →  SELECT →  SELECT - result →  SELECT - select_list →  SELECT - col_spec →  SELECT - sql_exp 

sql_exp - sql_case

Other versions: 7.31 | 7.40 | 7.54

Syntax Forms


Simple case distinction

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


Complex case distinction

2. ... CASE WHEN sql_cond1 THEN result1
          [WHEN sql_cond2 THEN result2]
          [WHEN sql_cond3 THEN result3]
            ...
          [ELSE resultn]
      END ...

Effect

Case distinction in Open SQL. Either a simple case distinction (simple case) or a complex case distinction (searched case).


Note

A conflict between SQL language element CASE and a column named CASE cannot occur because ABAP Dictionary does not permit a column with this name to be created. However, if a column with this name does exist, it must be prefixed by the escape character ! when it is entered in a list after SELECT.

Continue

sql_exp - sql_simple_case

sql_exp - sql_searched_case