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

small doubt in ranges

Former Member
0 Likes
986

Hi,

I need to check a value is there or not in a range. Can somebody tell me the logic please.

r_ranges is having company code ranges like...

I EQ 1001 1004

I EQ 2001 2006

I EQ 3001 3009

I EQ 4001 4007

Now I want to check a variable is there in the above range or not.

Can somebody tell me the logic.

<removed_by_moderator>

Cheers.

Edited by: Julius Bussche on Oct 28, 2008 4:15 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
965

Before trying logic, correct the range. The option you should be using is 'BT', not 'EQ'.

Rob

Hi,

I need to check a value is there or not in a range. Can somebody tell me the logic please.

r_ranges is having company code ranges like...

I EQ 1001 1004

I EQ 2001 2006

I EQ 3001 3009

I EQ 4001 4007

Now I want to check a variable is there in the above range or not.

Can somebody tell me the logic.

<removed_by_moderator>

Cheers.

Edited by: Julius Bussche on Oct 28, 2008 4:15 PM

8 REPLIES 8
Read only

naimesh_patel
Active Contributor
0 Likes
965

Check like:


IF W_BUKRS IN R_BUKRS.
  WRITE: ' IT IS VALID'.
ELSE.
  WRITE: 'NOT VALID'.
ENDIF.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
965

Try:


IF v_ccode IN r_ranges.
    "Company code exist in range.
ELSE.
    "Company code does not exist.
ENDIF.

Read only

Former Member
0 Likes
965

Hi,

Use something like

if v_variable in r_range.
endif.

or

if not v_variable in r_range.
endif.

Darren

Read only

0 Likes
965

When I use

if v_variable in r_range.

endif.

It is checking only lower limit of the range. Ex: if ranges contains I EQ 1001 1006. If I check the value 1003, If condition is failed.

What to do.

Regards,

Read only

0 Likes
965

Hi,

The filling up the range table is incorrect. When you have Low as well as High value means range.. you can't use 'EQ' as option instead use 'BT'.

Hope this helps.

Regds,

R

Read only

0 Likes
965

>

> It is checking only lower limit of the range. Ex: if ranges contains I EQ 1001 1006. If I check the value 1003, If condition is failed.

Check my answer above.

Rob

Read only

Former Member
0 Likes
966

Before trying logic, correct the range. The option you should be using is 'BT', not 'EQ'.

Rob

Read only

Former Member
0 Likes
965

Do what Rob suggested, do not use EQ, use BT. EQ = equal = single value. BT = Between = range.