Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

vendors total sales by gjahr.

Former Member
0 Kudos

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.

1 REPLY 1

andreas_mann3
Active Contributor
0 Kudos

better use table LFC1.

A.