Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select-option & Parameters

Former Member
0 Likes
5,557

Diffrrence between Select-Options & Parameters.

Thanks.

Khan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,592

hi khan,

These are the difference between select-options and parameters.

select-options :

1)select option creates a selection table consisting of 4 fields SIGN, OPTION, HIGH, LOW.

2)select option gives us a range for selection.

3)V can't create radio button and checkbox using select-options.

Parameters :

1)It will not create any selection table.

2)it will allow to give only one value.

3)V can define radio button and checkbox.

Regards...

Arun.

Reward points if useful.

8 REPLIES 8
Read only

Former Member
0 Likes
2,592

Hello,


Syntax Diagram 
PARAMETERS 


Basic form 
PARAMETERS p. 

Additions: 
1. ... DEFAULT f 
2. ... TYPE type 
3. ... DECIMALS dec 
4. ... LIKE g 
5. ... MEMORY ID pid 
6. ... MATCHCODE OBJECT mobj 
7. ... MODIF ID modid 
8. ... NO-DISPLAY 
9. ... LOWER CASE 
10. ... OBLIGATORY 
11. ... AS CHECKBOX 
12. ... RADIOBUTTON GROUP radi 
13. ... FOR TABLE dbtab 
14. ... FOR NODE node 
15. ... AS SEARCH PATTERN 
16. ... VALUE-REQUEST 
17. ... HELP-REQUEST 
18. ... VISIBLE LENGTH vlen 
19. ... VALUE CHECK 
20. ... LIKE (g) 
21. ... USER-COMMAND ucom 



Effect 
Defines Program Parameters 


Objects that you define with this statement can have two functions: 


In executable (type 1) programs: 

You can run executable programs using the r SUBMIT statement. The PARAMETERS and SELECT-OPTIONS statements form their interface. This is usually the interface between the program and the user, that is, the parameters and select-options are filled out by the user on the selection screen (see also the NO-DISPLAY addition and the SUBMIT statement without the VIA SELECTION-SCREEN addition). 


In any program (apart from a subroutine pool, that is, a program with type S): 

Objects in a program, defined on a selection screen that is filled out by the user at runtime. 


Notes 
p may be up to 8 characters long. 


As in the DATA statement, the system creates an internal field p in the program. 


You can assign a logical database ldb to an executable program by entering its name in the program attributes. In this case, both the logical database ldb and the executable program can define parameters (and select-options). The parameters belonging to the logical database are defined in an ABAP INCLUDE program DBldbSEL (within the Logical Database Builder). This INCLUDE program occurs both in the database access program SAPDBldb of the logical database and (partially) in the executable program. This makes the database-specific parameters and select-options available to both the database program SAPDBldb and the executable program. 
The parameters that you declare in the executable program are only visible within that program (and not in SAPDBldb). 

Certain additions to the PARAMETERS statement are only permitted in DBldbSEL. 


For each parameter, you should enter an explanatory text under Text elements/Selection texts. This is displayed on the selection screen. You define the texts for the report-specific parameters in the text elements of the report, and those for the database-specific paraemters in the text elements of the database program SAPDBldb. 



Example
PARAMETERS SUM(1). 


This creates a field SUM with type 'C'. If the program is an executable program, a selection screen with an input field for SUM appears directly after the SUBMIT statement. If the statement occurs between SELECTION-SCREEN BEGIN OF SCREEN scrn and SELECTION-SCREEN END OF SCREEN scrn, SUM is displayed on the selection screen scrn when you call it from the program using the CALL SELECTION-SCREEN scrn statement. 



Additional help 
Defining Input Fields for Single Values 


Addition 1 
... DEFAULT f 



Effect 
The parameter has the default value f. 



Notes 
The default value f must be specified in internal format, that is, for example PARAMETERS DATUM LIKE SY-DATUM DEFAULT '19931224', not ... DEFAULT '24.12.1993'. 


The default value g should be a literal, since the value is placed in the parameter p so early in the SUBMIT sel statement that a field g would not actually have a value. The exception to this are some system fields, such as SY-DATUM, which already has a value when the report is started. 

In user-defined selection screens in programs that you do not start using SUBMIT, the DEFAULT value is not placed in the parameter until the selection screen is called for the first time. In this case, you can specify a field g as the default. 



Addition 2 
... TYPE type 


Effect 
The field in the program has the type type. 



Example
PARAMETERS: NUMBER(4) TYPE P DEFAULT 999. 



Addition 3 
... DECIMALS dec 


Effect 
The field in the program is defined with dec decimal places. dec must be a numeric value. 



Notes 
You can only use the addition DECIMALS dec with the addition TYPE P. 

You cannot use types F (floating point), 1, or 2 (6-digit date formats). The same restriction applies to the LIKE addition. 



Example
PARAMETERS: NUMBER(4) TYPE P DECIMALS 2 DEFAULT '123.45'. 



Addition 4 
... LIKE g 


Effect 
Creates the field p with the same attributes as the field g, which has already been declared. g can be an ABAP Dictionary field, or a field in the program that has already been declared. 



Note 
You cannot use the LIKE g and TYPE type additions together. Neither can you specify an explicit length (so, for example, PARAMETERS p(len) LIKE g is not allowed). 



Example
PARAMETERS PROGRAM LIKE SY-REPID. 



Notes 
If g is an ABAP Dictionary field with type CHAR, length 1, and fixed values 'X' and ' ' (defined in its domain), the parameter is always displayed as a checkbox on the selection screen (see also the AS CHECKBOX addition). 


Field attributes on the selection screen: 
The input/output fields on the selection screen have the same attributes as the field g in the LIKE addition (that is, the same type, length, and in the case of ABAP Dictionary fields, the same conversion exit. 

If g is an ABAP Dictionary field, most of its field attributes are updated automatically if you change them in the Dictionary. The exceptions to this are the "Check table" and "Fixed values" attributes. If these change, you must reactivate the program in the ABAP Workbench. The selection screen is then automatically regenerated. 


PARAMETERS may not have a deep type. This applies to both the TYPE and LIKE additions. 


Parameters are displayed on the selection screen up to 45 characters long (scrollable to 132 charactrs). If you define a longer field, either explicitly (like p(200)) or implicitly (using LIKE), the parameter is truncated after the 132nd character on the selection screeen. However, in the SUBMIT statement, you can pass longer paraemters to an executable program if they have been excluded from the selection screen using the NO-DISPLAY addition. If you do not use NO-DISPLAY, the parameter is still truncated, even if you run the program without displaying the selection screen (seeSUBMIT without the VIA SELECTION-SCREEN addition). 



Addition 5 
... MEMORY ID pid 


Effect 
Assigns the memory ID pid to the parameter on the selection screen. This means that when the selection screen appears, the input field contains the last value entered by the user in a field with memory ID pid. 



Note 
Enter the memory ID directly without inverted commas. It may be up to 20 characters long. 



Addition 6 
... MATCHCODE OBJECT mobj 


Effect 
Assigns the matchcode object mobj to the field on the selection screen. 



Note 
Enter the name of the matchcode object directly without inverted commas. It may be up to 4 characters long. 



Addition 7 
... MODIF ID modid 


Effect 
Assigns the screen fields to the modification group (SCREEN-GROUP1), which you can use to modify the screen in the AT SELECTION-SCREEN OUTPUT event (for example, to make fields display only). 



Addition 8 
... NO-DISPLAY 


Effect 
The parameter is not displayed on the selection screen. The corresponding data object is created like a "normal" parameter, and you can pass a value to it in the SUBMIT statement. 

This type of parameter is part of the interface of the program, but it is not displaeyd to the user. You can either set values for these parameters internally (using the INIT routine in SAPDBldb or the INITIALIZATION event in the program), or pass them in the SUBMIT statement. These parameters are also stored in variants. 

If you want the user to be able to fill out the parameter under certain conditions (for example, depending on the values in other parameters or select-options), you can do so in the PAI routine of the database program SAPDBldb (for database-specific parameters), or in the AT SELECTION-SCREEN event (for program-specific parameters) by calling a function module (CALL FUNCTION) or a separate screen (CALL SCREEN). 


Note 
Since the parameter is not generated on the selection screen, you cannot use any formatting additions together with the NO-DISPLAY addition. 



Addition 9 
... LOWER CASE 


Effect 
The parameter allows case-sensitive input. 



Addition 10 
... OBLIGATORY 


Effect 
The user must enter a value on the selection screen. 



Addition 11 
... AS CHECKBOX 


Effect 
The parameter appears as a checkbox on the selection screen. 
Checkbox parameters must have type C and length 1. 

The checkbox is displayed to the left of its corresponding text. You can rearrange this using the SELECTION-SCREEN statement. 

Notes 
You can assign a user command to a checkbox parameter using the USER-COMMAND ucomm addition. 

A parameter can also be displayed as a checkbox even if you do not use the AS CHECKBOX addition. This occurs under the following condition: 
You must have used the LIKE or TYPE addition to define a parameter with reference to an ABAP Dictionary type with field type CHAR and length 1. The corresponding domain must have the two fixed values 'X' and ' '. 

The addition USER-COMMAND ucomm can also cause a parameter to be displayed as a checkbox, even if you have not used the AS CHECKBOX addition. 



Addition 12 
... RADIOBUTTON GROUP radi 


Effect 
The parameter appears on the selection screen as a radio button. All parameters assigned to the same group radi in this way, form a group of radio buttons on the selection screen. When one is selected, all of the others are not selected. The name of the radio button group can be up to four characters long. 
When you define a radio button parameter, you cannot specify a length. However, you can use the LIKE addition to refer to a field with length 1 and type C or the TYPE addition to specify length 1 and type C. 

The addition does not affect the way in which the parameter is displayed (as in the AS CHECKBOX additino). You can arrange the parameters as you like using the SELECTION-SCREEN statement. 



Notes 
You can assign a user command to the radio button group using the USER-COMMAND ucomm addition. Since all of the buttons in the same group have the same command, you can only use this addition with the first parameter in the group. 

A RADIOBUTTON group must have at least two parameters, of which only one (at most) can have a DEFAULT addition. The DEFAULT value must be 'X'. 

In the database INCLUDE DBldbSEL, RADIOBUTTON parameters, like all others, must have the addition FOR TABLE dbtab. All of the parameters in a group must belong to the same table dbtab. 

You cannot use a group name radi in a program if it has already been used in DBldbSEL. 

Unlike in the case of "normal" parameters, the system does not jump to the AT SELECTION-SCREEN ON p event (in fact, it is syntactically not allowed). Instead, there is an event AT SELECTION-SCREEN ON RADIOBUTTON GROUP radi for the entire group. If this event contains a Error or Warning message, the entire radio button group is ready for input when the selection screen is redisplayed. 



Addition 13 
... FOR TABLE dbtab 


Effect 
Assigns the database-specific parameter p to the database table dbtab. 
It only makes sense to use this addition in the database access program of a logical database. 
With database-specific parameters, you need the addition to ensure that the selection screen of an executable program only contains the relevant parameters (that is, those that correspond to tables that are used in the program). 



Addition 14 
... FOR NODE node 


Effect 
Assigns the database-specific parameter p to the node node. 
This addition has the same effect as addition 13. You use it for nodes declared with the NODES statement. 



Addition 15 
... AS SEARCH PATTERN 


Effect 
The database-specific parameter p is created as a complex data object with type SYLDB_SP (defined in type group SYLDB) with the fields HOTKEY (short name for single search helps), STRING (search string) and a complex data object TRANGE that can contain complex selections. 

You use it to select data using search help selections. 

On the selection screen, the first two components appear, along with a pushbutton for entering complex selections, in a box with the text "Selection using search help". 

The user can display possible entries using both the HOTKEY and a search string using F4. Once the user has chosen a single search help or pressed F4 in the "Search string" field, a special dialog box appears, in which he or she can enter a search string. The search string is interpreted generically for each subfield. 

As well as the 'simple' selection, you can also enter complex selections (such as "all cities beginning with 'ABC'") when you press this button. 



Note 
You can only use the AS SEARCH PATTERN addition in the database access program of a logical database. You must use the FOR TABLE addition with it. You can also use it in conjunction with the MODIF ID addition, but not with any other additions. The search help to which the single search helps and the search string refer is specified in the definition of the logical database. 




Example 
Input on selection screen: 

Single search help: 
Customers 
Search string: 
Daniel 
This selects all customers whose names begin with "Daniel". 


Note 
Performance: 
Search help selection allows you to improve the performance of a program considerably, since it is often easier to describe the set of records you want to select using a search help than using the technical key fields of the tables. For example, it is easier to search for a name ("Daniel") than for a customer number ("000043010"). As a result, you are likely to read less data from the database. 



Note 
If a logical database (called, for example, ldb) contains a parameter p defined using AS SEARCH PATTERN, the system always creates an internal table ldb_SP containing all key fields of the records selected using search help selection. The structure of ldb_SP is determined by the relevant collective search help, and is created automatically. The structure is displayed as a comment in the database program in the Logical Database Builder. 


Example 
Search help for table T1 with key field T1-K1. The table ldb_SP would then have the following structure: 

DATA: BEGIN OF ldb_SP OCCURS 100, 
        T1_K1 LIKE T1-K1, 
      END   OF ldb_SP. 


Note 
If the user has entered values for the parameter of the search help, the key fields of the actual database tables are read in the START-OF-SELECTION event according to the selections, and made available to the logical database program in the internal table ldb_SP. After this, the database program can process the records in the subroutine PUT_ldb_SP and use PUT to trigger the corresponding GET events in the executable program. Processing then continues in the same way as with normal data sleection directly from the database. 


Example 
FORM PUT_ldb_SP. 
  SELECT * FROM T1 
    WHERE K1 = ldb_MC-T1_K1 
    FOR ALL ENTRIES IN ldb_SP. 
    PUT T1. 
  ENDSELECT. 
ENDFORM. 

Note 
With search help selection, all fields of the internal table that were filled by the matchcode are flagged in the table SP_FIELDS (the field name is contained in SP_FIELDS-FIELDNAME). The flag is in SP_FIELDS-SUPPLIED). 


Example 
A field F0 has been filled by the search help if the following condition is met: 

IF  SP_FIELDS-FIELDNAME EQ 'F0' 
AND SP_FIELDS-SUPPLIED  NE SPACE. 


Note 
Further documentation: 

Maintenance transaction for logical databases, choose Help → Application help 

In the Editor: Logische Datenbanken (LDB) 


Addition 16 
... VALUE-REQUEST 


Effect 
You can only use this addition for database-specific parameters in the DBldbSEL include. It allows you to program your own value help. You can do this for program-specific parameters using the event keyword AT SELECTION-SCREEN ON VALUE-REQUEST FOR .... The effects of this addition are as follows: 


The field on the selection screen is displayed with a pushbutton for F4 value help. 

When you press the button or F4, the FORM routine p_VAL in the database access program SAPDBldb is triggered (if it exists). This happens even if the paraemter is defined using a LIKE reference to an ABAP Dictionary field - this FORM routine is processed instead of the check table or fixed values of the ABAP Dictionary field being displayed. From the routine p_VAL, you can call a function module that displays a selection of possible values. The contents of the field p at the end of the FORM routine are placed in the corresponding input/output field. 



Example 

* INCLUDE DBXYZSEL 
... 
PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE VALUE-REQUEST. 
... 

REPORT SAPDBXYZ DEFINING DATABASE XYZ. 
... 
TABLES SAPLANE. 
... 
FORM PL_TYPE_VAL. 
... 
  CALL FUNCTION ... 
... 
ENDFORM. 



Addition 17 
... HELP-REQUEST 


Effect 
Like the VALUE-REQUEST addition, this addition is only valid for database-specific parameters in the DBldbSEL include. It allows you to program your own field help. You can do this for program-specific parameters using the event keyword AT SELECTION-SCREEN ON HELP-REQUEST FOR ... erreicht). When the user presses F1, the FORM routine p_HLP in the database access program SAPDBldb is triggered (if it exists). This always happens when you use this addition; even if the parameter is defined with reference to an ABAP Dictionary field, the data element documentation for the field is not displayed. Instead, you can, for example, call a function moduel from the routine p_HLP that displays your documentation. 



Note 
The routine p_HLP is called when you press F1 either on the field p or on a comment belonging to it (SELECTION-SCREEN COMMENT ... FOR FIELD p). 



Example 

* INCLUDE DBXYZSEL 
... 
PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE HELP-REQUEST. 
... 

REPORT SAPDBXYZ DEFINING DATABASE XYZ. 
... 
TABLES SAPLANE. 
... 
FORM PL_TYPE_HLP. 
... 
  CALL FUNCTION ... 
... 
ENDFORM. 




Addition 18 
... VISIBLE LENGTH vlen 


Effect 
Shortens the visible length of a parameter field on the selection screeen to vlen. 



Addition 19 
... VALUE CHECK 


Effect 
Ensures that the value entered in the field is checked against the check table or fixed values defined in the ABAP Dictionary. There must be a LIKE reference to an ABAP Dictionary field. 



Note 
If there is a check table, the full foreign key check is generated. Consequently, all of the ABAP Dictionary fields involved in the check must be filled for the check to be meaningful. 

The check is also performed if the field is empty. You should therefore use the OBLIGATORY addition as well when you use VALUE CHECK. 



Example 


TABLES SBOOK. 
... 
PARAMETERS CARRID LIKE SPFLI-CARRID. 
PARAMETERS CONNID LIKE SBOOK-CONNID VALUE CHECK. 
... 

AT SELECTION-SCREEN OUTPUT. 
  IF CARRID IS INITIAL. 
    SBOOK-CARRID = 'LH'. 
  ELSE. 
    SBOOK-CARRID = CARRID. 
  ENDIF. 



The foreign key check for SBOOK-CONNID uses the current contents of SBOOK-CARRID: 


SELECT * FROM SPFLI WHERE 
  CONNID = CONNID 
  AND CARRID = SBOOK-CARRID. 



In the example, the AT SELECTION-SCREEN OUTPUT event makes sure that a value is placed in field SBOOK-CARRID. 




Addition 20 
... LIKE (g) 


Effect 
In this case, the name of the reference field is specified as the contents of field g at runtime. This allows you to set the attributes of p dynamically. 


Notes 
At runtime, g m ust contain the name of an ABAP Dictionary field. 


If the parameter is program-specific, the system searches for g (and the name of the reference field itself) in the program itself. If the parameter is database-specific, it looks in the database program. 


g must contain the required field name by the time the parameter is first displayed. This means that you must fill g at the latest in the AT SELECTION-SCREEN OUTPUT event (for report-specific parameters), or in the PBO routine in the database program (for database-specific parameters) of the first call of the selection screen on which p appears. 


p is always created as a character field with length 132. The value entered by the user is stored in "internal character format" without formatting. For example, if g contains a reference to a date field, the input is stored in the form YYYYMMDD, or if it refers to a packed number field with decimal places, the input will be stored without thousand separators and decimal point. 


If you defined a selection text for p, the system displays it. Otherwise, it uses the text of the ABAP Dictionary field whose name is in g. 


You should only use this dynamic LIKE reference if you really need to, since the processing required for this parameter on the selection screeen is far more complex than when you use a static type specification. 



Example 


TABLES SBOOK. 
... 
DATA FNAME LIKE TABFIELD-LFIELDNAME. 
PARAMETERS PARDYN LIKE (FNAME). 
... 

INITIALIZATION. 
  FNAME = 'SBOOK-CARRID'. 



The parameter PARDYN appears on the selection screen with the technical attributes of SBOOK-CARRID. The F1 and F4 help are also inherited from SBOOK-CARRID. If FNAME has its own selection text, the system displays it on the selection screen. If it does not have a text, the text for SBOOK-CARRID from the ABAP Dictionary is displayed instead. 




Addition 21 
... USER-COMMAND ucom 


Effect 
This addition is only supported for parameters that are defined as checkboxes or radio buttons. In this case, clicking the parameter triggers the user command ucom, similarly to SELECTION-SCREEN PUSHBUTTON. 


Notes 
Since all parameters of a radio button group have the same user command, you can only use this addition with the first parameter in the group. The user command is then triggered when you click any button in the group. 

If the parameter does not have the RADIOBUTTON GROUP or AS CHECKBOX addition, it must have type Character and length 1. It is then displayed as a checkbox. 



Related 
SELECT-OPTIONS, SELECTION-SCREEN, AT SELECTION-SCREEN, CALL SELECTION-SCREEN 

Syntax Diagram 
SELECT-OPTIONS 


Variants: 
1. SELECT-OPTIONS sel FOR f. 
2. SELECT-OPTIONS sel FOR (f). 


Declaring a variable selection option 


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


In reports (programs with type 1): 



You can execute reports with the SUBMIT statement. The statements SELECT-OPTIONS and PARAMETERS determine the technical interface and the user interface. The parameters and selection options you specify are displayed on the selection screen for the user to enter values (see also the addition NO-DISPLAY or SUBMIT without the addition VIA SELECTION-SCREEN. 



In all programs (except subroutine pools, that is, programs with type S): 



Program-internal objects, that are filled at runtime by user input on selection screens. The SELECT-OPTIONS filled in this way can then be used in the WHERE clause of a SELECT statement for selecting data. 


Notes 
sel may be up to 8 characters long. 


This statement defines an internal table sel with a fixed structure which consists of the fields sel-SIGN, sel-OPTION, sel-LOW and sel-HIGH. While sel-SIGN and sel-OPTION have a fixed format (type character, length 1 and 2 respectively), sel-LOW and sel-HIGH inherit the type and length of their reference field f in variant 1. 


A report can (by means of an entry in the attributes) be assigned to a logical database ldb (see Logical Databases). This means that both the logical database ldb and the report can define selection options (and parameters). You define the (database-specific) selection options in an ABAP/4 include program DBldbSEL (in logical database maintenance). The system then imports this include program into the actual logical database access program SAPDBldb and (partially) into the report. As a result, the database-specific selection options (and parameters) relevant to the report are available both to the database program SAPDBldb and to the report. 
The 'report-specific' selection options are known only in the report (not in SAPDBldb). 
Some SELECT-OPTIONS additions are allowed only in DBldbSEL. The addition 'NO DATABASE SELECTION' can only be used in the report. 


Each line of the internal table sel formulates a condition. If you require precise details about how to formulate these conditions, see the section on the IN operator under Logical Expressions. 


If the user enters a selection on the selection screen, the internal table sel is automatically filled. 
You can use normal ABAP statements to read and manipulate the internal table sel. 


In a SUBMIT statement: 
The selections entered in the database-specific select-options are passed directly to the database for data selection (i.e. no unwanted records are read). This also applies to report-specific SELECT-OPTIONS that refer to a field in a logical database table defined for Dynamic Selections (see also the addition "NO DATABASE SELECTION"). 
You must check report-specific selections that refer to other fields with the CHECK statement (i.e. unwanted records must first be read from the database and discarded afterwards). This process is therefore not as efficient as the process described above. 


Under "Text elements/Selection texts", you should enter a description for each selection criterion sel. This description is displayed on the selection screen. If no such text exists, the name sel of the selection option is displayed instead. 


The LOW and HIGH fields of a selection option are displayed in a length up to 18 bytes long (scrollable up to 45 bytes). If you define a length longer than 45, fields are truncated on the selection screen after the 45th character. This affects the first line of the SELECT-OPTIONS table. You can, however, use SUBMIT to pass longer selection options to a report if they are specified with the addition NO-DISPLAY and thus do not appear on the selection screen. Without NO-DISPLAY, the fields are then truncated whenever the selection screen is processed in the background ( SUBMIT without VIA SELECTION-SCREEN). 



Additional help 
Defining Complex Selections 


Variant 1 
SELECT-OPTIONS sel FOR f. 

1. ... DEFAULT g 
2. ... DEFAULT g ... OPTION xx ... SIGN s 
3. ... DEFAULT g TO h 
4. ... DEFAULT g TO h ... OPTION op ... 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 
In this variant, field f determines the technical attributes of the fields LOW and HIGH, and the mask used for these fields on the selection screen. For example, if you specify a numeric reference field, the user cannot enter non-numeric values. 

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. 


Note 
Field attributes on the selection screen. 


The input/output fields displayed on the selection screen for entry of upper and lower limits have the same attributes for type, length or conversion exits as the field f specified after FOR. 


FOR fields f of the type F (floating point number), 1 or 2 (6-character date format) are not allowed. 



SELECT-OPTIONS may not refer to a field that has a deep type. 


If f is a Dictionary field, the selection screen is regenerated automatically after most changes to its attributes. The attributes 'Check table' and 'Fixed values' are exceptions to this rule. If these are changed, you have to generate the program in the ABAP Editor. This also generates the selection screens. 


Addition 1 
... DEFAULT g 


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


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


You must specify the default value g in its internal format, e.g. "SELECT-OPTIONS DATE FOR SY-DATUM DEFAULT '19931224'", not "... DEFAULT '24.12.1993'". 


The default value g should normally be a literal because, at runtime when you use SUBMIT, it is transferred to the selection options table sel so early that no value can be assigned to the field g. System fields like SY-DATUM are an exception here because the system usually assigns values to them as soon as the report processing starts. 


When you use user-defined selection screens in your programs that you do not call using SUBMIT, the DEFAULT value is transfered when the selection screen is first called. In this case, therefore, you can use other fields g. 


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


Addition 2 
... DEFAULT g ... OPTION op ... SIGN s 

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


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


Addition 3 
... DEFAULT g TO h 

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


Addition 4 
... DEFAULT g TO h ... OPTION op ... SIGN s 

(op is OPTION, that is, 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. 



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



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. 



Addition 5 
... MEMORY ID pid 

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. 


Addition 6 
... MATCHCODE OBJECT mobj 

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 modid 


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. 



Addition 8 
... NO-DISPLAY 


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. 


Addition 9 
... LOWER CASE 

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


Addition 10 
... OBLIGATORY 

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


Addition 11 
... NO-EXTENSION 

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. 


Addition 12 
... NO INTERVALS 

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. 


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


By combining this addition with "NO-EXTENSION", you can restrict the user to entry of a single value for the selection option, but with the possibility of also choosing single value options like 'Greater than' or 'Less than or equal'. 


By using the addition " NO INTERVALS" with SELECTION-SCREEN BEGIN OF BLOCK, you can activate the simplified display for all selection options in a block. 


The function module SELECT_OPTIONS_RESTRICT allows you to restrict the set of selection options available for a SELECT-OPTION (for example, only single values and patterns, i.e. 'EQ' and 'CP' are allowed). You can also forbid the leading sign 'E' (= 'Exclude from selection'). This means that you can considerably restrict the selections which can be entered on the selection screen. 


Addition 13 
... NO DATABASE SELECTION 

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. 


Addition 14 
... VALUE-REQUEST 

Addition 15 
... VALUE-REQUEST FOR LOW/HIGH 

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: 


The affected input/output fields are displayed on the selection screen with the pushbutton for F4 (possible entries). 


When the user presses this button or F4, this triggers the FORM routine sel-LOW_VAL or sel-HIGH_VAL 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 F4 and the check table or the fixed values of the Dictionary field are not displayed. You can, for example, branch from the routine sel-LOW_VAL or sel-HIGH_VAL to a function module which offers a selection list of possible values. At the end of this FORM routine, the contents of the field sel-LOW or sel-HIGH are copied to the appropriate input/output field. 



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. 



Addition 16 
... HELP-REQUEST 

Addition 17 
... HELP-REQUEST FOR LOW/HIGH 


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. 



Addition 18 
... VISIBLE LENGTH vlen 

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



Variant 2 
SELECT-OPTIONS sel FOR (f). 

Additions as in variant 1. 


Effect 
In this variant, (f) must be a field containing the name of the actual reference field at runtime. The system creates the LOW and HIGH fields as character fields with length 45. However, their appearance on the selection screen is inherited from the reference field whose name is contained in field f at runtime. 


Notes 
f must contain the name of an ABAP Dictionary field at runtime. 


This variant is only supported for report-specific SELECT-OPTIONS (unlike the corresponding "dynamic" variant of the LIKE relationship in PARAMETERS). 


f must contain the required field name by the time the parameter is to be displayed for the first time. This means that it must be filled in or before AT SELECTION-SCREEN OUTPUT (for report-specific SELECT-OPTIONS) or in the PBO routine in the database program (for database-specific SELECT-OPTIONS) containing the first call to a selection screen containing sel. 


The input entered by the user is stored in LOW and HIGH in external format with no formatting sign, that is for example, as YYYYMMDD for a date field, or without thousand separators, and with the period as the decimal separator for a packed number. 


The system displays any defined selection text for sel, otherwise, it uses the text from the ABAP Dictionary field whose name is in f. 


You should only use this "dynamic" variant of the FOR relationship when absolutely necessary, since the selection screen processing is less efficient than with the "static" variant. 


The dynamic variant does not support the CHECK sel. 


Example 


... 
DATA FNAME LIKE TABFIELD-LFIELDNAME. 
SELECT-OPTIONS SELDYN FOR (FNAME). 

... 

INITIALIZATION. 
FNAME = 'SFLIGHT-SEATSMAX'. 



The SELECT-OPTION appears on the selection screen with the technical attributes of SFLIGHT-SEATSMAX. It also adopts the F1 and F4 help of that field. If FNAME has its own selection text, the system displays it. Otherwise, it displays the selection text for SFLIGHT-SEATSMAX as defined in the ABAP Dictionary. 


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

Vasanth

Read only

Former Member
0 Likes
2,592

HI

Select-Options for multiple entries

Parameters for single entries

Regards

Suresh.D

dsk

Read only

Former Member
0 Likes
2,592

Hi Khan,

ifference between Select-Options and Parameters

The main difference between select-options and parameters is that the select-option creates a selection table consisting of 4 fields.

Please go thru the following details to learn more bout it...

Description of the individual components:

SIGN

The data type of SIGN is C with length 1. The contents of SIGN determine for each row whether the result of the row condition is to be included in or excluded from the resulting set of all rows.

Possible values are I and E.

– I stands for "inclusive" (inclusion criterion - operators are not inverted)

– E stands for "exclusive" (exclusion criterion - 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. These operators are the same as those that are used for logical expressions. Yet operators CP and NP do not have the full functional scope they have in normal logical expressions. They are only allowed if wildcards ( '*' or '+' ) are used in the input fields.

If wildcards are entered on the selection screen, the system automatically uses the operator CP. The escape character is defined as #.

– If HIGH is filled, you can use BT (BeTween) and NB (Not Between). These operators correspond to BETWEEN

and NOT BETWEEN that you use when you check if a field belongs to a range. You cannot use wildcard characters.

- LOW

The data type of LOW is the same as the column type of the database table, to which the selection criterion is linked.

– If HIGH is empty, the contents of LOW define a single field comparison. In combination with the operator in OPTION, it specifies a condition for the database selection.

– If HIGH is filled, the contents of LOW and HIGH specify the upper and lower limits for a range. In combination with the operator in OPTION, the range specifies a condition for the database selection.

- HIGH

The data type of HIGH is the same as the column type of the database table, to which the selection criterion is linked. The contents of HIGH specify the upper limit for a range selection.

The parameter statement does not create a selection table .

The second thing is select-option gives us a range for selection, whereas parameter doesn't .

Using the parameter you can define radio buttons and checkboxes where as select-options can't .

Thanks.

Read only

0 Likes
2,592

Good day,

please could you explain a little more about "You cannot use wildcard characters." ?

f HIGH is filled, you can use BT (BeTween) and NB (Not Between). These operators correspond to BETWEEN

and NOT BETWEEN that you use when you check if a field belongs to a range. You cannot use wildcard characters.

Basically I need to E(Exclude) BT(Between) A* and Z, I mean to take anything that is not in the interval [A, ...., Z*], I mean that not start with a letter for example "/A1" this start with "/" instead of a letter.

So I would like to know if this variant specify that I want.

[] 1000 Tables for Conversion S E BT A* Z*

1000 CONVERT P

1000 RE_NAME P X

1000 CHECK P

1000 TEST P

1000 Number of Entries per Commit P 10.000.000

1000 New Logical System Name P VQ1CLNT810

1000 Old Logical System Name P VPRCLNT810

For this second variant, I would like to understand that I'm excluding not between A* and Z* and I think that this is the same if I say I(include) BT(Between) A* and Z* right?

][ 1000 Tables for Conversion S E NB A* Z*

1000 CONVERT P

1000 RE_NAME P X

1000 CHECK P

1000 TEST P

1000 Number of Entries per Commit P 10.000.000

1000 New Logical System Name P VQ1CLNT810

1000 Old Logical System Name P VPRCLNT810

Thank you very much for this excelent forum and for this excelent article or forum, nobody could explain me how this parameter until I found this forum.

Thank you very much for your support and for your time!

best regards

Javier Manzano

Read only

Former Member
0 Likes
2,592

Hi

Parameter allows a single value as input parameter, SELECT-OPTION allows to multiples entries or values ranges as input parameters.

Max

Read only

Former Member
0 Likes
2,592

HI,

parameters is for inputing a single value.

select-options is for inputing a particular range,exclising values,exclusing ranges.

select-options will create an internal table internally(with fields LOW,HIGH,SIGN,OPTION)

rgds,

bharat.

Read only

Former Member
0 Likes
2,593

hi khan,

These are the difference between select-options and parameters.

select-options :

1)select option creates a selection table consisting of 4 fields SIGN, OPTION, HIGH, LOW.

2)select option gives us a range for selection.

3)V can't create radio button and checkbox using select-options.

Parameters :

1)It will not create any selection table.

2)it will allow to give only one value.

3)V can define radio button and checkbox.

Regards...

Arun.

Reward points if useful.

Read only

kiran_k8
Active Contributor
0 Likes
2,592

Khan,

You have got tonnes of info.Just some additional info:-

If you are using select options then it is mandatory to mention the table name in the tables statement.

<b>tables:vbak.</b>

select-options vbeln for vbak-vbeln.

K.Kiran.