Application Development 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: 

move dynamic internal table to static internal table

Former Member
0 Kudos

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

matt
Active Contributor
0 Kudos

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>.

0 Kudos

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

matt
Active Contributor
0 Kudos

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

peter_ruiz2
Active Contributor
0 Kudos

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

Former Member
0 Kudos

\[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

Former Member
0 Kudos

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

matt
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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,