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

Move from Internal table to Internal table

Former Member
0 Likes
13,835

Hi Guys,

I have two internal table,

First one with fields A, B, C, D, E

Second one with A, E, D, C, B

I have to fill the second internal table from first internal table.

I dont want to use loop and do it(I am aware of doing it)... I tried using move corresponding but it is not supported.

Please let me know Is there any efficiently.

regards,

Prabhu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,655

Hi,

One approach would be to try filliing the 2nd table at teh same time ur filling the 1st table instead of doing it after 1st table is filled..

BTW is there any specific purpose to rearranging one column, say for display or download?

-- Dedeepya

Hi,

One approach would be to try filliing the 2nd table at teh same time ur filling the 1st table instead of doing it after 1st table is filled..

BTW is there any specific purpose to rearranging one column, say for display or download?

-- Dedeepya

6 REPLIES 6
Read only

Former Member
0 Likes
4,656

Hi,

One approach would be to try filliing the 2nd table at teh same time ur filling the 1st table instead of doing it after 1st table is filled..

BTW is there any specific purpose to rearranging one column, say for display or download?

-- Dedeepya

Read only

0 Likes
4,655

Hi,

Move-corresponding will work in loop or else to pass data from structure to structure only.

Once, you use mov-corres data will pass from-table to to-table header line only.

&----


*& Report ZTEST_100

*&

&----


*&

*&

&----


REPORT ztest_100.

TABLES: vbrk, vbrp.

types : BEGIN OF tvarv,

col_1,

col_2,

col_3,

col_4,

END OF tvarv.

types : BEGIN OF tvarv_1,

col_2,

col_1,

col_4,

col_3,

END OF tvarv_1.

DATA : tvarvc type tvarv occurs 0 with header line.

DATA : tvarvc_1 type tvarv_1 occurs 0 with header line.

tvarvc-col_1 = 01.

tvarvc-col_2 = 02.

tvarvc-col_3 = 03.

tvarvc-col_4 = 04.

APPEND tvarvc.

tvarvc-col_1 = 05.

tvarvc-col_2 = 06.

tvarvc-col_3 = 07.

tvarvc-col_4 = 08.

APPEND tvarvc.

append lines of tvarvc to tvarvc_1.

Write : 'kishore'.

Read only

Former Member
0 Likes
4,655

ITAB1:-

FIELD :- A B C D E

VALUE:- 1 2 3 4 5

ITAB2:-A E D C B

FIELD:

IF u use append lines of itab1 to itab2.

then output is like

ITAB2:-A E D C B

FIELD: 1 2 3 4 5

If u use MOVE-CORRESPONDING itab1 to itab2

then output is

ITAB2:-A E D C B

FIELD: 1 5 4 3 2

becasue in itab1 E value is 5 so MOVE-CORRESPONDING is working fine


TABLES: vbrk, vbrp.

types : BEGIN OF itab1,
a,
b,
c,
d,
e,
END OF itab1.

types : BEGIN OF itab2_1,
a,
e,
d,
c,
b,
END OF itab2_1.

DATA : itab11 type itab1 occurs 0 with header line.
DATA : itab22_1 type itab2_1 occurs 0 with header line.

itab11-a = 01.
itab11-b = 02.
itab11-c = 03.
itab11-d = 04.
itab11-e = 05.
APPEND itab11.

break developer.
loop at itab11.
MOVE-CORRESPONDING itab11 to itab22_1.
append itab22_1.
endloop.

Read only

Former Member
0 Likes
4,655

Not possible without using a loop if the field order is different in the two internal tables.

Read only

Former Member
0 Likes
4,655

I agree with Vikranth.Reddy that why i give example with loop and MOVE-CORRESPONDING without loop not possible

Read only

Former Member
0 Likes
4,655

>

> First one with fields A, B, C, D, E

> Second one with A, E, D, C, B

Is there a special reason why the field sequence in you second table is set up like that?

If there isn't, make them the same and then you can use:

itab2[] = itab1[]