ABAP Keyword Documentation →  ABAP − Reference →  Program Flow Logic →  Expressions and Functions for Conditions →  log_exp - Logical Expressions →  rel_exp - Relational Expressions →  rel_exp - Relational Operators →  rel_exp - Relational Operators for All Data Types → 

rel_exp - Table-Like Relational Operator IN

Syntax

... operand [NOT] IN seltab ...

Effect

In a comparison expression with relational operator IN, the conditions of a selection table or a table with this layout are checked, that is whether an operand operand meets the conditions of the rows in the selection table or, with addition NOT, does not meet them. The table-like comparison expression is equivalent to a join using binary or ternary comparison expressions whose number is determined by the number of rows in the internal table.

As a selection table seltab, any internal table can be specified whose row type matches that of a selection table, or a functional method with the corresponding type of return value. This includes, in particular, ranges tables. The selection table can be of any table category. For the layout 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 comparison expression is always true.

Each row in a non-initial selection table is included in the join using one of the following comparison expressions. Depending on the operator in the column option, this involves a comparison between two operands using a binary relational operator or the delimitation of an interval using the ternary operator BETWEEN.

operand is a general expression position and the usual comparison rules apply to operand and the columns low and high of the selection table. The comparison expressions of the individual rows are joined as a logical expression in accordance with the following hierarchy:

  1. The expressions of all rows that contain "I" in the column sign are joined using OR. If there are no rows that contain "E" in the column sign, this represents the entire logical expression.

  2. The expressions of all rows that contain "E" in the column sign are joined using OR and then negated using NOT. If there are no rows that contain "I" in the column sign, this represents the entire logical expression.

  3. If the content "I" and the content "E" are both in the column sign, AND is used to join the logical expression that results from step 1 with the logical expression from step 2

Notes

Example

See Selection Tables in Relational Expressions.




Continue
Comparison with Selection Table