Application Development 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: 

Sum two columns in a select

sergio_cifuentes
Participant
0 Kudos

How do i make a sum or any other operation with two columns in a select? i mean something like this:

Select field1 + field2

into variable

from table

2 REPLIES 2

Former Member
0 Kudos

Hi,

You cannot sum two fields in a single select.

Select matnr sum(f1) sum(f2) from (tblname)

into table itab

group by matnr.

Then, you can loop at this itab and sum all values into one.

Regards

Subramanian

Former Member
0 Kudos

do this way...

select field1 field2 into it_itab from table.

loop at it_itab.

fin_val = it_itab-field1 + it_itab-field2.

append fin_val.

endloop.