Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sum function for internal table column

Former Member
0 Likes
3,390

Dear Experts,

how can I sum a complete internal table column.

Regards

ertas

1 ACCEPTED SOLUTION
Read only

former_member182371
Active Contributor
0 Likes
1,307

Hi,

have a look at COLLECT sentence in SAP HELP.

e.g.

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb36d5358411d1829f0000e829fbfe/content.htm

Best regards.

Edited by: Pablo Casamayor on Apr 30, 2009 5:16 PM

6 REPLIES 6
Read only

former_member182371
Active Contributor
0 Likes
1,308

Hi,

have a look at COLLECT sentence in SAP HELP.

e.g.

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb36d5358411d1829f0000e829fbfe/content.htm

Best regards.

Edited by: Pablo Casamayor on Apr 30, 2009 5:16 PM

Read only

Former Member
0 Likes
1,307

Hi,

Use SUM in AT END of event in the loop of an internal table.

Example

Loop at ITAB into wa_itab.

at end of wa_itab-field.

sum. " Here all numric fields will be summed and stored in that filed(wa_itab-field)

endat.

Endloop.

Regards

Krishna

Read only

Former Member
0 Likes
1,307

how is the correct syntax if you have workarea.

COLLECT wa-cost doesnt work.

LOOP at itab into wa

COLLECT wa-cost.

ENDLOOP

thx

ertas

Read only

0 Likes
1,307

Hi,

Please check my above reply for sample code

Regards

Krishna

Read only

0 Likes
1,307

i would rather like do it with collect If you are agree

Read only

Former Member
0 Likes
1,307

Total Posts: 813

Total Questions: 350 (121 unresolved)

You might want to consider cleaning up your old posts.

Rob