2023 Jun 22 7:55 AM
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.
2023 Jun 22 9:24 AM
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.
2023 Jun 22 9:24 AM
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.
2023 Jun 22 9:33 AM
Hi Sandra Rossi,
Thanks for your update.
can you please provide me with the sample code?
Thanks with regards,
Vallamuthu M.
2023 Jun 22 11:38 AM
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.
2023 Jun 22 12:45 PM
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
2023 Jun 22 2:07 PM
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)
2023 Jun 22 4:13 PM
Did you already close your previous question move data from one internal table to other with different field names
2023 Jun 22 5:11 PM
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.