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-options and Parameters, when to use what?

Former Member
0 Likes
27,243

Hi gurus,

I have been using Parameters for long. Now I want to choose a range of values, which I need to retrieve from database.

I tried using select-options. Can't I use 2 parameters that is parameter1 and parameter2 and mention query BETWEEN para1 AND

para2, and when I use NO INTERVALS and NO EXTENSION together, it behaves same like parameter, then why did SAP gave these

extensions.

Hi gurus,

I have been using Parameters for long. Now I want to choose a range of values, which I need to retrieve from database.

I tried using select-options. Can't I use 2 parameters that is parameter1 and parameter2 and mention query BETWEEN para1 AND

para2, and when I use NO INTERVALS and NO EXTENSION together, it behaves same like parameter, then why did SAP gave these

extensions.

10 REPLIES 10
Read only

Former Member
0 Likes
11,137

hi...

with parameters you can give only single value as input.

select-option is used when we have to give complex selection criteria which can be as

any one of following or combination of following.

single values.

range of values.

excluding single value.

excluding range.

for more detail you can refer

http://help.sap.com/saphelp_46c/helpdata/en/9f/dba78735c111d1829f0000e829fbfe/frameset.htm

along with this there is difference in functionality of both....

if parameter is empty it will return no selection.

if selet-option is space it will return all records

regards

Read only

GauthamV
Active Contributor
0 Likes
11,137

You have half the answer in your question itself.

Select options for ranges and parameters for single value.

It depends on requirement when to use what..

For example if you want company code specific details

you can use prameters.

If parameters is space it will not fetch any data ,i.e sy-subrc = 4.

If select options is space it will fetch all the records,i.e sy-subrc =0.

Hope your confusion is cleared.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
11,137

Hi,

Select-options works as ranges and parameters both.

But in case you want to include/exclude certain value to be used in query, then you can do this using select-options only as you get a button next to the high value.

If you use two parameters, then in that case you need to design that button and handle it, but with select-options you need not to worry about its functionality.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
11,137

Hi,

If you specify NO INTERVALS, NO EXTENSION then input will show like parameter only,

1) but you can specify more than one input values in a variable specified with select-options but where as at parameter variable you can specify only single value.

2) one big diffrence is if input is not specified at paramaeter input variable, the select statement will not fetch data and if you not specified Select-option input variable then select statement will fetch all records for that table.

Regards,

Sunil

Read only

Former Member
0 Likes
11,137

Hello Nazeer,

SELECT-OPTIONS is special form of PARAMETERS.

The major difference between SELECT-OPTIONS and Parameters , is SELECT-OPTIONS can include or exclude the values, which Parameters cannot.

Moreover, when SELECT-OPTIONS are given with NO-EXTENSIONS and NO INTERVALS, it looks like Parameters, but behave differently.

Let me give an example:

PARAMETERS:
  p_vbeln TYPE vbap-vbeln.

DATA:
  w_vbeln TYPE vbap-vbeln.
SELECT-OPTIONS:
  s_vbeln FOR w_vbeln NO-EXTENSIONS NO INTERVALS.

1. select * from vbap into table t_vblen where vbeln eq p_vbeln.


2. select * from vbap into table t_vbeln where vbeln in s_vbeln.

In 1st statement, when p_vbeln value is null, no record is retrieved.

In 2nd statement, when s_vbeln value is null, all records are retrieved.

Hope it helps you.

Thanks: Zahakson

Read only

awin_prabhu
Active Contributor
0 Likes
11,137

Hi friend,

Simple differences between Select-options and parameters.

Select-Options Uses keyword 'for'

Parameters Uses keywords 'like', 'type'

Select-Options Uses operator 'in'

Parameters Uses operator '='

Select-Options Provides ranges for selection

Parameters No ranges only single value

Select-Options Creates selection table

Parameters No selection table

Select-Options When i/p blank all records selected

Parameters When i/p blank none is selected

Note:

Select options can act as parameters by using 'no-extension' 'no intervals', but all records will be selected when i/p is blank unlike parameters.

Might be helpful..

Thanks...

Edited by: Guest77 on Feb 10, 2009 5:44 AM

Read only

Former Member
0 Likes
11,137

Hi,

Parameter is declared for a single value. When we declare a parameter it will not fetch any data(i.e parameter is empty)

Select-option is a complex selection. It will fetch data from database table.

It also has some options like

select single values

selct ranges

exclude single values

exclude ranges

Regards,

Rajani

Read only

Former Member
0 Likes
11,137

Hi,

The main diffrence between select-options and parametrs is,

selct-options gives us a range of selctons but in parameter we can't do that

we can declare parameters as radio buttond and checkboxes but for select-options we can't..

if we mention no-intervals both exhibits the same but select-options occupy the memory where as parametrs does not..

Main difference when selction-criteria...

If we dont mention any values in select-options field at selection-screen it fetches all the values but in Parameters takes as blank value..

Regards

Kiran

Read only

former_member632729
Contributor
Read only

Former Member
0 Likes
11,137

Hi,

In the parameter option you can give only one value,

but with the select-option you can give the value range also you can give the selected value by clicking on the button next to the second input field.