‎2007 Nov 15 2:19 PM
Dear All
The following code has Execute but qty,values didnot come
i cheched internal tabel month_total values are stored
why didnot come qty and values
how to come qty and values
my code
loop at month_total.
AT NEW monthcode.
month_total-tmpqty = month_total-tmpqty + month_total-qty.
month_total-tmpval = month_total-tmpval + month_total-val.
write : / month_total-monthcode, month_total-tmpqty, month_total-val.
endat.
endloop.
Thanks and Regards
Suresh
‎2007 Nov 15 2:21 PM
When you use the AT NEW for perticular field the right fields from that fields becomes * asentrik inside the AT NEW.
So, Do like this:
loop at month_total.
AT NEW monthcode.
flag = 'X'.
endat.
if flag = 'X'.
clear flag.
month_total-tmpqty = month_total-tmpqty + month_total-qty.
month_total-tmpval = month_total-tmpval + month_total-val.
write : / month_total-monthcode, month_total-tmpqty, month_total-val.
endif.
endloop.Regards,
Naimesh Patel
‎2007 Nov 15 2:23 PM
Suresh,
AT NEW is a control break structure.
You MUST have the internal table sorted by the "control break field" - in your case - monthcode.
‎2007 Nov 15 2:24 PM
Because when ever you enter in side AT NEW stmt.. you'll be out of LOOP...means all table values will be nullified...
you can check this in debugging...
Thanks
‎2007 Nov 15 4:14 PM
if you have one record per monthcode you don need the AT NEW STATMENT
if you not try somthing like that
AT NEW monthcode
sum.
month_total-tmpqty = month_total-tmpqty + month_total-qty.
month_total-tmpval = month_total-tmpval + month_total-val.
write : / month_total-monthcode, month_total-tmpqty, month_total-val.
endat.
To get the total of all monthcode records
Message was edited by:
GEORGE TRENTSIOS
‎2007 Nov 15 4:28 PM
HI,
<b>SORT month_total BY monthcode.</b>
loop at month_total.
AT NEW monthcode.
month_total-tmpqty = month_total-tmpqty + month_total-qty.
month_total-tmpval = month_total-tmpval + month_total-val.
write : / month_total-monthcode, month_total-tmpqty, month_total-val.
endat.
endloop.
rgs
‎2007 Nov 15 4:47 PM
Hi Suresh,
Modify Internal Table after doing Calculations.
Reward if it helps,
Satish