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 data from one internal table to other with different field names

vallamuthu_madheswaran2
Active Contributor
0 Kudos

Hi Friends,

I have created the Dynamic internal table. The screen shot is given below.

Then I uploaded the data from excel. The screen shot is given below.

now my requirement is, to move the uploaded data to a dynamic table.

Thanks with regards,

Vallamuthu M.

1 ACCEPTED SOLUTION

xiaosanyu
Participant
0 Kudos
6 REPLIES 6

xiaosanyu
Participant
0 Kudos

0 Kudos

please, do not make screenshot of code, copy/past and use [CODE] button

0 Kudos

HI xiaosanyu,

Thanks for your update. But in the Dynamic table, a few fields are changing, so I am not able to find the struct1(dynamic table) field name.

Thanks with regards,

Vallamuthu M.

xiaosanyu
Participant
0 Kudos
LOOP AT lta_split INTO DATA(ls_split).

APPEND INITIAL LINE TO <fs_dyn_table> ASSIGNING FIELD-SYMBOL(<fs_row>).
LOOP AT gt_fcat INTO DATA(ls_fcat).
ASSIGN COMPONENT ls_fcat-fieldname OF STRUCTURE <fs_row> TO FIELD-SYMBOL(<fs_cell>).
CHECK sy-subrc = 0.
CASE ls_fcat-fieldname.
WHEN 'VKORG'.
<fs_cell> = ls_split-col01.
WHEN ''.
ENDCASE.
ENDLOOP.
ENDLOOP.

0 Kudos

vallamuthu.madheswaran2

please try, gt_fcat is your dyn_table fieldcat

fedaros
Contributor
0 Kudos

Hi Vallamuthu,

Check if assign component fit your needs, you can access by index of a structure to move to a field:

ASSIGN COMPONENT sy-index OF STRUCTURE <fyn_dyn_line> TO FIELD-SYMBOL(<field_to>).

ASSIGN COMPONENT sy-index OF STRUCTURE ls_split TO FIELD-SYMBOL(<field_from>).

https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/abapassign_mem_area_dynamic_dobj.htm#!ABA...

Regards, Fernando Da Rós