‎2008 Jul 08 4:59 AM
Hi Experts,
i have issue were in i need to show sum of the amount. like example...
for Custmer 100 there are vendor number 10,20,30,40,50. so for all this vendor numbers..
vendor----- amount
10----
100
20----
200
30----
300
40----
400
50-------500
so in the output i want it to be..
customer--
amount
1000--
1500
-
20---
-
30---
-
40---
-
50---
.hope u experts have undestood. so how can i add the it and show it in the output....
am forwarding my code also..
Corrects answers will be fully rewarded..
‎2008 Jul 08 5:10 AM
Hi,
For e.g consider your table as itab with colums customer, vendor, amount
now customer has the data with customer number 1000
10----
100
20----
200
30----
300
40----
400
50-------500
data sum_amount type p.
data last_vendor.
sort itab by customer ascending vendor descending.
loop at itab.
add itab-amount to sum_amount.
at end of vendor.
last_vendor = 'X'.
endat.
if last_vendor = space.
clear itab-amount.
modify itab.
else.
move sum_amount to itab-amount.
modify itab transporting amount.
clear sum_amount.
clear last_vendor.
endif.
endloop.
please reward points if usefull.
‎2008 Jul 08 5:04 AM
hi sunita,
can u show me ur code so dat i can have idea what query u r using.
‎2008 Jul 08 5:10 AM
Hi,
For e.g consider your table as itab with colums customer, vendor, amount
now customer has the data with customer number 1000
10----
100
20----
200
30----
300
40----
400
50-------500
data sum_amount type p.
data last_vendor.
sort itab by customer ascending vendor descending.
loop at itab.
add itab-amount to sum_amount.
at end of vendor.
last_vendor = 'X'.
endat.
if last_vendor = space.
clear itab-amount.
modify itab.
else.
move sum_amount to itab-amount.
modify itab transporting amount.
clear sum_amount.
clear last_vendor.
endif.
endloop.
please reward points if usefull.
‎2008 Jul 08 5:11 AM
Hi Sunita,
In the field catalog that you have prepared, just check the field SUM for the amount field. It will add all the amounts for that particular customer and display the sum of amounts .
‎2008 Jul 08 5:12 AM
Hi,
For ALV Sum try to use this :
wa_fieldcat-do_sum = 'X' while you are populating the field catalogue for that particular field.
Thanks.
Swati.