‎2009 Jan 15 7:27 PM
Hi Guys,
In my internal table there are two fields material and keyfigure.
my requirement is to compare the 1st record with remaining records of internal table.
Ex:
internal table has 10 records with 10 materials
first record of material keyfigure value should compare with remaining 9records of materials keyfigures.
please suggest me with code how to get the second ,third .....records with first record of internal table.
Thanks in Advance
Venkat
Edited by: venkat venkata on Jan 15, 2009 8:27 PM
‎2009 Jan 15 7:55 PM
*move the data to a temporary table
itab1[] = itab[].
* get your first record
read table itab1 into wa_itab
index 1.
*delete the 1st record
DELETE itab1 INDEX 1.
*loop at rest of the records
loop at itab1 into wa_itab1.
*compare the MATNR
if wa_itab1-matnr <> wa_itab-matnr.
" your logic here
endif.
endloop.
‎2009 Jan 15 7:43 PM
data: l_first(1),
begin of itab occurs 0,
matr like --
keyfigure like--
end of itab,
wa_itab like line of itab,
la_itab like line of itab.
clear l_first.
loop at itab into wa_itab.
if l_first eq ' '.
la_itab = wa_itab.
l_first = 'X'.
endif.
write code here comparing la_itab-matr and la_itab-keyfigure with wa_itab values.
endloop.
‎2009 Jan 15 8:15 PM
‎2009 Jan 15 7:55 PM
*move the data to a temporary table
itab1[] = itab[].
* get your first record
read table itab1 into wa_itab
index 1.
*delete the 1st record
DELETE itab1 INDEX 1.
*loop at rest of the records
loop at itab1 into wa_itab1.
*compare the MATNR
if wa_itab1-matnr <> wa_itab-matnr.
" your logic here
endif.
endloop.