2006 Jun 27 3:52 PM
I have an itab containing netwr, kwmeng and olfmng values. I am displaying this itab on the output in simple list. What should I do to get sum of these values for each fields at the end of the list?
Thanks.
2006 Jun 27 3:57 PM
You can have a structure which has those fields.
* Create a structure with the same field names that
* you want to sum.
data: begin of xsum,
netpr type netpr,
menge type menge,
end of xsum.
loop at itab.
add-corresponding itab to xsum.
endloop.
write:/ xsum-netpr, xsum-menge.Regards,
Rich Heilman
2006 Jun 27 3:53 PM
loop at itab.
at last.
collect itab.
endat.
endloop.
Then display your itab.
Regards,
ravi
2006 Jun 27 3:57 PM
2006 Jun 27 4:01 PM
2006 Jun 27 4:01 PM
Hi Nuren,
In order to find the sum of the table contents.
Loop at i_tab.
<b>at last.
sum.
endat.</b>
endloop.
Now you will have the sum of the values of netwr, kwmeng and olfmng in the header of the internal table.
ws_total = i_tab-netwr.
ws_tot = i_tab-kwmeng.
ws_totl = i_tab-olfmng.
write: / ws_total, ws_tot, ws_totl.
Reward if useful.
Regards,
Tushar
Message was edited by: Tushar Marshall Dass
2006 Jun 27 4:06 PM
2006 Jun 27 4:07 PM
Hi nuren,
end-of-selection.
loop at itab.
at last.
sum.
endat.
reawrd if helpful.
regards,
keerthi.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |