Ansicht
Dokumentation

ABENSQL_SEARCHED_CASE - SQL SEARCHED CASE

ABENSQL_SEARCHED_CASE - SQL SEARCHED CASE

RFUMSV00 - Advance Return for Tax on Sales/Purchases   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

- sql_searched_case

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


Effect

Complex case distinction (searched case) in . 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 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 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.

Notes

  • If the case distinction is evaluated in the table buffer, the order of processing is preserved and there is no termination when an operand is evaluated whose condition is not true.
  • When complex CASE is used, the syntax check is performed in a strict mode from Release , which handles the statement more strictly than the regular syntax check.
  • A client column can be used as an operand only if implicit client handling is disabled using the obsolete addition CLIENT SPECIFIED for the query or the write statement.
  • When SQL expressions are specified on the left side or host expressions occur on the right side, the syntax check is performed in a strict mode from Release , which handles the statement more strictly than the regular syntax check.

Example

Evaluation of the column FLTIME in a complex CASE.

SQL Expressions, Complex CASE






General Material Data   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 4320 Date: 20240426 Time: 220243     sap01-206 ( 81 ms )