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: 

Move internal Table to another Internal Table

Former Member
0 Kudos
109

Hi all

This will be a simple question. But I wish to know is there anyway that i can do other than having to loop IT_REP to workarea then append each record of workarea into IT_REP_NEW.

It will be troublesome if i have many fields to move.

LOOP AT IT_REP INTO WA_REP.

WA_REP_NEW-VKORG = WA_REP-VKORG.

WA_REP_NEW-VTWEG = WA_REP-VTWEG.

WA_REP_NEW-BZIRK = WA_REP-BZIRK.

WA_REP_NEW-BAHNS = WA_REP-BAHNS.

APPEND WA_REP TO IT_REP_NEW.

ENDLOOP.

Thanks for helping.

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos
87

If it_rep_new has the same structure or, both the tables have a common set of fields that appear first, then you can simply say:

I mean if itab1 has field1 field2 field3.

and itab2 has fields field1 field2

itab1[] = itab2[].

REgards,

Ravi

Message was edited by:

Ravi Kanth Talagana

8 REPLIES 8

former_member181962
Active Contributor
0 Kudos
88

If it_rep_new has the same structure or, both the tables have a common set of fields that appear first, then you can simply say:

I mean if itab1 has field1 field2 field3.

and itab2 has fields field1 field2

itab1[] = itab2[].

REgards,

Ravi

Message was edited by:

Ravi Kanth Talagana

Former Member
0 Kudos
87

hi,

do this way

IT_REP_NEW[] = IT_REP[] .

You can move that way provided that the structure of the two tables should be same

Regards,

santosh

Former Member
0 Kudos
87

Hi Hui,

Instead of using separate assignments you can use move corresponding fields option.Make sure the source and the target have the same field names.

Pls reward if found useful.

Thanks

Shyam

andreas_mann3
Active Contributor
0 Kudos
87

hi,

use:

IT_REP_NEW = IT_REP .

A.

Former Member
0 Kudos
87

1. LOOP AT IT_REP INTO WA_REP.

move-corresponding WA_REP to WA_REP_NEW.

APPEND WA_REP_NEW TO IT_REP_NEW.

ENDLOOP.

2. If the structures are same then use

APPEND LINES OF IT_REP TO IT_REP_NEW.

Former Member
0 Kudos
87

Hi,

Use the following -

APPEND LINES OF it_rep to it_rep_new.

Reward points if found useful...!

Cheers

Abhishek

Former Member
0 Kudos
87

Thanks everyone.

Former Member
0 Kudos
87

hi Hui,

if u have the 2 tables have the same structure then u can use as mentionded by other above..

i.e..

 IT_TAB1[] = IT_TAB2[].

.

If the there is diffence then u have assigne field by field... only.

LOOP AT IT_REP INTO WA_REP.
WA_REP_NEW-VKORG = WA_REP-VKORG.
WA_REP_NEW-VTWEG = WA_REP-VTWEG.
WA_REP_NEW-BZIRK = WA_REP-BZIRK.
WA_REP_NEW-BAHNS = WA_REP-BAHNS.

*APPEND WA_REP TO IT_REP_NEW
APPEND WA_REP_new TO IT_REP_NEW.
ENDLOOP.