11-20-2008 8:12 PM
after a selection in bsik and bsak, bsek etc... into the tb_out
i collect into tb_col the total amount for each lifnr.
now i want to collect the total amount by gjahr .
how can i change my code, please?
LOOP AT tb_out.
CLEAR tb_col.
SELECT SINGLE * FROM bkpf
WHERE bukrs = wa_ana-bukrs
AND belnr = tb_out-belnr
AND gjahr = tb_out-bldat(4).
MOVE-CORRESPONDING tb_out TO tb_col.
tb_col-bukrs = wa_ana-bukrs.
tb_col-waers = bkpf-waers.
tb_col-hwaer = bkpf-hwaer.
COLLECT tb_col.
MOVE-CORRESPONDING tb_col TO tb_zftforn.
tb_zftforn-wrbtr = tb_col-fativd.
tb_zftforn-dmbtr = tb_col-fativa.
tb_zftforn-gjahr = tb_reg-gjahr.
ENDLOOP.
APPEND tb_zftforn.
11-21-2008 8:02 AM