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 fill Ranges if you do not know low and high values

Former Member
0 Kudos

Hi,

I want to use Ranges in my program as I can use it in my select query as a key field to improve the performance.

But I am not sure about the low and high value of that filed.

I want to populate Low and High value of RUECK to get Lower to Higher values populated in R_RUECK.

Ranges: R_rueck for AFRU-RUECK.

R_rueck-sign = u2018Iu2019.

R_rueck-option = u2018EQu2019.

R_rueck-low = u2018u2019.

R_rueck-high = u2018u2019.

Append R_rueck.

So that R_rueck should have lower to higher value of that filed.

Can some body explain me in detail, how i can acomplish this...or suggest me any way so that it will populate all the values from Lower to Higher

Any suggestios will be apprecaiated!

Regards,

Kittu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

If you don't know the low and high values, then after declaring the R_rueck with ranges statement, no need to populated any thing, by default it will consider all the values.

Let's say if you have few values, let's say if you want 1 to 10 values and in addition you need 15 and 20 values.

In this case, you need to populate as,

R_rueck-sign = u2018Iu2019.

R_rueck-option = u2018BTu2019.

R_rueck-low = u20181u2019.

R_rueck-high = u201810u2019.

Append R_rueck.

R_rueck-sign = u2018Iu2019.

R_rueck-option = u2018EQu2019.

R_rueck-low = u201815u2019.

Append R_rueck.

R_rueck-sign = u2018Iu2019.

R_rueck-option = u2018EQu2019.

R_rueck-low = u201820u2019.

Append R_rueck.

and now use this r_rueck in your select query.

Regards,

Santhosh.

8 REPLIES 8

Former Member
0 Kudos

Hi Kittu,

U better discuss with your functional consulatant what range is required.

regards,

ravibabu.a

Former Member
0 Kudos

Hi,

If you don't know the low and high values, then after declaring the R_rueck with ranges statement, no need to populated any thing, by default it will consider all the values.

Let's say if you have few values, let's say if you want 1 to 10 values and in addition you need 15 and 20 values.

In this case, you need to populate as,

R_rueck-sign = u2018Iu2019.

R_rueck-option = u2018BTu2019.

R_rueck-low = u20181u2019.

R_rueck-high = u201810u2019.

Append R_rueck.

R_rueck-sign = u2018Iu2019.

R_rueck-option = u2018EQu2019.

R_rueck-low = u201815u2019.

Append R_rueck.

R_rueck-sign = u2018Iu2019.

R_rueck-option = u2018EQu2019.

R_rueck-low = u201820u2019.

Append R_rueck.

and now use this r_rueck in your select query.

Regards,

Santhosh.

0 Kudos

Hi Santosh,

Thank you for your quick response!

I have another small query...

We are not sure about the low and high values, it will change.

I want to write a select query to select the Low value and High value from the table..

data : g_low_rueck type afru-rueck.

select single rueck

from afru into g_low

where rueck is low.

How I can i write the same to pick the low value from the table and high value from the table.

Any suggestions will be apprecaiated!

Regards,

Kittu

0 Kudos

If it is changing all the time use a select option in your selection screen instead of ranges. Often used values can be stored in a variant.

0 Kudos

Hello

Look at table NRIV with OBJECT = 'AUF_RUECK'.

Field FROMNUMBER - low value,

field NRLEVEL - Number range status - high value.

0 Kudos

Hi Kittu,

use select-options.

0 Kudos

Hi,

You can use MIN and MAX on that particular field while writing Select query like

Select min(field name) from table. This is LOW value

Select max(field name) from table. This is HIGH value

Use the code below.

TABLES: afru.

SELECT-OPTIONS: s_rueck FOR afru-rueck.

RANGES: r_rueck FOR afru-rueck.

DATA: v_rueck TYPE afru-rueck.

START-OF-SELECTION.

IF s_rueck[] IS INITIAL.

SELECT MIN( rueck ) INTO v_rueck FROM afru.

IF sy-subrc = 0.

r_rueck-sign = 'I'.

r_rueck-option = 'BT'.

r_rueck-low = v_rueck.

CLEAR: v_rueck.

ENDIF.

SELECT MAX( rueck ) INTO v_rueck FROM afru.

IF sy-subrc = 0.

r_rueck-high = v_rueck.

CLEAR: v_rueck.

ENDIF.

IF NOT r_rueck IS INITIAL.

APPEND r_rueck.

ENDIF.

ENDIF.

Regards,

Kumar Bandanadham

Edited by: Velangini Showry Maria Kumar Bandanadham on Jun 2, 2009 9:17 AM

Former Member
0 Kudos

Hi,

Thank you for youR quick response!

Regards,

Kittu