Skip to content

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:

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 column seltab-option and as the right operand, the content of column seltab-low is used.
  • A character string comparison is structured as follows:

    ... operand {CP|NP} operand

    The relational operator matches the content of the seltab-option column and the content of the columns seltab-low and seltab-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 addition NOT, if the content of column seltab-option is "BT", and with NOT, if it is "NB". For the interval boundaries, the content of the columns seltab-low and seltab-high is used.

The result of the entire logical expression is determined by the following interlinkage of the individual rows:

  • The results of all rows that contain "I" in the sign column, are linked with OR. If there are no rows containing "E" in column sign, this is the result of the logical expression.
  • The results of all rows that contain "E" in the 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.
  • If in column 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.

    • If the selection table seltab has been declared using the statement SELECT-OPTIONS seltab for the data object operand, it is possible to specify the logical expression in the obsolete short form.

    Continue

    Selection Tables in Logical Expressions