SELECT-OPTIONS describe a subset of the set of formulas expressible as WHERE conditions. The following table shows the structure of a SELECT-OPTIONS range-table:
SELNAME | KIND | SIGN | OPTION | LOW | HIGH |
---|---|---|---|---|---|
col1 | S | I1,1 | … | ||
… | |||||
col1 | S | I1,k | … | ||
col1 | S | E1,1 | … | ||
… | |||||
col1 | S | E1,m | … | ||
… | |||||
coln | S | In,1 | … | ||
… | |||||
coln | S | In,np | … | ||
coln | S | En,1 | … | ||
… | |||||
coln | S | En,nq | … |
Whereby the columns have the following meaning:
Name of the field (column in the relational model)
Type of record. Either P for parameter or S for SELECT-OPTION, where the latter is relevant for the SELECT-OPTION semantic described below.
Sign of the record. Either I for including or E for excluding.
Option of the record; basically the comparison operator used (for example, EQ for EQuals, BT for BeTween, etc.).
Values of the record. HIGH is only used for BT, for all other OPTION values only LOW is needed. The (ABAP-)type of HIGH and LOW must match the type of the column SELNAME.
The following formula is logically equivalent to the above-mentioned range-table:
→ (I1,1 ∨ … ∨ I1,k) ∧ ¬ (E1,1 ∨ … ∨ E1,n) ∧ … ∧ (In,1 ∨ … ∨ In,NP) ∧ ¬ (En,1 ∨ … ∨ En,NQ)
Where:
This can be transformed into the following (logically equivalent) formula in CNF (conjunctive normal form): †
→ (I1,1 ∨ … ∨ I1,k) ∧ ¬ E1,1 ∧ … ∧ ¬ E1,n ∧ … ∧ (In,1 ∨ … ∨ In,NP) ∧ ¬ En,1 ∧ … ∧ ¬ En,NQ
The following procedure describes the steps necessary to convert an arbitrary WHERE condition into a logically equivalent SELECT-OPTIONS range-table, where possible, or prove that this is not possible: