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

Fill dynamic internal table with data from another dynamic table

Former Member
0 Likes
2,871

Hi,

I have a huge dynamic table with a few columns and need to fill another dynamic table with some of the columns, that are also existing in the other one. I first know at runtime, which fields the smaller table contains.

Until now, I did it that way:

  LOOP AT <it_tab_structure> ASSIGNING <wa_tab_structure>.

    LOOP AT lt_comp_full INTO ls_comp_full.

      ASSIGN COMPONENT ls_comp_full-name OF STRUCTURE <structure> TO <column>.

      ASSIGN COMPONENT ls_comp_full-name OF STRUCTURE <wa_tab_structure> TO <value>.

      <column> = <value>.

    ENDLOOP.

    APPEND <structure> TO <table>.

  ENDLOOP.

lt_comp_full contains the columns of the second table, that have to be filled.

This is taking a very long time, as there can be a lot of columns in the source table and the source table contains at least 100000 records.

Is there therefore any way to fill the other table faster?

Thank you & best regards,

Michael

1 ACCEPTED SOLUTION
Read only

SharathYaralkattimath
Contributor
0 Likes
1,429

Hi Michael,

If you are on ABAP 7.4 then use MOVE-CORRESPONDING itab1 TO itab2.

Thanks,

Sharath

3 REPLIES 3
Read only

SharathYaralkattimath
Contributor
0 Likes
1,430

Hi Michael,

If you are on ABAP 7.4 then use MOVE-CORRESPONDING itab1 TO itab2.

Thanks,

Sharath

Read only

0 Likes
1,429

Hey Sharath,

thank you for your answer! Unfortunately I don't have a 7.4 system here, but your example pointed out, that I can also use move-corresponding from one structure to the other, which I thought, was not possible. I'm trying out, if this makes it faster now.

I'll let you all know, if this made the deal.

Thank you & best regards,

Michael & Arne

Read only

0 Likes
1,429

Hi Sharath,

MOVE-CORRESPONDING helped a lot, even I could not use it for whole tables.

Thank you very much!

Michael & Arne