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

main difference ( select-options and range)

Former Member
0 Likes
1,211

Hi ,

Could you tell what is main difference between select-options and range.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,071

Both are same..only difference is if you declare the select-options then it will be displayed in the selection screen.

Thanks,

Naren

7 REPLIES 7
Read only

abdul_hakim
Active Contributor
0 Likes
1,071

select-options define an input field on the selection screen whereas ranges doesnt.itz intended for passing range of values for validation.

Cheers,

Abdul Hakim

Read only

Former Member
0 Likes
1,072

Both are same..only difference is if you declare the select-options then it will be displayed in the selection screen.

Thanks,

Naren

Read only

Former Member
0 Likes
1,071

Hi

Basically there is no difference...

For eg:

<b>RANGES</b> sel FOR f.

<b>Effect</b>

Defines an internal table similar to a selection criterion sel defined using the SELECT-OPTIONS sel FOR f statement.

The above statement is identical to:

DATA: BEGIN OF sel OCCURS 10,

SIGN(1),

OPTION(2),

LOW LIKE f,

HIGH LIKE f,

END OF sel.

Note

If you use the IN operator in conjunction with SUBMIT , CHECK , IF , WHILE or SELECT , always define the associated internal table using SELECT-OPTIONS or RANGES (never directly).

While,

Select-options:

Basic form

<b>SELECT-OPTIONS</b> sel FOR f.

Declares a variable selection option.

This statement only makes sense in reports, i.e. in programs defined as type 1 in the attributes. 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 .

sel must be 1 - 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 .

Regards,

Raj

Read only

Former Member
0 Likes
1,071

Range can be said to be programatic representation of select-option. Basically, using Select-Option it displays the field on the selection screen while for range you can populate the same in the ABAP and use in validations.

Regards

Anurag

Read only

Former Member
0 Likes
1,071

There is no diff between select-options and ranges...

select-options s_matnr for mara-matnr.

ranges r_matnr for mara-matnr.

select-options will allow user to enter values on seletion screen, as you know it creates an internal table with the user values. you can use this table in select queries for validation in where condition like where matnr in s_matnr or you can use this also in validataions like 'if ( v_matnr in s_matnr )'.

where as in ranges programmer has to fill the table dynamically in the program it has similar structure as selection table. so you can use it in queries and conditions.

basically when you use either select table or ranges table in a select query it works as 'for all entries in' in a select query.

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,071

Hello Asha

There are only two minor differences between select-options and ranges:

(1) The name of select-options is restricted to 8 characters

(2) Within the program select-options behave like internal tables WITH header line. Ranges do not have header lines.

Regards

Uwe

Read only

Former Member
0 Likes
1,071

There is another difference between select-options and ranges. The select-option can be used in a CHECK statement, but a range cannot:


REPORT ztest MESSAGE-ID 00.

TABLES: bkpf.

SELECT-OPTIONS: s_dat FOR bkpf-budat.

RANGES: r_dat FOR bkpf-budat.

SELECT * FROM bkpf.

  CHECK s_dat.
* CHECK r_dat.

  WRITE: /001 bkpf-budat.

ENDSELECT.

If you uncomment the CHECK r_dat, you should get a syntax error.

I think this is used mainly in logical database programs, but can be used in reports. I doubt if it's recommended there though.

Rob