log_exp - Logical Expressions
| [NOT] log_exp [AND|OR|EQUIV log_exp] ...
A logical expression formulates a condition for operands. The result of a logical expression
log_exp is a
logical value and can therefore be true or false.
A logical expression is either a single relational expression
rel_exp or an expression constructed from the
EQUIV and one or more logical expressions.
Parentheses are possible here. An atomic part of a composite logical expression is always one of the following relational expressions:
Logical expressions can be used as follows:
- To formulate conditions in control statements and other statements used to control the program flow.
- As an argument of a boolean function for representing a logical value in a character-like or byte-like data object.
- The operand positions
operandof most relational expressions are general expression positions, which means that, depending on the expression, data objects, predefined functions, functional methods, calculation expressions, constructor expressions, or table expressions can be specified.
- If, in a logical expression, functional methods are specified as operands of a relational expression, they are executed from left to right and from inside to outside before the relational expression is evaluated. In the case of joined relational expressions, this is true for each individual relational expression and not for the overall logical expression.
- Since ABAP does not recognize any Boolean data objects for the logical values true and false, the result of a logical expression cannot currently be directly assigned to a data object as is the case 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 executed as an argument of a Boolean function in a suitable calculation expression.
- The program DEMO_EXPRESSIONS also shows examples of the use of logical expressions, among other things.
Logical expression created from 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 regex = regular_expression ).