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-corresponding with different fileds same data element

vallamuthu_madheswaran2
Active Contributor

HI Friends,

I am having 2 internal tables. The screen shots are given below. I want to move corresponding fields from one table to another. two internal table data elements are same

Thanks with regards,

Vallamuthu M.

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

99% of people do it by hand.

Possibility to do it automatically: if both internal tables are based on DDIC structure/table/view, you can look at table DD03L which contains their components along with their data elements (if direct types are not used), or you can use the method GET_DDIC_FIELD_LIST of CL_ABAP_STRUCTDESCR (RTTS/RTTI). Personally, I would opt for the second option and I would code it generically as a method which returns mapping data of type MAPPING_TABLE of CL_ABAP_CORRESPONDING so that I can use it with this class.

7 REPLIES 7

Sandra_Rossi
Active Contributor

99% of people do it by hand.

Possibility to do it automatically: if both internal tables are based on DDIC structure/table/view, you can look at table DD03L which contains their components along with their data elements (if direct types are not used), or you can use the method GET_DDIC_FIELD_LIST of CL_ABAP_STRUCTDESCR (RTTS/RTTI). Personally, I would opt for the second option and I would code it generically as a method which returns mapping data of type MAPPING_TABLE of CL_ABAP_CORRESPONDING so that I can use it with this class.

0 Kudos

Hi Sandra Rossi,

Thanks for your update.

can you please provide me with the sample code?

Thanks with regards,

Vallamuthu M.

What don't you understand in my answer? If you started with code but you're stuck, please post it and indicate your exact issue.

fedaros
Contributor

Hi Vallamuthu,

strange... the screen shoots have no fields in common, ok you said, but the content also seems to have nothing in common...Are you sure that you described your issue right ?

Regards, Fernando Da Rós

raymond_giuseppi
Active Contributor

If the internal table structures are static and defined in the ddic dictionary, you can generate a mapping FM with the BDBS transaction.

Otherwise, you can analyze both structures with some of the rtts classes and map the data dynamically using field symbols. (Already many threads exist in the forum, check also sandra.rossi's answer)

raymond_giuseppi
Active Contributor

Did you already close your previous question move data from one internal table to other with different field names

Sandra_Rossi
Active Contributor

As Raymond noticed, it's your second question about this topic, and I feel that you're not experienced, so better do the mapping manually, as 99% of people do...

Also, I see that you just ask the question and you don't ask for clarifications, so you won't benefit from people experience here. Remember that people give an answer without knowing your knowledge, so you probably don't understand the first answer. NB: don't expect that people spend a lot of time (and so, money) to code it for you.

For newbies, Excel is a good way to sort components by data element (that you extract from table DD03L), to help for the mapping.