What does it do? A logical expression formulates a condition for operands. The result of a logical expression log_exp> is a truth value>, which means it can be true or false. A logical expression is either a single relational expression> rel_exp>, or an expression combined from one or more logical expressions with the Boolean operators > NOT>, AND>, OR>, EQUIV >> where parentheses> are possible. An atomic component of a compound logical expression is always one of the following relational expressions:
Comparisons>
Comparison expressions>
Predicates>
Predicate expressions>
Predicate functions>
Predicative method calls> Logical expressions can be used as follows:
To formulate conditions in control statements> and other statements used to control the program flow.
in conditional expressions>
As an argument of a Boolean function> to represent a truth value in a character-like or byte-like data object.
In WHERE> conditions of processing statements> for internal tables>.
Latest notes:
The operand positions operand> of most relational expressions are general expression positions>, which means that, depending on the expression, data objects>, built-in functions>, functional methods>, calculation expressions>, constructor expressions>, or table expressions> can be specified.
If functional methods> are specified as operands of a relational expression in a logical expression, they are executed from left to right and from inside to outside before the relational expression is evaluated. In the case of combination> of relational expressions, this applies to each individual relational expression and not to the entire logical expression.
Since ABAP does not recognize Boolean data objects for the truth values true or false, the result of a logical expression cannot currently be directly assigned to a data object, as is possible for calculation expressions>. Instead, the return value of a Boolean function> can be used.
Logical expressions cannot be mixed with calculation expressions>. However, a logical expression can be listed as an argument of a Boolean function> in a suitable calculation expression. NON_V5_HINTS
The program DEMO_EXPRESSIONS>> also shows examples of how to use logical expressions. ABAP_HINT_END
ABAP_EXAMPLE_VX5 Logical expression that is composed of a predicate expression, a comparison expression, and a predicate function using the Boolean operator AND>, in a control statement. IF p1 IS SUPPLIED AND p1 < = upper_limit AND matches( val = p2 pcre = regular_expression ). ... ENDIF.> ABAP_EXAMPLE_END