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

regarding the internal table

Former Member
0 Likes
749

hi friends,

i having a problem like , iam having 1 internal table with one field and second internal table with 9 fields and this data have to pass in to final internal table.

i used

loop of 1 internal table.

move 1field to final.

loop of 2 internal table.

move 9fields to final.

endloop.

endloop.

output:

i am getting here is

1 record values with 10 fields

but

2record with 1 field is different value same field values are coming for the 9 fields

3record with 1 field is different value same field values are coming for the 9 fields

4record with 1 field is different value same field values are coming for the 9 fields

can you solve this.

regards .

geetha.

8 REPLIES 8
Read only

Former Member
0 Likes
729

Hi

do this

loop of 1 internal table.

move 1field to final.

read 2 internal table index sy-tabix.

if sy-subrc = 0.

move 9fields to final.

endif.

endloop.

Aditya

Read only

Former Member
0 Likes
729

Hello Saigeetha,

Try this way...

loop at itab2.

itab_fianl-field1 = itab1-field1.

read table itab2 with key field2 eq itab1-field1 (or index ).

itab_final-field2 = itab2-field2.

..............

endloop.

Regards

Indu.

Read only

Former Member
0 Likes
729

Hi,

Use the following logic,

loop at internaltab1.

move field1 to finaltab.

loop at internaltab2 where internaltab1-field1 EQ internaltab2-field1.

move remaining fields to finaltab.

endloop.

endloop.

Read only

Former Member
0 Likes
729

hiii

you can do it by using following code

LOOP AT i_output INTO wa_output.
      READ TABLE i_makt INTO wa_makt WITH KEY matnr = wa_output-matnr.
      wa_output-maktx = wa_makt-maktx.
      MODIFY i_output FROM wa_output.
      CLEAR wa_output.
    ENDLOOP.                           " LOOP AT i_output

regards

twinkal

Read only

Former Member
0 Likes
729

Hi,

If u want to merge two internal table into one and the both table have a common field then u need to do in the following way...

loop at itab into wa_itab.

wa_final-field1 = wa_itab-field1.

move corresponding wa_final into it_final.

read table iatb1 with key field1 = wa_itab-field1.

if sy-subrc = 0.

wa_final-field2 = wa_itab1-field2.

wa_final-field3 = wa_itab1-field3.

wa_final-field4 = wa_itab1-field3.

.

.

.

wa_final-field9 = wa_itab1-field9.

move corresponding wa_final into it_final.

append wa_final to it_final.

endif.

endloop.

Thanks & Regards

Ashu Singh

Read only

Former Member
0 Likes
729

There's no connection between table 1 and 2. Your loop of table 2 doesn't have any conditions attached, so it will loop all the way through, attaching the last record of table 2 to every record of table one.

Read only

Former Member
0 Likes
729

Hi,

Try this.

Loop at itab1.

Append itab1 to final.

Read table itab2 index1.

Modify final from itab2 where f1 = itab1-f1.

endloop.

Sharin.

Read only

Former Member
0 Likes
729

ok fine