‎2006 Nov 28 4:01 PM
Hi ,
I need to bring the total of all the data of a field of a Database table .How do I do it?Any one please give me the syntax.
Thanks
‎2006 Nov 28 4:05 PM
‎2006 Nov 28 4:04 PM
UPDATE ZTABLE set total = v_total where field1 = v_field1.in the where condition give all the key fields
‎2006 Nov 28 4:05 PM
‎2006 Nov 28 4:05 PM
Hi Bharat,
Use SUM( database-field) to get the sum of the data field.
SELECT SUM( DBFIELD )
INTO V_SUM
FROM DB_TABLE.
Thanks,
Vinay
‎2006 Nov 28 4:06 PM
hi Bharat,
Bring the data on to an Internal Table and use <b>Collect</b> or Sum statement ..
Regards,
Santosh
‎2006 Nov 28 4:06 PM
‎2006 Nov 28 4:08 PM
‎2006 Nov 28 4:09 PM
Hi there. You can use SUM to accomplish this. Here's some example code:
DATA: itab_wa LIKE LINE OF itab.
LOOP AT itab INTO itab_wa.
AT LAST.
SUM.
WRITE: / 'Sum', itab_wa-numfield.
ENDAT.
ENDLOOP.
The SUM statement will put the sum of the numeric fields for your internal table (itab) into the itab_wa record. Hope this helps.
- April King