Both Ranges and Select-Options are used for maintaining Ranges.
- Select-Options are used for taking input from user on selection screen
- In case of Select-Options system itself creates an internal table
- In case of Ranges, the internal table should be defines explicitly
- The internal table contains four fields- Sign, Option, Low and High.
- Special operator IN is used in comparisons.
The data type of SIGN is C with Lengh 1. Possible values are I and E.
- I stands for “inclusive” (operators are not inverted)
- E stands for “exclusive” (operators are inverted)
The data type of OPTION is C with length 2. OPTION contains the selection operator.
The following operators are available:
- if HIGH is empty, you can use EQ, NE, GT, LE, LT, CP and NP.
- if HIGH is filled, you can use BT (Between) and NB (Not Between)
To maintain lower limit of range.
To maintain higher limit of range.
SELECT-OPTIONS range_ex FOR sy-index.
SELECT-OPTIONS matno FOR mara-matnr.
RANGES docu_num FOR likp-vbeln.
REPORT. TABLES SCARR. RANGES EX FOR SCARR-CARRID. *--filling RANGES with a single value EX-SIGN = 'I'. EX-OPTION = 'EQ'. EX-LOW = 'UA'. APPEND EX. SELECT * FROM SCARR WHERE CARRID IN EX. WRITE:/ SCARR-CARRID, SCARR-CARRNAME.