Application Development 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: 

how to read the ranges

Former Member
0 Kudos

hai gurus can any one tell me how to read the values specified in the ranges, i have assigned low and high values and when i am trying to read the values in teh range in to my program it is reading only the first value

can any one tell me how to get the complete range of values

thanx in advance

afzal

1 ACCEPTED SOLUTION

Former Member
0 Kudos

When u give low and high values..

SIGN : I

OPTION : BT ( between )

LOW: 1

HIGH: 10

So it will check values from 1 and 10.

Reward if helpful

Regards

Prax

10 REPLIES 10

Former Member
0 Kudos

u can loop at that range table and u can tead it

<b>REWARD POINTS IF USEFUL</b>

Former Member
0 Kudos

Hi

it is an internal table of the same name as your range name

assign a '[]' after your range name , ex s_range[] to see complete values

or s_range-low, s_range-high would give you the low and high values respectively.

where s_range is name of your select range

Thanks & regards

Ravish Garg

<b>REMEBER REWARD POINTS IS THE BEST WAY TO SAY THANK YOU</b>

Former Member
0 Kudos

When u give low and high values..

SIGN : I

OPTION : BT ( between )

LOW: 1

HIGH: 10

So it will check values from 1 and 10.

Reward if helpful

Regards

Prax

0 Kudos

hai as u said i am looping but to pick the value which field should i use , for examle i declraed the ranges for kunnr and i used the sign i and option bt

but when i am looping i want individual values to be assigned to some other variable then which value should i take i mean should i read the low value or hgih value

afzal

0 Kudos

then u have to do some extra coding i think

u can do..

data: temp type i.

data: val like wa-low.

LOOP AT r_tab into wa.

if wa-sign = 'I' and wa-option = 'BT'.

temp = wa-high - wa-low.

do temp times.

if sy-subrc ne 0.

exit.

endif.

val = wa-low + 1.

move val to ( your desired targetr )

enddo.

endif.

ENDLOOP.

It may help u..

Regards

Prax

0 Kudos

Hi

to access the low value alone, use <b>s_range-low</b>

to access high value use <b>s_range-high</b>

hope this solves your problem.

regards

ravish garg

0 Kudos

In the range you have LOW and HIGH fields.

SIGN : I for include, E for exclude

OPTIONS : EQ, NE, BT and the like.

If you want to get all ranges value use range-LOW and range-HIGH (HIGH when OPTIONS = BT)

If you want to get all values in the range, you have to read from database the table behind.

SELECT WHERE field IN range INTO TABLE table_of_value.

And then read the resulting table.

Regards

0 Kudos

The code I paste here... will read not only LOW and HIGH but all the values of the range for BT option, you can use all values.but this works only for number ranges.

Regards

Prax

raymond_giuseppi
Active Contributor
0 Kudos

RANGES and SELECT-OPTIONS are internal tables, you have to LOOP AT those.

Regards.

Former Member

Hi plz check this code :


DATA:  r_tab TYPE RANGE OF i.
DATA:  wa LIKE LINE OF r_tab.

DATA:  temp TYPE i.
DATA:  val TYPE i.

wa-sign = 'I'.
wa-option = 'EQ'.
wa-low = '1'.
APPEND wa TO r_tab.
CLEAR wa.

wa-sign = 'I'.
wa-option = 'BT'.
wa-low = '3'.
wa-high = '10'.
APPEND wa TO r_tab.

LOOP AT r_tab INTO wa.

  IF wa-option = 'BT'.
    temp = wa-high - wa-low + 1.
    DO temp TIMES.
      val = wa-low + sy-index - 1.
      WRITE:/ val.

    ENDDO.

  ENDIF.

ENDLOOP.

This is modified code..earlier one has some syntax problems...

but this will work only for number ranges

Reward if useeful

Regards

Prax