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 dynamic internal table to static internal table

Former Member
0 Likes
2,543

Hi Experts,

I had created one Dynamic Internal table and one static internal table.I want to move data from dynamic internal table to static internel table.

So please help me for solving this issue.

Hi Experts,

I had created one Dynamic Internal table and one static internal table.I want to move data from dynamic internal table to static internel table.

So please help me for solving this issue.

8 REPLIES 8
Read only

matt
Active Contributor
0 Likes
1,586

If the two tables have exactly the same structure.

lt_static = <lt_dynamic>

If they don't.

LOOP AT <lt_dynamic> ASSIGNING <ls_dynamic>.
  MOVE-CORRESPONDING <ls_dynamic> TO ls_static.
  INSERT ls_static INTO TABLE lt_static.
ENDLOOP.

You can access individual fields, if move-corresponding isn't sufficient, by using ASSIGN COMPONENT fieldname/number OF STRUCTURE <ls_dynamic> TO <l_field>.

Read only

0 Likes
1,586

Exactly what I was looking for today. Thank you so much for this post, Matt.

Read only

matt
Active Contributor
0 Likes
1,586

bharath.padmanabhan Nowadays you can use MOVE-CORRESPONDING <lt_dynamic> TO lt_static of course.

Read only

peter_ruiz2
Active Contributor
0 Likes
1,586

hi,

take a look at this code

LOOP AT <itab> ASSIGNING <wa>.

ASSIGN COMPONENT 'AUFNR' OF STRUCTURE <wa> TO <fs_field>.

MOVE <fs_field> TO wa1-aufnr.

APPEND wa1 TO itab1.

CLEAR wa1.

ENDLOOP.

regards,

Peter

Read only

Former Member
0 Likes
1,586

\[removed by moderator as it was just a copy and paste answer of someone else's work without giving a source\]

Edited by: Jan Stallkamp on Jul 24, 2008 12:43 PM

Read only

Former Member
0 Likes
1,586

thanks for ur replies,

but i have a full data in dynamic table <dyn_table> and i want to send that data to a static table beco'z i have to export this table from function module.

help pls

Read only

matt
Active Contributor
0 Likes
1,586

So which part of mine or Peter Ruiz's answer did you not understand?

What is the structure of the tablet the function module expects?

matt

Read only

Former Member
0 Likes
1,586

hi, it's give me a error that is_staic & it_static is unknown ,pls tell me how to define him like struture < dyn_table>.

regards,