‎2006 Dec 04 1:53 PM
loop at i_open_posting into wa_open_posting.
move: wa_open_posting-mblnr to wa_print_mat-mblnr,
wa_open_posting-mbpos to wa_print_mat-mbpos,
wa_open_posting-bwart to wa_print_mat-bwart,
wa_open_posting-menge to wa_print_mat-menge,
wa_open_posting-meins to wa_print_mat-meins.
endloop.
*looping at i_cpudt to append the data into i_print_mat.
loop at i_cpudt into wa_cpudt.
move: wa_cpudt-cpudt to wa_print_mat-cpudt.
endloop.
*looping at i_t156t to append the data into i_print_mat.
loop at i_t156t into wa_t156t.
move: wa_t156t-btext to wa_print_mat-btext.
endloop.
*Appending i_open_posting, i_cpudt, i_t156t into one i_print_mat.
append initial line to i_print_mat.
the above code is not working properly to append all the 3 loops into one intenral table can u plz help me out.
‎2006 Dec 04 2:03 PM
Hi,
you should have common fields to combine all three internal tables into 1
loop at i_open_posting into wa_open_posting.
move: wa_open_posting-mblnr to wa_print_mat-mblnr,
wa_open_posting-mbpos to wa_print_mat-mbpos,
wa_open_posting-bwart to wa_print_mat-bwart,
wa_open_posting-menge to wa_print_mat-menge,
wa_open_posting-meins to wa_print_mat-meins.
move-corresponding i_open_posting to i_print_mat.
read table i_cpudt with key <common field> = < i_open_posting-common
field>
if sy-subrc eq 0.
move-corresponding i_cpudt to i_print_mat.
endif.
read table i_t156t with key <common fild> = < i_open_posting-common
field>
if sy-subrc eq 0.
move-corresponding i_t156t to i_print_mat.
endif.
append i_print_mat.
endloop.
Regards
amole
‎2006 Dec 04 1:57 PM
Hi,
use below logic
loop at itab.
read table itab1 with key matnr = itab-matnr
binary search.
if sy-subrc eq 0.
data lv_index type sy-tabix.
clear lv_index.
lv_index = sy-tabix.
loop at itab1 from lv_index.
if itab-matnr <> itab1-matnr.
clear itab.
exit.
endif.
endloop.
endif.
move-corresponding itab to i_final.
move-corresponding itab1 to i_final.
append it_final.
endif.
endloop.
regards
amole
‎2006 Dec 04 2:00 PM
what you need to do is
Loop at i_open_posting into wa_open_posting "Header table
move: wa_open_posting-mblnr to wa_print_mat-mblnr,
wa_open_posting-mbpos to wa_print_mat-mbpos,
wa_open_posting-bwart to wa_print_mat-bwart,
wa_open_posting-menge to wa_print_mat-menge,
wa_open_posting-meins to wa_print_mat-meins.
read table i_cpudt into wa_cpudt with key mblnr = wa_open_posting-mblnr
move: wa_cpudt-cpudt to wa_print_mat-cpudt.
read table i_t156t into wa_t156t with key mblnr = wa_open_posting-mblnr
move: wa_t156t-btext to wa_print_mat-btext.
append wa_print_mat to i_print_mat
endloop.
‎2006 Dec 04 2:03 PM
Hi,
you should have common fields to combine all three internal tables into 1
loop at i_open_posting into wa_open_posting.
move: wa_open_posting-mblnr to wa_print_mat-mblnr,
wa_open_posting-mbpos to wa_print_mat-mbpos,
wa_open_posting-bwart to wa_print_mat-bwart,
wa_open_posting-menge to wa_print_mat-menge,
wa_open_posting-meins to wa_print_mat-meins.
move-corresponding i_open_posting to i_print_mat.
read table i_cpudt with key <common field> = < i_open_posting-common
field>
if sy-subrc eq 0.
move-corresponding i_cpudt to i_print_mat.
endif.
read table i_t156t with key <common fild> = < i_open_posting-common
field>
if sy-subrc eq 0.
move-corresponding i_t156t to i_print_mat.
endif.
append i_print_mat.
endloop.
Regards
amole
‎2006 Dec 04 2:19 PM
Whatz the relationship between the three internal tables ?
i_open_posting, i_cpudt and i_t156t internal tables..lets if they are linked to each other via field1 than you can use the below logic.
loop at i_open_posting...
move i_open_posting ...to wa_print_mat.
read table i_cpudt with key field1 = i_open_posting-field1.
move i_cpudt to wa_print_mat.
read table i_t156t with key field field1 = i_open_posting-field1.
move i_t156t to wa_print_mat.
append wa_print_mat to i_print_mat.
endloop.
‎2006 Dec 04 3:21 PM
Loop at i_open_posting into wa_open_posting "Header table
move: wa_open_posting-mblnr to wa_print_mat-mblnr,
wa_open_posting-mbpos to wa_print_mat-mbpos,
wa_open_posting-bwart to wa_print_mat-bwart,
wa_open_posting-menge to wa_print_mat-menge,
wa_open_posting-meins to wa_print_mat-meins.
append wa_print_mat to i_print_mat.
endloop.
loop at i_print_mat.
Read the remaining fields i.e. CPUDT & BTEXT with the key field and modify i_print_mat .
endloop.
Hope this helps.
Regards,
Sudheer