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

Populate data from dynamic internal table

Former Member
0 Likes
464

Hi

I have dynamic internal table <lt_paxxxx>. Iam fillling <lt_paxxxx> in the following way.

select * into table <lt_paxxxx> from (infty-dbname).

I have to pass data of <lt_paxxxx> to another internal table lt_final.

'lt_final' should contain fields like <lt_paxxxx>, infty name, DB name.

Could you please help me out how to pass <lt_paxxxx> data to 'LT_FINAL'.

2 REPLIES 2
Read only

FredericGirod
Active Contributor
0 Likes
438

loop at <it_table>

into <is_table>.

loop at it_fieldcatalog

into is_fieldcatalog.

assign component is_fieldcatalog-fieldname

of structure <is_table>

to <field1>.

concatenate 'IT_TABLE-'

is_fieldcatalog-fieldname

into w_field.

assign (w_field) to <field2>.

check sy-subrc eq space.

move <field1> to <field2>.

endloop.

append it_table

endloop.

regards

Read only

gerd_rother
Active Participant
0 Likes
438

Hi,

You can use method CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA to get the description object of each of the tables. The method returns an object reference of type CL_ABAP_TYPEDESCR - but in case of an internal table you an cast this reference to type CL_ABAP_TABLEDESCR. In this object you have a public attribute COMPONENTS which describe the components of a table's line.

With the two components lists of the 2 tables you should be able to move the values to your target table using dynamic ASSIGN.

Regards, Gerd Rother