Skip to Content
0
Former Member
Nov 20, 2008 at 08:12 PM

vendors total sales by gjahr.

19 Views

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.