‎2008 May 07 12:50 PM
Hello Every one..
I want to compare a value of a filed in a internal table with a set of values. can u suggest e , how to achieve that.
Ex: i hav val filed in internal table itab.
i want to check all entries of val filed in internal table , wether that value is between 1 to 99 or not.
In the loop of internal table how can i compare wether that valus is between the range or not.
Thanks in advance
Ravi
‎2008 May 07 12:53 PM
Hi,
loop at itab.
if itab-val between 1 and 99.
do some thing.
endif.
endloop.
Regards,
madan.
‎2008 May 07 12:54 PM
Hye Ravi,
suppose u have an internal table with fields A and B
loop at itab into wa.
if wa-A between 1 and 99.
Do ur processing.
endif.
if wa-B > 1 and wa-B < 100.
Do ur processing.
endif.
endloop.
These are the two ways you can do this.
Post the exact requirement so that i can explain u in clarity.
Pls reward if helpful.
Thanks,
Imran.
‎2008 May 07 12:57 PM
declare a range r_range and populate the values as
r_range-sign = 'I'.
r_range-option = 'BT'.
r_range-low = '1'. <-- example
r_range-high = '99'. <-- example
append r_range.
loop at itab.
if itab-field1 in r_range.
else .
endif.
endloop.
‎2008 May 07 12:58 PM
IF wa_tab-price BETWEEN 1 AND 99.
.................
ELSE.
.................
endif.
Regards,
‎2008 May 07 12:59 PM
Hello,
Put all values into an internal table of type range and compare the values using the operator IN.
DATA itab_comparison TYPE RANGE OF itab-field.
itab_comparison-sign = 'I'.
itab_comparison-option = 'EQ'.
itab_comparison-low = 'Value 1'.
APPEND itab_comparison.
itab_comparison-low = 'Value 2'.
APPEND itab_comparison.
...
LOOP AT itab.
IF itab IN itab_comparison.
ENDIF.
ENDLOOP.
Regards,
‎2008 May 20 11:31 AM