11-13-2007 10:41 PM
How to copy certain fields of an internal table along with data into another internal table.Plz reply soon.
11-13-2007 10:45 PM
Loop at it_source.
MOVE-CORRESPONDING it_source to it_target.
append it_target.
endloop.
Regards,
Naimesh Patel
11-13-2007 10:45 PM
Loop at it_source.
MOVE-CORRESPONDING it_source to it_target.
append it_target.
endloop.
Regards,
Naimesh Patel
11-13-2007 11:27 PM
I have done that but all the fields along with the fields in first internal table are getting displayed instead of the only fields that are present in second internal table .plz advice.
Message was edited by:
ajaya moharana
11-13-2007 11:31 PM
Hi,
do like this, this is similar to Naimesh answers,
just try
Loop at it_source.
MOVE: it_source-f1 to it_target-f1,
it_source-f2 to it_target-f2.
append it_target.
endloop.
Reward if it helps,
Satish
11-14-2007 3:01 AM
If both internal table are same structure means same fields with same order then just write as below
itab1[] = itab2[]
If both are diffrent then
Loop at itab1
Move corresponding fields from itab1 to itab2.
Endloop.
11-14-2007 4:24 AM
Hi Ajaya
If you want only particular fields of one internal table to another, try this way..
data : begin of itab,
a type c,
b type i
end of itab.
data : begin of jtab,
c type c,
d type i
end of jtab.
if you want only field a of table itab to field c of jtab
Loop at itab.
jtab-c = itab-a.
append jtab.
endloop.
11-14-2007 4:37 AM
Hi Ajaya,
Let ITAB1 contains 5 fields and ITAB2 contains 5 fields.
Itab1..... field1, field2, field3, field4, field5.
Itab2..... field1, field2, field3, field6, field7.
Now if we want to copy only field1 and field2 from itab1 to itab2. then,
loop at itab1.
move: itab1-field1 to itab2-field1,
itab1-field2 to itab2-field2.
append itab2.
clear itab2.
endloop.