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

Coding

Former Member
0 Likes
841

What is ranges ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
821

hi,

ranges is like select options which used before versions of sap 4.7

ranges works similar to select-options but difference is that for ranges we have to explicitly give all values as it doesnt reqiure for select options

ex:

ranges:matnr like mara-matnr.

matnr-low = 'value'.

matnr-high = ''value'.

matnr-sign = ' e or i'. [include or exclude]

matnr-option=' bt r eq r ne'. [between or equal or notequal or in ....]

but for select-options this type of assignment isn't mandatory.

if helpful reward some points.

with regards,

suresh babu aluri.

9 REPLIES 9
Read only

Former Member
0 Likes
821

Hi

refer

Hope this solves your purpose.

Award points if it helps.

-Gaurang

Read only

former_member673464
Active Contributor
0 Likes
821

hi..

In addition to selection tables that you create using SELECT-OPTIONS, you can use the RANGES statement to create internal tables that have the structure of selection tables. You can use these tables with certain restrictions the same way you use actual selection tables.

regards,

veeresh

Read only

Former Member
0 Likes
821

Hi

Ranges is similar to select-options which we declare on the selection screen

when we declare ranges a selection table (internal table) is created with 4 fields like

SIGN, OPTION, LOW and HIGH and the values are populated into ranges.

When we use select-options we will give sequencial values for that field where as for ranges we use any number (non-sequencial) and use it in the where condition similar to select-options.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
821

ranges is for selection criteria which does not have internal table implicitly. One can define that externally.

Regards

Read only

Former Member
0 Likes
821

ranges refer to the range of values for a given field.

example

ranges : r_matnr for matnr.

r_matnr-sign = 'I'.

r_matnr-options = 'EQ'.

r_matnr-low = '4000000'.

r_matnr -high = '8000000'.

append r_matnr.

clear r_matnr.

Reward with points if helpful.

Read only

Former Member
0 Likes
821

Hai,

SELECT-OPTIONS - On the selection screen, you can declare RANGES on the selection screen.

RANGES - Inside the program, if you want to have variable with RANGES option, use the RANGES variable. You cannot declare and use SELECT-OPTIONS inside the program.

For more information refer the below links:

check out this link

http://www.sap-img.com/abap/difference-between-select-options-ranges.htm

For Eg :

TABLES mara.

SELECT-OPTIONS : material FOR mara-matnr.

INITIALIZATION.

material-LOW = 1001. " It specifies the range starting value.

material-HIGH = 0000. " It specifies the range ending value.

material-OPTION = 'EQ'. " specifies ranges value is in equal.

material-SIGN = 'I'. "specifies both inclussive.

APPEND material .

SELECT * FROM mara INTO TABLE ITAB

WHERE matnr IN material.

RANGES:

RANGES: material FOR mara-matnr.

Hope it helps you.

Regards,

Kumar.

Read only

Former Member
0 Likes
821

<b>Hi,

All the above facts is obvious. Even internally the Select-Options uses Ranges.</b>

eg:

SELECT-OPTIONS: S_MATNR FOR MARA-MATNR NO-EXTENSION

ranges : S_matnr for matnr.

s_matnr-sign = 'I'.

s_matnr-options = 'EQ'.

s_matnr-low = '00000000000000106'.

s_matnr -high = '00000000000000109'.

append s_matnr.

clear s_matnr.

The practical use of ranges will be when using screen painter, and where there will be a situation where we need to get high and low values using I/O fields.

In that case, the value obtained from i/o fields can be taken put in ranges and making it as a selection criteria thereby helpful to fetch list to the internal table.

Read only

Former Member
0 Likes
822

hi,

ranges is like select options which used before versions of sap 4.7

ranges works similar to select-options but difference is that for ranges we have to explicitly give all values as it doesnt reqiure for select options

ex:

ranges:matnr like mara-matnr.

matnr-low = 'value'.

matnr-high = ''value'.

matnr-sign = ' e or i'. [include or exclude]

matnr-option=' bt r eq r ne'. [between or equal or notequal or in ....]

but for select-options this type of assignment isn't mandatory.

if helpful reward some points.

with regards,

suresh babu aluri.

Read only

Former Member
0 Likes
821

answered