‎2008 May 21 3:23 PM
Hi,
i Have table like below and i wont to sum the last Colman (c_hr)
to 1 field cnt What is the Best Way to do That?
Regards
Data cnt type P DECIMALS 2.
*Date a_hr b_hr c_hr*
*20040101 9.00 9.00 1.00*
*20040105 5.00 9.00 0.56*
*20040108 3.00 9.00 0.33*
*20040112 9.00 9.00 1.00*
*20040115 9.00 9.00 1.00*
‎2008 May 21 3:26 PM
hi Ricardo,
one way is:
LOOP AT itab.
cnt = cnt + itab-c_hr.
ENDLOOP.
hope this helps
ec
‎2008 May 21 3:25 PM
better do a loop and add the field in to the required variable
‎2008 May 21 3:26 PM
hi Ricardo,
one way is:
LOOP AT itab.
cnt = cnt + itab-c_hr.
ENDLOOP.
hope this helps
ec
‎2008 May 21 3:26 PM
Hi,
Try this.
Loop at <int.table> into <work area>.
cnt = cnt + <work area>-c_hr.
clear <work area>.
endloop.
After this, you will have the sum in one variable cnt.
‎2008 May 21 3:28 PM
an option is:
data: count like i_t-c_hr.
clear count.
loop at i_t.
count = count + c_hr.
endloop.
or u can use the command COLLECT check with sap help..
‎2008 May 21 3:30 PM
Hello,
CLEAR cnt
LOOP AT itab INTO line.
cnt = line-c_hr + cnt.
ENDLOOP.
Regards,
‎2008 May 21 3:33 PM
Hi,
Use collect statement....
Lop at itab.
.......
collect itab.
endloop.
Raghav