Skip to Content
0
Nov 11, 2006 at 06:50 PM

Insert lines with different fields between two tables

17 Views

Hi all,

Once again I need a help!!! here I go with my problem: I have one internal table with 3 records and I have another internal table with data related first internal table wich I need to fill it:

Table 1

F1 F2 F3 F4 F5

01 A C X

02 A B X

03 B C

Table2

F1 F2 F3 F4

01 A C 5

01 A C 10

02 B C 5

Result Table (Table 1)

F1 F2 F3 F4 F5

01 A C 5 X

- - - 10 X

02 A B 5 X

03 B C

I tried to

Loop at TABLE1.
Read TABLE 2 with key F1 = TABLE1-F1.
if sy-subrc = 0.
   TABLE1-F4 = TABLE2-F4.
    MODIFY TABLE1 FROM TABLE1
       TRANSPORTING F4
    WHERE F1 = TABLE1-F1.
endif.
Endloop.

But only modify first record of TABLE1 and I need to append the records of TABLE2.

Thanks in advance with any help !!!

Regards

Tokio