Using Select-Options in SAP ABAP


What are select-options in SAP ABAP ? Providing input range in selection screen using SAP ABAP programming

A+ A-

Select-Options is statement which is used to define two input fields so that users can enter a range of values, Select-Options have below additional features.
  • Accepts multiple single values.
  • Accepts multiple ranges (ex: 001-020, 025-30).
  • Accepts exclusion of values (ex: Exclude 0004, 007 etc).
  • Accepts exclusion of ranges.
Syntax 1 : SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD>.  "THIS PRINTS TWO INPUT FIELDS (RANGE) WITH EXTENSION TO ENTER MULTIPLE RANGES
Syntax 2 : SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD> NO INTERVALS.   "THIS PRINTS ONE INPUT FIELD WITH EXTENSION
Syntax 3 : SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD> NO-EXTENSION. " THIS PRINTS TWO INPUT FIELDS WITH OUT ANY EXTENSION (CAN NOT ENTER MULTIPLE RANGES)
Syntax 4 : SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD> NO INTERVALS NO-EXTENSION .THIS PRINTS ONE INPUT FIELD WITH OUT INTERVALS AND EXTENSIONS

Select-Options functionality in SAP ABAP

When ever we declare Select-Options, an internal table will be created with the following fields.

  1. SIGN: This field contains I or E, where I stands for an inclusive (Include that value) and E stands for exclusive (Exclude that values), default value is I.
  2. OPTIONS: This field can accept values BT (Between), NB (Not Between), EQ (Equal), NE(Not equal), GT(Greater than), LT(Less than) .
  3. LOW: This field stores a low value of entering the range.
  4. HIGH: This field stores a high value of entering the range.

Select-Options design

TABLES MARA.  "SPECIFY TABLE FOR WHICH YOU ARE CREATING SELECT-OPTIONS
SELECT-OPTIONS S_MATNR FOR MARA-MATNR . "PRINT SELECT-OPTIONS ON SCREEN 

The above statement prints a select-options with intervals and extension .

Select Options in SAP ABAP

TABLES MARA.  "SPECIFY TABLE FOR WHICH YOU ARE CREATING SELECT-OPTIONS
SELECT-OPTIONS S_MATNR FOR MARA-MATNR NO INTERVALS. "PRINT SELECT-OPTIONS ON SCREEN 

The above statement prints a select-options with no intervals.

Select Options with no intervals in SAP

TABLES MARA.  "SPECIFY TABLE FOR WHICH YOU ARE CREATING SELECT-OPTIONS
SELECT-OPTIONS S_MATNR FOR MARA-MATNR NO-EXTENSIONS . "PRINT SELECT-OPTIONS ON SCREEN 

The above statement prints a select-options with out extension.

Select Options with no extensions in SAP

TABLES MARA.  "SPECIFY TABLE FOR WHICH YOU ARE CREATING SELECT-OPTIONS
SELECT-OPTIONS S_MATNR FOR MARA-MATNR NO-EXTENSION NO INTERVALS. "PRINT SELECT-OPTIONS ON SCREEN 

The above statement prints a select-options with out intervals and with out extensions.

Select Options with no extension and no interval



Was this lesson helpful to you? Yes No 141 People out of 152 think this lesson helpful

Lesson Navigation

←Previous Chapter
Next Chapter →