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
766

hello,

how can tranfer 1 internal table data into another one. when both have different structure and no common field exist between them.

with regard,

parul

10 REPLIES 10
Read only

Former Member
0 Likes
752

HI,

move: itab1-field1 to itab2-field1,

itab1-field2 to itab2-field2,

itab1-field3 to itab2-field3,

append itab2.

clear itab2.

Regards,

S.Nehru.

Read only

Former Member
0 Likes
752

You can transfer by massive assignment

tab_dest[] = tab_source[].

In your case i would make a loop.

loop at itab_source.

append itab_dest.

endloop.

Please reward if helpful.

Bye

Tony

Read only

Former Member
0 Likes
752

Hi,

Try joining internal tables if u could bring any third table which is common to these tables.

Then, loop and pass value from one work area to the other individually.

If u specify the database table names, we could help u.

Regards,

Ramya

Read only

Former Member
0 Likes
752

Hi,

Check this code.

types: begin of tp_itab1,

fld1 type c,

end of tp_itab1.

types: begin of tp_itab2,

fld2 type i,

fld3 type c,

end of tp_itab2.

data: itab1 type standard table of tp_itab1,

wa_itab1 type tp_itab1,

itab2 type standard table of tp_itab2,

wa_itab2 type tp_itab2.

wa_itab1-fld1 = 'A'.

wa_itab2-fld2 = '2'.

append wa_itab1 to itab1.

append wa_itab2 to itab2.

move wa_itab1-fld1 to wa_itab2-fld3.

append wa_itab2 to itab2.

Reward if helpful.

Regards.

Read only

0 Likes
752

Through this login there is some problems :

1) Data are append in last where itab 1 already have some values. new data comes after that values.

2) i have to tranfer all columm value... through this only 1 value of 1 columm is being transfer..

give me some other solution.

Read only

Former Member
0 Likes
752

Hello

You can make two structures, one for each table.

Then make a loop at table to be copied and in the loop statment use operators MOVE-CORRESPONIDNG FIELDS and APPEND it will look as folows.

LOOP AT itab1 INTO ls_tab1.

MOVE-CORRESPONDING ls_tab1 TO ls_tab2.

APPEND ls_tab2 to itab2.

ENDLOOP.

Hope it helps.

Regards

Read only

0 Likes
752

Sorry its not working...

Read only

0 Likes
752

hai Mittal,

try this Simple Logic.

Loop at itab.

move : itab-f1 to Itab1-f1,

itab-f2 to itab1-f2.

Append Itab2.

End loop

Regards.

Eshwar..

Read only

0 Likes
752

not working

Read only

Former Member
0 Likes
752

Hi,

If both structures are different, then its impossible except for the case:

Some fields of one are convertible to some fields of the other.

In that case when you are apeending the itab1 to itab2, some records will be populated.

Reward if helpful.