Application Development 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: 

update field of an internal table

Former Member
0 Kudos

hi,

i want to update one field of internal table from field from some another internal table whose key field matches.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

do the following:

loop at IT_A into WA_A.(internal table whose field value is to

be updated)

read table IT_B into WA_B with key abc = WA_A-abc.(internal

table which contains the field value to be assigned )

if sy-subrc = 0.

move WA_B-field to WA_A-field.

modify IT_A index sy-tabix from WA_A transporting field.

endif.

endloop.

try this....

4 REPLIES 4

Former Member
0 Kudos

hi,

do the following:

loop at IT_A into WA_A.(internal table whose field value is to

be updated)

read table IT_B into WA_B with key abc = WA_A-abc.(internal

table which contains the field value to be assigned )

if sy-subrc = 0.

move WA_B-field to WA_A-field.

modify IT_A index sy-tabix from WA_A transporting field.

endif.

endloop.

try this....

Former Member
0 Kudos

Hi

u can modify the itab

in follwing ways

Modify in a LOOP.

LOOP AT inttab.

MOVE ... TO inttab-field1.

MODIFY inttab.

ENDLOOP.

MODIFY BY index

MODIFY inttab INDEX int_index.

MODIFY BY condition

MODIFY inttab WHERE field1 = ....

Edited by: srinivasu bv on Oct 17, 2008 8:17 AM

Former Member
0 Kudos

Hi,

loop ur final table, in this loop read another table based on key

and move to ur final table.

loop at it_final.

read table it_req with key ........

if sy-subrc = 0.

move required fields to it_final.

modify it_final.

endif.

endloop.

i hope u can understand.

Former Member
0 Kudos

Folllowing Code may help u:

Itab_1 - First internal table.

Wa_1 - Work Area for first internal table.

Itab_2 - Second internal table.

Wa_2 -> WorkArea for second internal table.

key - Field common to both the table.

loop at ITab_1 into WA_1.

read table ITab_2 into WA_2 with key abc = WA_1-abc .

if sy-subrc = 0.

move WA_2-field to W1_A-field.

modify ITab_1 index sy-tabix from WA_1 transporting field.

endif.

endloop.