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

selection vs parameter

Former Member
0 Likes
1,630

i am not clear about the differences and where to use selection options,parameter options

7 REPLIES 7
Read only

former_member188827
Active Contributor
0 Likes
1,315

select-options is used where u need to give range of values for selection and paramters is used wen u need to giv a single value as search criteria..

plz reward points if dis helps

Read only

former_member188827
Active Contributor
0 Likes
1,315

SELECT-OPTIONS

Syntax

SELECT-OPTIONS selcrit

FOR {dobj|(name)}

[ screen_options]

[ value_options]

[ldb_options].

Effect

This declares a selection criterion selcrit for a data object dobj or a type specified in name. Selection criteria are components of a selection screen, to which are assigned a selection table in the ABAP program, as well as two input fields and a pushbutton for multiple selection.

The name of the selection criterion selcrit is limited to a maximum of 8 characters. This statement is allowed in the global declaration part of executable programs, function groups and module-pools. In function groups and module-pools it is only allowed within the definition of an independent selection screen. In executable programs it is otherwise automatically assigned to the standard selection screen.

The statement SELECT-OPTIONS has the following effect:

The statement declares a selection table in the program with the name selcrit. A selection table is an internal standard table with header line and standard key. In selection tables, you can save multiple logical conditions . The content of selection screens can be analyzed in a logical expression and in the expression of a WHERE-condition in Open SQL. Selection tables have the following four columns:

sign of type c and length 1. The content of sign determines for every row whether the result of the condition formulated in the column is included or excluded in the entire resulting set for all rows. Evaluable values are "I" for include and "E" for exclude.

option of type c and length 2. option contains the selection option for the condition of the row in form of logical operators. Analyzable operators are "EQ", "NE", "GE", "GT", "LE", "LT", "CP" and "NP" if column high is initial, and "BT", "NB" if column high is not initial. With the options "CP" and "NP", the data type of the columns low and high must be of the data type c, and low must contain at least one wildcard character "" or "*", in which "" masks a single character and "*" a user-defined, even empty, character chain.

low of the data type defined after FOR. This column is designated for the comparison value or the lower interval limitation.

high of the data type defined after FOR. This column is designated for the upper interval limitation.

Two input fields with the name selscrit-low and selscrit-high are created on the current selection screen using a matching external data type in a new line at positions 35 and 60. The length of the input fields bases upon the length of the data type which is defined after FOR. The maximum length of the input fields is 45. The maximum visible length of the input fields is, depending on the nesting depth, in blocks with frames between 10 and 18. If the length is larger than the maximum visible length, then the content is scrollable.

Before the first input field, an automatically generated output field

is displayed as identifier in the first possible position, whose length is, depending on the nesting depth, in blocks with frames between 20 and 30. The output field either contains the name of the selection criterion selcrit, or the selection text which is assigned to the selection criterion in the text elements of the program. If the user requests a field- or input-help on the output field using the function key F1 resp. F4, the same output is displayed as if one of the input fields is chosen.

A pushbutton multiple selection is created after the second input field. If you select this pushbutton, a dialog screen with four tabstrip control pages appears, in which the input fields are again displayed in tabular form in Table Controls. The tabstrip pages are separated based on individual value comparison, interval limitation, and settings for the column sign.

As a user, you can select an input field with a double-click on the selection screen or use the dialog screen for multiple selection. On the selection screen, you can also choose the value for column sign. On the dialog screen for multiple selection, you can do this by selecting the respective tabstrip page. If the selection option is not equal to "EQ" or "BT", then it is displayed as an icon in front of the first input field. The color of the icon is green if the content of column sign is "I", and red if it is "E".

The selection options "CP" and "NP" can be selected only if the first input field contains one of the wildcard characters "*" or "+". If one of these characters is specified, the selection option is automatically set to "CP" when there is a user action.

The attributes of the elements on the selection screen can be influenced with the statement screen_options or the statement SELECTION-SCREEN.

The first row of the selection table selcrit is linked with the input fields on the selection screen. All rows are displayed in the dialog box for multiple selection. Before sending the selection screen, the content of the selection table is transported to the selection screen and displayed in the corresponding location. If the length of columns low and high in the first row of the selection table is larger than 45, then the excessive content is cut off to the right. In remaining rows excessive content is only cut off if the dialog box for multiple selection is displayed. After an user action on the selection screen or in the dialog box for multiple selections, the content of the input fields and the selected settings are transported into the internal table, whereby several events are raised. In doing so, the content of character type fields is converted into upper case by default. All setting regarding the content of the input field can be done in value_options.

If selection criteria are defined in the selection-include of a logical database, further additions ldb_options are necessary resp. possible.

If in an executable program, a selection criterion is defined for a component of a node of the linked logical database, declared by TABLES or NODES, and the node in question is intended for free selection on the logical database, then the selection table is transferred to the logical database after selection screen processing and is treated there as a free selection. Furthermore, in this case, the input fields for the corresponding free selection are displayed directly on the selection screen, without the necessity for the user having to select them via the function free selection.

Note

If a selection criterion for data types is supplied with a length greater than 45 when calling an executable program with SUBMIT, the value of columns low and high in the first row of the selection table are then truncated to the right of position 45. The remaining rows are not truncated. The first row is also not truncated if the selection criterion is declared with the NO-DISPLAY addition.

PARAMETERS

Syntax

PARAMETERS {para[(len)]}|{para [LENGTH len]}

[ type_options]

[ screen_options]

[ value_options]

[ldb_options].

Effect

Declaration of a para parameter of length len. Parameters are components of a selection screen that are assigned a global elementary data object in the ABAP program and an input field on the selection screen.

The name of the para parameter may contain a maximum of eight characters. This statement is permitted in the global declaration part of executable programs, function groups and module pools. In function groups and module pools it is only permitted within the definition of a independent selection screen. In executable programs, it is otherwise automatically assigned to the standard selection screen.

The length len can only be specified if the data type specified in type_options is generic in terms of the length ( c, n, p and x). The length len must be specified as a numeric literal or as numeric constants. If len is not specified, the length is set to 1 for a generic data type, or else it is set to the length of the data type. From Release 6.10, it is possible to specify the length using the LENGTH addition.

In detail, the PARAMETERS statement has the following effect:

The statement declares a global variable para of the specified length in the program. The type of the data object is specified in type_options.

On the current selection screen, an input field with the same name and a suitable external data type is created in a new line at position 35. The length of the input field is aligned with the length of the parameter. The maximum length of the input field is 132. The maximum visible length of the input field is between 39 and 45, depending on the nesting depth in blocks with frames. If the len length is greater than the maximum visible length, the content is displayed as movable.

In front of the input field, in the first possible position, an automatically generated output field is displayed as a description, whose length is between 23 and 30 depending on the nesting depth in blocks with frames. The output field contains either the name of the para parameter or the selection text to which the parameter is assigned in the text elements of the program. If the user requests field or input help on the output field using the F1 or F4 function keys, the same output is displayed as when the input field itself is selected.

The attributes of the elements on the selection screen can be influenced in screen_options and with the SELECTION-SCREEN statement.

Before the selection screen is sent, the content of the para data object is transported to the input field on the selection screen. If the length of the parameter is greater than 132, the content is truncated from the right. After a user action on the selection screen, the content of the input field is transported to the data object, where various events are triggered. The content of character-type fields is converted into uppercase by default. Settings with regarding the content of the input field can be made in value_options.

If parameters are defined in the selection include in the logical database, additional ldb_options additions are necessary or possible.

Note

If a parameter with a length greater than 132 is populated by SUBMIT when an executable program is called, the value is similarly truncated from the right at position 132. It is not truncated only if the parameter is declared with the NO-DISPLAY addition.

plz reward points if dis helps...

Read only

Former Member
0 Likes
1,315

Hi,

select - options

is used to accept the different ranges of values from the user

parameters: used to accept a single value from teh user

if the user want to see the data for a particular sale order then go

for parameter as it accepts only one value

if he want to see the data for multuple sales order then obviousble you have to go for select options

even using the parameter you can get the multiple values

like

select *

from mara into table itabl

where fieldr < p_field

so we will get the values which are less than this p_field..

thanks & regards,

Venkatesh

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,315

Hi,

USE SELECT-OPTIONS when you want to check your DATA for a RANGE, that is if you want to get values from database using a value that is between the RANGE.

Since select-options gives you LOW and HIGH value this gives you a range.

For example you want to see all employees who's birth date is between Jan to Feb then use ranges.

Use PARAMETERS when you want to fetch say only one value.

For example you want to see the details of a bank account, then use PARAMETERS and select ONE account number.

Regards,

Sesh

Read only

Former Member
0 Likes
1,315

Hi,

Difference between parameters and Select-options

1) select options provide ranges where as parameters do not.

2) Select-options creates an internal table with the name you have givenand it will have the folowing 4 fields, (a) SIGN-which can have only two values 'I' (inclusive)or 'E'(exclusive) (b) OPTION-it defines the conditions like GT, LT, EQ, NE,GE etc.

(c) LOW-It difines the lower value and (d) HIGH-It defines the heghest value in the range. Whereas in parameters nothing as such will be created.

3) If you don't enter any value in the parameters and execute it, it will not fetch any record but in case of select-options if you don,t give any value in the ranges and execute it will fetch all the records in the table.

Read only

Former Member
0 Likes
1,315

Hi Sekhar,

When you have requirement of giving ranges foe entering values, we use select options.

Select-Options : S_matnr for Mara-matnr.

Here S_matnr is an internal table having fields :

1. sign

2. option

3. Low - Lower limit

4. High - Higher limit

Parameters are used when you want a enter a single value.

e.g. if you want to enter file name from selection screen then we use parameters.

parameters : p_file like ibipparms-path.

Reward points if helpful.

Regards,

Hemant

Read only

Former Member
0 Likes
1,315

hello,

parameters is used for when we hve to give only one value as a input at one time and select option is used for when we hve to give more than one values as a input at one time .

reward if helpful,

regards

anuj