2007 Dec 05 11:19 AM
I am getting actual sales for month customer wise from s001-ummenge field.
i want to accumlate the every month sales for year for customer wise.
my year wise sales is not directly coming from the system.
it is coming with following way...
suppose i am getting january 100
february 200
march 300
april 450
like that upto december i will get differnt quantity.
final i want to display total from january to decemeber.
that means 100 + 200 + 300 + 450 + ..... = 950 ..
i want to display my total target per year is 950.
how to write code for above logic.
pls suggest me..
2007 Dec 05 11:32 AM
Hi,
U have not mentioned how it is printing?
through itab or any other?
If it is in itab just use the staments.
loop at itab.
at last .....
sum.
write:field1 field2 .....
endat.
endloop.
Regards,
Subbu
2007 Dec 05 11:35 AM
hi
use control break statements like the following
REPORT zinternaltable.
TYPES:BEGIN OF itab,
num TYPE i,
name(10) TYPE c,
amt type i,
END OF itab.
DATA : wa_itab TYPE itab,
it_itab TYPE STANDARD TABLE OF itab.
DATA : v_lines TYPE i.
wa_itab-num = 1.
wa_itab-name = 'nag'.
wa_itab-amt = 1000.
append wa_itab TO it_itab.
wa_itab-num = 1.
wa_itab-name = 'nag'.
wa_itab-amt = 2000.
append wa_itab TO it_itab.
wa_itab-num = 1.
wa_itab-name = 'nag'.
wa_itab-amt = 1500.
append wa_itab TO it_itab.
wa_itab-num = 2.
wa_itab-name = 'sri'.
wa_itab-amt = 500.
append wa_itab tO it_itab.
wa_itab-num = 2.
wa_itab-name = 'sri'.
wa_itab-amt = 600.
append wa_itab TO it_itab.
wa_itab-num = 2.
wa_itab-name = 'sri'.
wa_itab-amt = 700.
append wa_itab TO it_itab.
wa_itab-num = 3.
wa_itab-name = 'ganesh'.
wa_itab-amt = 1200.
append wa_itab TO it_itab.
wa_itab-num = 3.
wa_itab-name = 'ganesh'.
wa_itab-amt = 1300.
append wa_itab TO it_itab.
wa_itab-num = 3.
wa_itab-name = 'ganesh'.
wa_itab-amt = 1400.
append wa_itab TO it_itab.
wa_itab-num = 4.
wa_itab-name = 'suresh'.
wa_itab-amt = 900.
append wa_itab TO it_itab.
wa_itab-num = 4.
wa_itab-name = 'suresh'.
wa_itab-amt = 300.
append wa_itab TO it_itab.
sort it_itab.
LOOP AT it_itab INTO wa_itab.
at first.
write 😕 'details of sales order:'.
uline.
endat.
at new num.
write 😕 'serial num:', wa_itab-num.
uline.
endat.
WRITE 😕 wa_itab-num , wa_itab-name , wa_itab-amt.
at end of num.
uline.
sum.
write 😕 'total amount:',wa_itab-amt.
uline.
endat.
*
at last.
sum.
uline.
write:/ 'grand total:',wa_itab-amt.
endat.
ENDLOOP.
describe table it_itab lines v_lines.
reward for use ful points
Regards
Nagesh.Paruchuri
2007 Dec 05 11:37 AM
SELECT SUM( ummenge ) INTO net FROM s001 WHERE periv EQ '2007' AND kunnr EQ p_kunnr.
You can run this query for different years by changing periv