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

Internal Table

Former Member
0 Likes
1,189

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

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
1,160
Loop at it_source.
MOVE-CORRESPONDING  it_source to it_target.
append it_target.
endloop.

Regards,

Naimesh Patel

6 REPLIES 6
Read only

naimesh_patel
Active Contributor
0 Likes
1,161
Loop at it_source.
MOVE-CORRESPONDING  it_source to it_target.
append it_target.
endloop.

Regards,

Naimesh Patel

Read only

0 Likes
1,160

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

Read only

Former Member
0 Likes
1,160

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

Read only

Former Member
0 Likes
1,160

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.

Read only

Former Member
0 Likes
1,160

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.

Read only

Former Member
0 Likes
1,160

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.