ABAP Keyword Documentation → ABAP - Reference → Program Flow → Expressions and Functions for Logical Expressions
log_exp - Logical Expressions
Other versions: 7.31 | 7.40 | 7.54
Syntax
... { {operand1 {=|EQ|<>|NE|>|GT|<|LT|>=|GE|<=|LE
|CO|CN|CA|NA|CS|NS|CP|NP
|BYTE-CO|BYTE-CN|BYTE-CA|BYTE-NA|BYTE-CS|BYTE-NS
|O|Z|M} operand2 }
| {operand [NOT] BETWEEN operand1 AND operand2}
| {<fs> IS [NOT] ASSIGNED}
| {ref IS [NOT] BOUND}
| {operand IS [NOT] INITIAL}
| {para IS [NOT] REQUESTED}
| {para IS [NOT] SUPPLIED}
| {[operand [NOT] IN] seltab} } ... .
Effect
A logical expression formulates a condition for operands. The operand position operand
of most logical expressions can be
general expression positions, which means that, depending on the expression,
data objects,
predefined functions,
functional methods, and
calculation expressions can be specified.
The result of a logical expression log_exp
is a
logical value and can therefore be true or false. Logical expressions can be used as follows:
- A logical value can be depicted using a Boolean function in a character-like or byte-like data object.
- Logical expressions are used to formulate conditions in control statements.
Logical expressions can be formulated using
Logical expressions can be negated and joined using
Notes
- If, in a logical expression, functional methods are specified as operands, they are executed from left to right and from inside to outside when the expression is evaluated. In the case of joined logical expressions, this is true for each individual subexpression and not for the overall 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.
- The logical expression IS [NOT]
REQUESTED is obsolete and was replaced by
IS [NOT] SUPPLIED
.