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

difference between ranges and select -options

Former Member
0 Likes
1,040

Hi,

Please provide example code describing the difference between ranges and select-option.

Regards,

Deepthi Reddy

1 ACCEPTED SOLUTION
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
797

Hi,

Selection options is for you to create a field on the selection screen. Where as TYPE RANGE OF does not create you any field on the screen it only gives you an internal table with similar structure.

So use range tables if you want to pass data to a selection screen when you submit to a program with selection screen or when you want to pass data to FM.

There is no difference in structure only difference is to get an input field on the selection screen.

Regards,

Sesh

6 REPLIES 6
Read only

Former Member
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
798

Hi,

Selection options is for you to create a field on the selection screen. Where as TYPE RANGE OF does not create you any field on the screen it only gives you an internal table with similar structure.

So use range tables if you want to pass data to a selection screen when you submit to a program with selection screen or when you want to pass data to FM.

There is no difference in structure only difference is to get an input field on the selection screen.

Regards,

Sesh

Read only

Former Member
0 Likes
797

Hi,

Select-options are the normal select options that you define on Selection screen.

While Ranges are similar to Select options in the way it creates a internal table of the same form as that of Select-options. The internal table that is created has the fields

HIGH

LOW

SIGN

OPTION.

But the difference between Select-options and ranges are that we don't need to define the ranges in Selection screen. It is created by explicitly coding in the Program. (see Example below). And we can fill the internal table for ranges in the program code itself and then can use it in the same manner as we use Select-option of screen

Example: Here r_belnr is range while s_bukrs and s_gsber is Select-options.

Here i have defined a range and then filling it internally in the program coding and then using it in select query.

TYPES: ty_belnr TYPE RANGE OF bkpf-belnr.

DATA: r_belnr TYPE ty_belnr WITH HEADER LINE.

LOOP AT i_bkpf INTO wa_bkpf.

r_belnr-sign = 'I'.

r_belnr-option = 'EQ'.

r_belnr-low = wa_bkpf-belnr.

APPEND r_belnr.

ENDLOOP.

CLEAR r_belnr.

SELECT belnr

aufnr

FROM bseg

INTO TABLE i_bseg

FOR ALL ENTRIES IN i_aufk

WHERE bukrs IN s_bukrs

AND belnr IN r_belnr

AND gjahr EQ p_gjahr

AND gsber IN s_gsber

AND aufnr EQ i_aufk-aufnr.

Hope now u have got the difference between Select-options and ranges. Get back to me if u still ahve doubts.

Regards,

Nitin

P.S. : Award points if the answer is helpful.

Read only

Former Member
0 Likes
797

They are the same, except SELECT-OPTIONS will provide an interface on the selection screen for the user to input data. For SELECT-OPTIONS, system implicitly creates the select options internal table which contains the fields of SIGN, OPTION, LOW & HIGH. But in case of RANGES, this internal table should be defined explicitly.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
797

Hi deepthi,

1. Normally no difference.

2. Select-option : shows some entry element on screen, thats all.

3. The underlying internal table of 4 fields, is same in both case.

regards,

amit m.

Read only

Former Member
0 Likes
797

Techinically speaking:

ranges s_matnr foe mara-matnr. = select-options s_matnr for mara-matnr no-display.

Regards,

ravi