Get Example source ABAP code based on a different SAP table
• CASE WHEN ABAP_OSQL_EXP
ABAP_SQLEXP > - sql_searched_case>
ABAP_SYNTAX ... CASE WHEN sql_cond1> THEN result1 $[WHEN sql_cond2> THEN result2$] $[WHEN sql_cond3> THEN result3$] ... $[ELSE resultn$|sql_null$] END ...>
What does it do? Complex case distinction> (searched case) in AB_SQL . This SQL expression evaluates logical expressions sql_cond1>>, sql_cond2>>, ... and produces the operand result> as a result after the first THEN> for which the logical expression is true. If no logical expressions are true, 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 results result1>, result2>, ... can be any SQL expressions>. The results must be compatible with each other in such a way that a common result type can be determined: The data types result1>, result2>, ... must be either the same or the data type must be able to fully represent the value of all other data types. 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 result has the dictionary type of the specification with the greatest value range. If a complex CASE> is used in a condition> of an AB-SQL statement, the client column > of a client-dependent data source of a query or of the target of a write statement cannot be used as the operand of a WHEN> condition due to implicit client handling>.