‎2010 Jul 19 12:24 PM
i have an internal table with 8 fileds .one of the fileds ie field2 is blank for some records.
that field is same for all the same order numbers.
suppose if i have 3 order numbers 123454 then the filed will be same for all the three records because
the order number is same. How to update that field.
field1 field2 field3
1234 utxy order
1234 -- order
1234 utxy order
1244 iiii order
1244 iiii order
1244 -- order
here the 2nd record filed2 should be utxy and the last record field2 should be iiii.
please tell how to update this missing fields in the internal table.
‎2010 Jul 19 12:44 PM
Hi,
giving couple of options.
1>
lv_index = 1.
sort itab by field1.
Loop at itab into watab.
lv_index = lv_index + 1.
read table itab into watab1 index lv_index. (reads the second record).
if watab1-field2 eq space.
watab1-field2 = watab-field2.
modify itab from watab1 index lv_index.
else.
continue.
endif.
endloop.
2>
itab1[] = itab[].
loop at itab into watab.
loop at itab1 into watab1 where field1 = watab-field1
and field2 = space.
watab1-field2 = watab-field2.
modify itab1 from watab1 transporting field2.
endloop.
endloop.
Regards,
Nagaraj
‎2010 Jul 19 12:33 PM
LOOP AT ITAB INTO WA_TAB WHERE FIELD2 = ' '.
READ TABLE ITAB INTO WA1_TAB WITH KEY ORDER EQ WA_TAB-ORDER
FIELD2 <> ' '.
IF SY-SUBRC = 0.
WA_ITAB-FIELD2 = WA1_FIELD2-FIELD2.
MODIFY ITAB FROM WA_ITAB TRANSPORTING FIELD2.
ENDIF.
ENDLOOP.
Thanks and regards
Amit Singla
‎2010 Jul 19 12:44 PM
Hi,
giving couple of options.
1>
lv_index = 1.
sort itab by field1.
Loop at itab into watab.
lv_index = lv_index + 1.
read table itab into watab1 index lv_index. (reads the second record).
if watab1-field2 eq space.
watab1-field2 = watab-field2.
modify itab from watab1 index lv_index.
else.
continue.
endif.
endloop.
2>
itab1[] = itab[].
loop at itab into watab.
loop at itab1 into watab1 where field1 = watab-field1
and field2 = space.
watab1-field2 = watab-field2.
modify itab1 from watab1 transporting field2.
endloop.
endloop.
Regards,
Nagaraj