ABAP Keyword Documentation → ABAP - Reference → Program Flow → Expressions and Functions for Logical Expressions → log_exp - Logical Expressions → log_exp - Predicates
log_exp - IN
Other versions: 7.31 | 7.40 | 7.54
Syntax
... operand [NOT] IN seltab ...
Effect
In a logical expression with language element IN
, the conditions of a
selection table are
checked, that is whether an operand operand
meets the conditions of the selection table or, with addition NOT
, does not meet them.
For operand
, you can use:
- Data objects, predefined functions, and functional methods.
- Arithmetic expressions,
character string expressions, or
bit expressions. The columns
low
andhigh
of the selection table must then have a numeric, character-like, or byte-like data type.
As a selection table seltab
, you can specify any internal table whose row type matches that of a selection table, or a
functional method with the respective type of return value. This includes, in particular,
ranges tables. The selection table can be of any type.
For the structure of a selection table, refer to section
SELECT-OPTIONS. The evaluation of a selection table requires the table to contain the valid
values specified in that section in the columns sign
and option
.
If the selection table contains invalid values, an exception that cannot be handled is raised. If the selection table is initial, the logical expression is always true.
Every row of the selection table represents a logical expression. Depending on the operator in column option
, it is either a comparison or an interval selection, to which the general
rules apply.
- A size comparison is structured as follows:
... operand {EQ|NE|GE|GT|LE|LT} seltab-low ...
The relational operator corresponds to the content of columnseltab-option
and as the right operand, the content of columnseltab-low
is used.
- A character string comparison is structured as follows:
... operand {CP|NP} operand
The relational operator matches the content of theseltab-option
column and the content of the columnsseltab-low
andseltab-high
is concatenate as the right operand.
- The interval selection is structured as follows:
... operand [NOT] BETWEEN seltab-low AND seltab-high ...
The comparison is executed without additionNOT
, if the content of columnseltab-option
is "BT", and withNOT
, if it is "NB". For the interval boundaries, the content of the columnsseltab-low
andseltab-high
is used.
The result of the entire logical expression is determined by the following interlinkage of the individual rows:
sign
column, are linked with
OR
. If there are no rows containing "E" in column sign
, this is the result of the logical expression.
sign
column, are linked with
OR
and then negated with NOT
. If there are no rows containing "I" in column sign
, this is the result of the logical expression.
sign
both "I" and "E" are contained, the result of step 1 is related to the result of step 2 using AND
.
Notes
- These rules above can be interpreted in such a way that the rows containing "I" or "E" in the sign column, describe two value sets. The set for "I" is the inclusive set, the set for "E" is the exclusive set. By substracting the exclusive set from the inclusive set, a result set is calculated that contains all values for which the logical expression is true.
- The operator
IN
is, due to its reference to comparison operators for all data types not suitable for selecting natural-language text content.
- If the selection table
seltab
has been declared using the statementSELECT-OPTIONS
seltab for the data objectoperand
, it is possible to specify the logical expression in the obsolete short form.
Example