SAP LOGEXP SELECT OPTION



Get Example source ABAP code based on a different SAP table
  


• IN ABAP_RELAT_EXPR
• NOT IN ABAP_RELAT_EXPR

ABAP_RELEXP - Tabular Comparison Operator IN

ABAP_SYNTAX
ABAP_KEY ... operand $[NOT$] IN range_tab ...

What does it do?
In a comparison expression with the comparison operator IN, the conditions of a ranges table or a table of this structure are checked. This means whether an operand operand is checked to see whether it meets the conditions in the lines of the ranges table or not, if the addition NOT is specified. The tabular comparison expression is equivalent to a combination of binary or ternary comparison expressions whose number is determined by the number of lines in the internal table.
Any internal table whose line type matches that of a ranges table or a functional method with the corresponding type of return value can be specified as a table range_tab.
BEGIN_SECTION VERSION 5 OUT This includes, in particular, selection tables.
END_SECTION VERSION 5 OUT The ranges table can be of any table type. For the structure of a ranges tables, see TYPES RANGE OF. The evaluation of a ranges table requires it to contain the valid values listed there in the columns sign and option. If the ranges table contains invalid values, an uncatchable exception is raised. If the ranges table is initial, the comparison expression is always true.
Each line of a non-initial ranges table is included in the combination using one of the following comparison expressions. Depending on the operator in the column option, this is a comparison between two operands using a binary comparison operator or an interval restriction using the ternary operator BETWEEN.
The operators EQ, NE, GE, GT, LE, and LT produce a size comparison: ... operand ${EQ$|NE$|GE$|GT$|LE$|LT$} range_tab-low ... The comparison operator is derived from the content of the column range_tab-option and the content of the column range_tab-low is used as the right operand.
The operators CP and NP produce a string comparison: ... operand ${CP$|NP$} range_tab-low range_tab-high The comparison operator is derived from the content of the column range_tab-option and the content of the columns range_tab-low and range_tab-high is concatenated as the right operand.
The operators BT and NB produce a delimitation of an interval: ... operand $[NOT$] BETWEEN range_tab-low AND range_tab-high ... The comparison is executed without the addition NOT if the content of the column range_tab-option is BT and with the addition NOT if the content is NB. The content of the columns range_tab-low and range_tab-high is used for the interval restrictions.
operand is a general expression position and the usual comparison rules apply to operand and the columns low and high of the ranges table. The comparison expressions of the individual lines are combined into a logical expression in accordance with the following hierarchy: The expressions of all lines that contain I in the column sign are combined using OR. If there are no lines that contain E in the column sign, this represents the entire logical expression. The expressions of all lines that contain E in the column sign are combined using OR and then negated using NOT. If there are no lines that contain I in the column sign, this represents the entire logical expression. If the content I and the content E are both in the column sign, AND is used to combine the logical expression that is produced by step 1 with the logical expression from step 2



Latest notes:

The rules above can be interpreted in such a way that the lines containing I or E in the column sign describe two value sets. The set for I is the inclusive set and the set for E is the exclusive set. By subtracting the exclusive set from the inclusive set, a result set is calculated that contains all values for which the entire logical expression is true.
The comparison rules are checked only at runtime and comparisons that are not allowed lead to exceptions.
The operator IN is, due to its implementation using binary comparison operators, not suitable for selecting natural-language text content.
NON_V5_HINTS
If the selection table selcrit was declared as a special form of ranges table for the data object operand using the statement SELECT-OPTIONS selcrit, the comparison expression can also be specified in an obsolete short form.
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Filling of a ranges table with a SELECT statement and its use in a logical expression in the conditional operator COND.
ABEXA 01115
ABAP_EXAMPLE_END

ABAP_EXAMPLES_ABEXA
Comparison with Ranges Table
Comparison with Selection Table
ABAP_EXAMPLE_END