‎2007 Feb 20 5:20 PM
hi all
thanks to this forum which has solved many of my queries.
thanks to all who have helped me.
my query is
in the report output, i have 5 columns for quantity field defining the sum of quantities of purchase orders in the month of jan, feb, mar, apr,may. the quantity field is taken from s012-wemgm. how can i get the sum of all the materials purchased in the month of jan in a single field( say wemgm1 for s012-wemgm), for the month of feb in wemgm2 like s012-wemgm.can anybody help me in getting the idea for this. i wil grateful to them.
do i need to take all these fields wemgm1....wemgm5 in an internal table
loop at itab
do_sum
or
do i need to take a counter?
pls help me
thanks in advance
‎2007 Feb 20 5:24 PM
Hi,
Yes..You can loop at the internal table and sum all the fields wemgm1..wemgm5..
Example
-
LOOP AT itab.
itab-final_amount = itab-wemgm1 + itab-wemgm2 + itab-wemgm3
itab-wemgm4 + itab-wemgm5.
modify itab transporting final_amount.
ENDLOOP.
THanks,
Naren
‎2007 Feb 20 5:28 PM
Hi,
Since u need 5 coloumns u have to take 5 fields like menge1 to 5.
Then u retrieve the data into Internal table by select statement.
then u loop it like.
Loop at Itab.
At end of Menge
Sum.
wirte: / 'Total Quantity'.
Endat.
endloop.
If hels pls award points.
Thanks,
Radha.
‎2007 Feb 21 12:26 PM
hi radha
thanks for the reply
i am totally new to abap.
can i have a more specific idea pls
if i use this code then will i get the sum of the particular column at the end?
according to the requirement what i need is.......
quantity is taken s012-wemgm, in the output display ineed 5 fields for wemgm like s012-wemgm.
wemgm1= sum of po amount in month 1
wemgm2= sum of po amount in month 2 like wise..
how can i achieve this?
thanks in advance
l
‎2007 Feb 20 5:31 PM
Yes, i think u need five counters. One for every month.
Loop at it.
v_wemgn1 = v_wemgn1 + it-wemgn1.
v_wemgn2 = v_wemgn2 + it-wemgn2.
.
.
.
endloop.
‎2007 Feb 21 12:30 PM
hi
i appreciate the response
can i have a more specific idea pls
thanks
in advance