BW Related ABAP - SELECT-OPTIONS and RANGES

 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.
SIGN

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)
OPTION

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)
LOW

To maintain lower limit of range.

HIGH

To maintain higher limit of range.

Ex:

SELECT-OPTIONS range_ex FOR sy-index.

SELECT-OPTIONS matno FOR mara-matnr.

RANGES docu_num FOR likp-vbeln.

Example Program:

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.

 

 

Comments

Popular posts from this blog

Sample ABAP program for Updating notepad file data to Internal table and Sending it to Application server

OPEN SQL EXAMPLES IN ABAP – PART 2

Domains and Data Elements