SELECT-OPTIONS

SELECT-OPTIONS Syntax Diagram


1. ... DEFAULT g
2. ... DEFAULT g ... OPTION xx ... SIGN s
3. ... DEFAULT g TO h
4. ... DEFAULT g TO h ... OPTION xx ... SIGN s
5. ... MEMORY ID pid
6. ... MATCHCODE OBJECT mobj
7. MODIF ID key
8. ... NO-DISPLAY
9. ... LOWER CASE
10. ... OBLIGATORY
11. ... NO-EXTENSION
12. ... NO INTERVALS
13. ... NO DATABASE SELECTION
14. ... VALUE-REQUEST
15. ... VALUE-REQUEST FOR LOW/HIGH
16. ... HELP-REQUEST
17. ... HELP-REQUEST FOR LOW/HIGH
18. ... VISIBLE LENGTH vlen

Effect

Declares a variable selection option.
Objects defined using this statement can have two purposes:

Example

SELECT-OPTIONS PROGRAM FOR SY-REPID.

Creates an internal table PROGRAM with the header line fields PROGRAM-SIGN, PROGRAM-OPTION, PROGRAM-LOW and PROGRAM-HIGH. PROGRAM-LOW and PROGRAM-HIGH have the same field attributes as SY-REPID. When the report is executed (if it is a type 1 program called using SUBMIT ) or the selection screen is called using CALL SELECTION SCREEN, a line on the selection screen appears, containing the text 'PROGRAM' or the associated selection text as well as input fields for PROGRAM-LOW and PROGRAM-HIGH. At the end of the line, there is a pushbutton with an arrow. When you press this button, you branch to the 'Complex Selections' screen where you can enter more selection lines for sel . Here, you can formulate very complicated selection conditions. For further information about how these entries determine the result set, see Logical Expressions or choose 'Help on screen' on the 'Multiple selections' screen.

Effect

Proposes the single value g as the default selection when the report is called.

For each SELECT-OPTION, you can only specify one DEFAULT.

Example

SELECT-OPTIONS DATE FOR SY-DATUM DEFAULT SY-DATUM. 

(xx is OPTION, i.e. one of the values EQ,NE,CP,NP,GE,LT,LE,GT); s is SIGN, i.e. one of the values I or E)

Effect

Similar to "... DEFAULT g", except that the system also proposes the specified selection option and SIGN.
You can specify the additions OPTION and SIGN in any order or omit them. The standard OPTION is EQ, the standard SIGN is I.

Example

DATA CITY(20). 
SELECT-OPTIONS SO_CITY FOR CITY DEFAULT 'SAN*' 
								OPTION CP SIGN E. 

On the selection screen, this results in an entry specifying that cities not beginning with "SAN" are selected.

The option xx and SIGN s must be specified without quotation marks.

Effect

Proposes the range from g to h when the report is called.

(xx is OPTION, i.e. one of the values EQ,NE,CP,NP,GE,LT,LE,GT); s is SIGN, i.e. one of the values I or E).

Effect

Similar to "DEFAULT g TO h", except that the system proposes the specified selection option and SIGN.
You can specify the additions OPTION and SIGN in any order or omit them. The default OPTION is BT, the default SIGN is I.

Example

DATA WORD(20). 
SELECT-OPTIONS SO_WORD FOR WORD DEFAULT 'SPRING' TO 'SUMMER' 
								OPTION NB SIGN I.

On the selection screen, this results in an entry specifying that the words between "SPRING" and "SUMMER " are excluded.

Note

The DEFAULT option allows you to fill the first line of the internal table sel with default values before the selection screen is displayed. If the SELECT-OPTION is supposed to consist of several lines on the selection screen, and you are using SUBMIT , , these entries can be placed in the internal table at INITIALIZATION. However, it is not enough to fill the header line - you must also add the entries to the table with APPEND .

Example

TABLES SBOOK. 
SELECT-OPTIONS FL_DATE FOR SBOOK-FLDATE. 
 
INITIALIZATION. 
 
  MOVE: 'I'	TO FL_DATE-SIGN, 
		'EQ'	 TO FL_DATE-OPTION, 
		SY-DATUM TO FL_DATE-LOW. 
  APPEND FL_DATE. 
 
  MOVE: 'BT'	 TO FL_DATE-OPTION, 
		'19960101' TO FL_DATE-LOW, 
		'19960630' TO FL_DATE-HIGH. 
  APPEND FL_DATE. 

When the selection screen is displayed, FL_DATE already contains the selection by the single value SY-DATUM (current date) and the interval from January 1 to June 30, 1996.

When you call a user-defined selection screen using CALL SELECTION-SCREEN, the current contents of the select-options are displayed and can be changed. You can fill the table with any contents beforehand.

Effect

On the selection screen, the

SPA/GPA ID pid is assigned to the left range limit of the selection criterion.

Note

You must specify the memory ID without quotation marks. It can be up to 3 characters long.

Effect

On the selection screen, the matchcode object mobj is assigned to the left range limit of the selection criterion.

Note

You must specify the name of the matchcode object without quotation marks. It can be up to 4 characters long.

Addition 7

... MODIF ID mod

Effect

The specified modification group (SCREEN-GROUP1), which can be used for screen modifications, is assigned to the screen fields.

Example

TABLES SAPLANE. 
... 
SELECT-OPTIONS S_PTYPE FOR SAPLANE-PLANETYPE MODIF ID ABC. 
... 
AT SELECTION-SCREEN OUTPUT. 
LOOP AT SCREEN. 
  IF SCREEN-GROUP1 = 'ABC'. 
	SCREEN-INTENSIFIED = '1'. 
	MODIFY SCREEN. 
  ENDIF. 
ENDLOOP.

Effect

Does not display the selection on the selection screen. Creates the internal table sel as with 'normal' selection options and you can then transfer the selection option with SUBMIT.

These selection options represent a part of the interface which the user does not see on the selection screen. You can set the values either internally (through the routine INIT in SAPDBldb or INITIALIZATION in the report) or with SUBMIT. These selection options are also stored for variants.

Sometimes (e.g. when the user has entered particular values for other select-options or parameters), you may want to display these undisplayed selection options on the screen so that the user can enter values. You can do this in the routine PAI of the database program SAPDBldb (for database-specific selection options) or under AT SELECTION SCREEN (for report-specific selection options) by calling a function module ( CALL FUNCTION) or your own screen ( CALL SCREEN).

Alternatively, you can place the select-option on a user-defined selection screen (and not on the standard screen 1000 displayed when you use SUBMIT ). You can then call this screen using CALL SELECTION-SCREEN in AT SELECTION-SCREEN.

Effect

The selection is not case-sensitive (i.e. allows upper and lower case letters).

Effect

The user must enter a value for this selection (in the LOW field).

Effect

The user can only make an entry on one line. Calling the additional "Multiple Selection" screen is not supported and no pushbutton for this appears on the selection screen.

Effect

The selection option is displayed on the selection screen without a 'to' field. The pushbutton for calling the "Multiple Selection" screen appears immediately after the 'from' field.
This addition thus allows you to generate a simplified display on the selection screen. This is particularly useful if you are not making any range selections for this selection option.

On the "Multiple Selection" screen, you can also enter ranges for selection options with "NO INTERVALS".

Effect

This addition is allowed only in reports and for report-specific SELECT-OPTIONS which refer to a field f belonging to a table dbtab of the logical database. Here, the selections entered by the user are not passed directly to the logical database unless the logical database supports Dynamic Selections for dbtab (if Dynamic Selections for dbtab are not supported, the addition has no effect.

This addition can be useful if you only want the selections entered by the user for this SELECT-OPTION to be effective under certain conditions. However, you should be careful when using it: Since the selections have to be checked with CHECK after the records have been read, this has a considerably adverse effect on performance.

Effect

This addition is allowed only for database-specific SELECT-OPTIONS in the include program DBxyzSEL (where xyz = logical database name). It allows you to implement self-programmed value help. (To implement self-programmed value help for report-specific SELECT-OPTIONS, you can use the event key word AT SELECTION-SCREEN ON VALUE-REQUEST FOR ....) If you specify only VALUE-REQUEST (without FOR ... ), the value help refers to both input/output fields of the SELECT-OPTION (i.e. to sel-LOW and sel-HIGH ). Otherwise, it refers only to the specified field. The addition has two effects:

Example

* INCLUDE DBXYZSEL 
... 
SELECT-OPTIONS S_PTYPE FOR SAPLANE-PLANETYPE VALUE-REQUEST FOR LOW. 
... 
 
REPORT SAPDBXYZ DEFINING DATABASE XYZ. 
... 
TABLES SAPLANE. 
... 
FORM S_PTYPE-LOW_VAL. 
... 
  CALL FUNCTION '...'. 
... 
ENDFORM.

Effect

Like VALUE-REQUEST, this addition is allowed only for database-specific SELECT-OPTIONS in the include program DBxyzSEL (where xyz = logical database name).
It allows you to implement self-programmed value help. (To implement self-programmed value help for report-specific SELECT-OPTIONS, you can use the event key word AT SELECTION-SCREEN ON HELP-REQUEST FOR ... ). If you specify only HELP-REQUEST (without FOR ...), the help refers to both input/output fields of the SELECT-OPTION (i.e. to sel-LOW and sel-HIGH) and all other fields linked to the SELECT-OPTIONS: Text to field between LOW and HIGH, assigned comments ( SELECTION-SCREEN COMMENT ... FOR FIELD sel ). Otherwise, it refers only to the specified field.

When the user presses F1, this triggers the FORM routine sel-LOW_HLP or sel-HIGH_HLP in the database access program SAPDBxyz (if it exists). If this addition is specified - and even if the SELECT-OPTION with FOR points to a Dictionary field - this FORM routine is executed when the user presses F1 and the documentation of the Dictionary field is not displayed. You can, for example, branch from the routine sel-LOW_HLP or sel-HIGH_HLP to a function module which displays its own documentation.

Example

* INCLUDE DBXYZSEL 
... 
SELECT-OPTIONS S_PTYPE FOR SAPLANE-PLANETYPE HELP-REQUEST. 
... 
 
REPORT SAPDBXYZ DEFINING DATABASE XYZ 
... 
TABLES SAPLANE. 
... 
FORM S_PTYPE-LOW_HLP. 
... 
  CALL FUNCTION '...'. 
... 
ENDFORM. 
 
FORM S_PTYPE-HIGH_HLP. 
... 
  CALL FUNCTION '...'. 
... 
ENDFORM.

Effect

This addition allows you to shorten the visible length of the corresponding screen field on the selection screen to vlen.

Related

PARAMETERS, SELECTION-SCREEN, AT SELECTION-SCREEN, CALL SELECTION-SCREEN