Get Example source ABAP code based on a different SAP table
ABAP_SQLEXP > - sql_simple_case>
ABAP_SYNTAX ... CASE sql_exp WHEN sql_exp1 THEN result1 $[WHEN sql_exp2 THEN result2$] ... $[ELSE resultn$|sql_null$] END ...>
What does it do? Simple case distinction> (simple case) in AB_SQL . This SQL expression compares the values of the operand sql_exp> with the operands sql_exp1>, sql_exp2>, ..., and returns 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 null value can be specified explicitly by the null expression> sql_null>. The operands sql_exp>, sql_exp1>, sql_exp2>, ..., and the results result1>, result2>, ... can be any SQL expressions>. They can have any dictionary types except ACCP>, BEGIN_SECTION VERSION 5 OUT DF16_SCL> (obsolete), DF34_SCL> (obsolete), END_SECTION VERSION 5 OUT LCHR>, LRAW>, PREC>, RAWSTRING>, STRING> , and GEOM_EWKB>. The data type of the operand sql_exp> must be comparable> with the data types of the operands sql_exp1>, sql_exp2>, .... If this is not the case, a static specification raises a syntax error and a dynamic specification raises an exception of the class CX_SY_DYNAMIC_OSQL_SEMANTICS>. The results must also be compatible to produce a common result type: The data types result1>, result2>, ... must be either the same or the data type must be able to completely represent the value of all other data types. The result has the dictionary type of the specification with the greatest value range. If an operand of a comparison has the null value>, the result of this comparison is unknown.