2006 Oct 26 8:44 AM
i want to move two different internal table (fields and data) in to third internal table( output table).
itab 1 : l_t_vbrk.
itab 2 : l_t_vbak.
itab 3 : l_t_output_header_data.
i want to move two different internal table (fields and data) in to third internal table( output table).
itab 1 : l_t_vbrk.
itab 2 : l_t_vbak.
itab 3 : l_t_output_header_data.
2006 Oct 26 8:51 AM
Hi
Assume that internal table l_t_vbrk contains data of items and relationship to sales document.
sort l_t_vbak by vbeln posnr.
loop at l_t_vbrk.
move-corrsponding l_t_vbrk to l_t_output_header_data.
read table l_t_vbak with key vbeln = l_t_vbrk-vgbel
posnr = l_t_vbrk-vgpos.
if sy-subrc eq 0.
move-corresponding l_t_vbak to l_t_output_header_data.
endif.
endloop.Note that, VBGEL and VGPOS can be extracted from VBRP.
Kind Regards
Eswar
2006 Oct 26 9:05 AM
Hi,
Are the table structures are the same ?
If yes :
* here you move the first Table in the final table
l_t_output_header_data[] = l_t_vbrk[]
* Here you append the second table to the final table
loop at l_t_vbak.
move-corresponding l_t_vbak to l_t_output_header_data.
append l_t_output_header_data.
endloop.
Hope this helps,
Erwan
2006 Oct 26 9:48 AM
Hi,
Hope atleast one field will be common(Key field) in two tables.
loop at itab1 into wa1.
move-corresponding wa1 to wa3.
loop at itab2 into wa2 where f1 = wa2-f1.
move-corresponding wa2 to wa3.
append wa3 to itab3.
endloop.
endloop.
2006 Oct 26 9:53 AM
sort l_t_vbrk by vbeln posnr.
sort i_t_vbak by vbeln posnr.
loop at l_t_vbrk into wa_vbrk.
read table l_t_vbak into wa_vbak with key vbeln = wa_vbrk-vbeln and posnr = wa_vbrk-posnr binary seach.
if sy-subrc = 0.
wa_output_header-vbeln = wa_vbak-vbeln.
wa_output_header-posnr = wa_vbak-posnr.
*in this way move data to output work area else if the structure is same u can also use move corresponding.
append wa_output_header to l_t_output_header_data.
endif.
endloop.
Best Regards,
Vibha
*Please mark all the helpful answers
2006 Oct 26 9:57 AM
Hi Santosh,
both tables have only 1 primary keys so..
loop at t_vbrk.
move reqired fields into t_output from t_vbrk.
read table t_vbak with key vbeln = t_vbrk.
if sy-subrc = 0.
move required fields into t_outpt from t_vbak.
endif.
append t_output.
endloop.
-Anu.
2006 Oct 26 10:17 AM
Hi,
sort i_vbrk by aubel.
loop at i_vbrk.
read table i_vbak with key vbeln = i_vbrk-aubel
binary search.
if sy-subrc eq 0.
data lv_index type sy-tabix.
clear lv_index.
lv_index = sy-tabix.
loop at i_vbak from lv_index.
if i_vbak-vbeln <> i_vbrk-aubel.
clear i_vbak.
exit.
endif.
endloop.
endif.
move-corresponding i_vbak to i_final.
move-corresponding i_vbrk to i_final.
append it_final.
endif.
endloop.
Regards,
Amole
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |