‎2008 May 22 3:46 PM
Hi,
i Have in program internal table with fields like below
and i wont to sum the sick days and put it in the last Colman
what is the Best way to do that?
Regards
i have this table without Colman sum (empty) .
pernr orgeh sick_days sum
123 5555 3 7
123 5555 4 7
456 6666 7 16
456 6666 1 16
456 6666 8 16
789 5656 3 6
789 5656 3 6
‎2008 May 22 3:48 PM
‎2008 May 22 3:48 PM
‎2008 May 22 3:49 PM
make pernr and orgeh the keys in a second table, loop at the first table and use collect to the second table and you shouldn't need a new colum
‎2008 May 22 3:50 PM
Hi,
I guess this might help.
i_itab-sum = 0;
Loop at i_itab.
i_itab-sum = i_itab-sum + i_itab-sickdays.
endloop.
‎2008 May 22 3:58 PM
Hi ricardo,
try the following:
DATA: sum_sick_days TYPE i.
LOOP AT tab INTO wa.
AT NEW orgeh.
SUM.
sum_sick_days = wa-sick_days.
ENDAT.
wa-sum = sum_sick_days.
MODIFY tab FROM wa.
ENDLOOP.AT NEW ORGEH will sum the sick_days at every changes of PERNR or ORGEH.
So, for the same PERNR/ORGEH, you will have the correct sum.
Regards,
Manuel
PS: Please rewards points for useful answers.
‎2008 May 22 4:00 PM
Hi,
You can use like...
SORT ITAB BY PERNR.
LOOP AT ITAB.
AT NEW PERNR.
SUM.
WRITE: /..............
ENDAT.
ENDLOOP.
The SICK field must be integer...so it can be added and others r of char(key).
reward if helpful.
thanks.