‎2006 Mar 18 4:47 AM
hi frnd's,
I had an internal table with 5 fields.I want to sum up (total) a one field value and dispaly it in the screen.
can this be possible.
‎2006 Mar 18 4:53 AM
Hi Suganya,
Can u explain ur question?
U want to sum your field values at the end of the internal table??
‎2006 Mar 18 4:53 AM
Hi Suganya,
Can u explain ur question?
U want to sum your field values at the end of the internal table??
‎2006 Mar 18 4:57 AM
Example I had a field name a,b,c in internal table it_alpha.
It contains ten datas in to it,then i wnt to sum all the datas of field a in it_alpha,and display it into the textfield total__________ in screen.
‎2006 Mar 18 5:05 AM
DATA sum LIKE it_alpha-a.
LOOP AT it_alpha.
sum = sum + it_alpha-a.
ENDLOOP.
Now use the sum wherever you want.
Regards,
Wenceslaus.
‎2006 Mar 18 4:56 AM
Hi,
Pl try this..
SORT ITAB.
LOOP AT ITAB.
AT LAST.
SUM.
write:/ itab-field. "the field you want to total
endat.
endloop.
Regards,
Suresh Datti
‎2006 Mar 18 4:58 AM
‎2006 Mar 18 5:08 AM
The internal table has fields a,b,c. U want to sum the values of a & display it.
declare variale sum.
Loop at it_alpha.
sum = sum + it_aplha-a.
endloop.
Use the sum at last to display it in the textfield total__________ in screen.
‎2006 Mar 18 5:18 AM
HI,
Write code similar to below.
DATA:BEGIN OF ITAB OCCURS 0,
FIELD1 TYPE FIELD1,
FIELD2 TYPE FIELD2,
FIELD3 TYPE FIELD3,
AMOUNT TYPE P DECIMALS 2,
QTY TYPE P DECIMALS 3,
END OF ITAB.
DATA: V_TOTAL_AMOUNT TYPE TYPE P DECIMALS 2,
V_TOTAL_QTY TYPE TYPE P DECIMALS 3.
*Assume thAT you populated data
LOOP AT ITAB.
AT FIRST.
SUM.
V_TOTAL_AMOUNT = ITAB-AMOUNT .
V_TOTAL_QTY = ITAB-QTY.
ENDAT.
ENDLOOP.
THanks,
Ramakrishna