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: 

Internal Table

Former Member
0 Kudos

How to copy certain fields of an internal table along with data into another internal table.Plz reply soon.

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos
Loop at it_source.
MOVE-CORRESPONDING  it_source to it_target.
append it_target.
endloop.

Regards,

Naimesh Patel

6 REPLIES 6

naimesh_patel
Active Contributor
0 Kudos
Loop at it_source.
MOVE-CORRESPONDING  it_source to it_target.
append it_target.
endloop.

Regards,

Naimesh Patel

0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

former_member196601
Active Participant
0 Kudos

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.

Former Member
0 Kudos

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.