‎2006 Dec 04 2:00 AM
hi!
If I have 3 internal tables it,it1and it2. it contains 5 colums out of which one is filled. The next 2 columns are to be filled from the 2 columns from it1 and the next 2 with the 2 columns from it2. how can do this?
‎2006 Dec 04 2:17 AM
Hi,
Then how do you update internal table IT from the other internal tables IT1 and IT2..
Otherwise..Give us a sample data for IT, IT1 and IT3...What is the output you want???That might give us some idea about your requirement...
Thanks,
Naren
‎2006 Dec 04 2:05 AM
Hi,
Assuming the column that is filled is the common field for all the three internal tables..I am assuming the column name as FILLED_ONE.
LOOP AT IT.
READ TABLE IT1 WITH KEY FILLED_ONE = IT-FILLED_ONE.
IF SY-SUBRC = 0.
MOVE THE SECOND AND THRID COLUMNS FROM IT1.
IT-SECOND = IT1-XXX.
IT-THIRD = IT1-XXX.
ENDIF.
READ TABLE IT2 WITH KEY FILLED_ONE = IT-FILLED_ONE.
IF SY-SUBRC = 0.
MOVE THE FOURTH AND FIFTH COLUMNS FROM IT2.
IT-SECOND = IT2-XXX.
IT-THIRD = IT2-XXX.
ENDIF.
UPDATE THE INTERNAL TABLE IT.
MODIFY IT.
ENDLOOP.
Thanks,
Naren
‎2006 Dec 04 2:09 AM
thx Naren!
but what if all the three internal tables does'nt have a common column?
cheers.
‎2006 Dec 04 2:17 AM
Hi,
Then how do you update internal table IT from the other internal tables IT1 and IT2..
Otherwise..Give us a sample data for IT, IT1 and IT3...What is the output you want???That might give us some idea about your requirement...
Thanks,
Naren
‎2006 Dec 04 3:52 AM
thx Naren!
let us assume that:
it1 contains matnr;
it2 contains labst,insme,speme;
I want to put all these fields in it3.
‎2006 Dec 04 4:07 AM
Hi,
But it1 & it2 should have atleast one common fields so that you read the correct entry & put it into it3.
Because..it1 & it2 may have more than 1 entry so how do we know which row of it1 & which row of it2 should be copied into it3?
Raja T
‎2006 Dec 04 3:14 AM
Hi,
Create the Final_itab which will have all column which you need from other 3 Itab..
loop at itab1.
read table itab2 with key field1 = itab1-field1
field2 = itab1-field2.
read table itab3 with key field1 = itab1-field1
field3 = itab1-field3.
move-sorresponding itab1 to it_final.
move-sorresponding itab2 to it_final.
move-sorresponding itab3 to it_final.
append it_final.
clear it_final.
endloop.check these thread...
Raja T
Message was edited by:
Raja T