I have two internal tables with different structures. How to move their content to a 3rd one?

I have two internal tables with different structures. How to move their content to a 3rd one?

Responses for this Question

By: Ramchander on July 21st 2015
Loop internal table which has many records, then in the loop read 2nd internal table with a common field in to work area, then append records from work area to 3rd internal table. Note: fields should be similar in all three internal tables.
By: VENKATESHWARA JOSHI VITTALA on January 7th 2016
Can you provide a code using all internal table operations
By: Saikat Chakraborty on April 18th 2016
Hi Venkateshwara, suppose you have two internal tables and you want to move the content of these two internal tables into 3rd one. let me give you a walk through. 1st internal table :- it_prps. 2nd internal table:- it_covp. 3rd internal table:- it_final. work areas related to the internal tables are:- wa_prps, wa_covp, wa_final. the code will be :- 1st part:- moving the content of 1st internal table into the 3rd. LOOP AT it_prps INTO wa_prps. MOVE: wa_prps-pspnr TO wa_final-pspnr, wa_prps-posid TO wa_final-posid, wa_prps-post1 TO wa_final-post1, wa_prps-objnr TO wa_final-objnr, wa_prps-erdat TO wa_final-erdat, wa_prps-pbukr TO wa_final-pbukr, wa_prps-zz_job_curr TO wa_final-zz_job_curr, wa_prps-zz_job_office TO wa_final-zz_job_office, wa_prps-prps_status TO wa_final-prps_status. APPEND wa_final TO it_final. CLEAR wa_final. ENDLOOP. 2nd part:- moving the content of second internal table into third internal table LOOP AT it_covp INTO wa_covp. MOVE: wa_covp-kokrs TO wa_final-kokrs, wa_covp-belnr TO wa_final-belnr, wa_covp-buzei TO wa_final-buzei, wa_covp-wtgbtr TO wa_final-wtgbtr, wa_covp-uspob TO wa_final-uspob, wa_covp-meinh TO wa_final-meinh, wa_covp-sgtxt TO wa_final-sgtxt, wa_covp-bldat TO wa_final-bldat, wa_covp-budat TO wa_final-budat, wa_covp-refbn TO wa_final-refbn, wa_covp-refbk TO wa_final-refbk, wa_covp-refgj TO wa_covp-refgj. APPEND wa_final TO it_final. CLEAR wa_final. ENDLOOP. now we have it_final which consist of the data of both it_prps and it_covp.
By: Atul Bhardwaj on May 22nd 2017
Here you can use MOVE Corresponding statement as well, instead of field names, move Corresponding can be better option.

Signin to add Comment