Entering content frame

Simple CASE Function (simple_case_function) Locate the document in its SAP Library structure

The simple CASE function (simple_case_function) is a special function that analyzes a quantity of simple expressions to determine a result expression (result_expression).

Syntax

<simple_case_function> ::=
CASE <check_expression>
        WHEN <search_expression> THEN <result_expression>
            [...]
        [ELSE <default_expression>])
END

<check_expression> | <search_expression> | <result_expression> | <default_expression> ::= <expression>

expression

Explanation

x

check_expression

Expression x for which a comparison is to be made with the comparison values u(i)

u(i)

search_expression

Comparison value u(i). The function delivers the result v(i) when u(i) first matches x.

v(i)

result_expression

Value v(i) that is assumed if u(i) matches x

z

default_expression

Value z, optional default value

CASE compares the values of x with the values u(i) consecutively. If values match, the result of the simple CASE function is the value v(i) associated with u(i).

The data types of x and u(i) must be comparable. The data types of v(i) and z must be comparable. The data types of u(i) and v(i) do not have to be comparable.

A match is exists if x and u(i) are NULL values. The comparison of the special NULL value with any other value never results in a match.

If a match is not found, CASE supplies the result of z. If z is not specified, the NULL value is the result of CASE.

See also:

General CASE Function (searched_case_function)

 

Leaving content frame