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

iternal table move

Former Member
0 Likes
989

can u just send the syntax

moving three internal tables into final internal table its urgent

10 REPLIES 10
Read only

Former Member
0 Likes
956

Hi!

If the field names are the same in the target and destination tables, you can use the MOVE-CORRESPONDING command for this.

For example:

  • target is wa_main and gt_main

REFRESH gt_main.

LOOP AT gt_mard INTO wa_mard.

READ TABLE gt_marc INTO wa_marc

WITH KEY matnr = wa_mard-matnr

werks = wa_mard-werks.

READ TABLE gt_mara INTO wa_mara

WITH KEY matnr = wa_mard-matnr.

CLEAR wa_main.

MOVE-CORRESPONDING wa_mara TO wa_main.

MOVE-CORRESPONDING wa_marc TO wa_main.

MOVE-CORRESPONDING wa_mard TO wa_main.

APPEND wa_main TO gt_main.

ENDLOOP.

Regards

Tamás

Message was edited by:

Tamás Nyisztor

Read only

0 Likes
956

Hi

I hav six internal table ok but which table i hav to loop

Read only

0 Likes
956

Hi

You can use Append, modify itab1 to itab2, move-corresponding, insert...

You have to keep a loop ont he 1st internal table and u have to fetch that data and pass that values to second and after that apply loop on 2nd and pass that values to 3rd

Reward all helpfull answers

Regards

Pavan

Read only

Former Member
0 Likes
956

if the 3 internal tables are of same type and you want to move that to internal table of same type then....

append lines of itab1 to itab.

append lines of itab2 to itab.

append lines of itab3 to itab.

if they are different then

loop and move-corresponding internal table to final table and append .

this case you have to loop 3 times. for each one once.

Regards

Vijay

Read only

Former Member
0 Likes
956

Hi,

You can do this way.

loop at itab1 into wa1.

wa-f1 = wa1-f1.

wa-f2 = wa1-f2.

and so on.

append wa to itabfinal.

endloop.

Now for the second internal table.

loop at itab2 into wa2.

wa-f1 = wa2-f1.

and so on.

append wa to itabfinal.

endloop.

Do the same for the third internal table to move its content to the final internal table.

Hope it will be useful.

Thanks,

Sandeep.

Read only

Former Member
0 Likes
956

hi..

Loop at it1.

Loop at it2_item where item = it1-item.

Loop at it3_item where item = it1-item.

Move-corresponding it1 to it_final.

Move-corresponding it2 to it_final.

Move-corresponding it3 to it_final.

Append it_final.

Endloop.

Endloop.

Endloop.

<b>Reward points if useful</b>

regards

Ashu

Read only

former_member404244
Active Contributor
0 Likes
956

Hi,

Try like this...

LOOP AT ITAB1.

MOVE-CORRESPONDING ITAB1 TO ITAB.

APPEND ITAB.

ENDLOOP.

LOOP AT ITAB2.

MOVE-CORRESPONDING ITAB2 TO ITAB.

APPEND ITAB.

ENDLOOP.

LOOP AT ITAB3.

MOVE-CORRESPONDING ITAB3 TO ITAB.

APPEND ITAB.

ENDLOOP.

REGARDS,

NAGARAJ

Read only

Former Member
0 Likes
956

Hi,

Loop at each of the tables from which you want to move the contents to the final internal table.

Remember to move the correct fields from the internal tables to the final internal table fields.

Thanks,

Sandeep.

Read only

Former Member
0 Likes
956

Hello,

It depends on the key fields of the 3 internal tables.

If all the keys used have multiple records then u have to use a Loop else u can use a read statement.

Considering u have multiple records :-

Loop at itab1 into wa_tab1.
Move-corresponding wa_tab1 to wa_final.
Loop at itab2 into wa_tab2 where field1 = wa_tab1-field1.
Move-corresponding wa_tab2 to wa_final.
Loop at itab3 into wa_tab3 wher field1 = wa_tab1-field1 and field2 = wa_tab1-field2.
Move-corresponding wa_tab3 to wa_final.
Append wa_final to gt_final.
clear wa_final.
endloop.
endloop.
endloop.

If unique records r there then use 2 Reads instead of the 2 inner loops .

Regards,

Deepu.K

Regards,

Deepu.K

Read only

Former Member
0 Likes
956

hello,

Try this and don't forget to reward all helpfull answers


append lines of itab1 to itab.
append lines of itab2 to itab.
append lines of itab3 to itab.

Regards,

Rakesh.