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

internal table missing table field update

Former Member
0 Likes
718

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.

1 ACCEPTED SOLUTION
Read only

former_member404244
Active Contributor
0 Likes
531

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

2 REPLIES 2
Read only

Former Member
0 Likes
531

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

Read only

former_member404244
Active Contributor
0 Likes
532

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