‎2006 Dec 19 5:02 PM
Hi,
somebody knows how to sum two columns of a table as a result of an abap sql query. I know that is possible to do it in a native sql like
select f.seatmax max, f.seatfree free, f.seatmax - f.seatfree seatoccu from flights
Tks
Roberto Falk
‎2006 Dec 20 3:21 AM
‎2006 Dec 20 3:21 AM
‎2006 Dec 20 3:30 AM
Hi Roberto ,
Here is a sample code which does some thing similar
Data : v_LABST type LABST ,
v_umlme type umlme.
start-of-selection.
select sum( labst ) sum( umlme )
into (v_labst , v_umlme)
from mard.
write:/ v_labst , v_umlme.Regards
Arun
‎2006 Dec 20 3:37 AM
Hi,
It's not possible.
But alternatively,you need to write select statement fro the two fields (sa y A and B) and then loop the internal table to get (A + B).
‎2006 Dec 20 11:10 AM
This is the problem... I don't want to interate the internal table after the select.
Tks all.
Roberto
‎2006 Dec 20 11:17 AM
Hi,
select sum( A ) from db into v1.
select sum( B ) from db into v2.
v = v1 + v2.
write v.
Message was edited by:
Jayanthi Jayaraman
‎2006 Dec 20 11:23 AM
No, this is not my idea.... I wanna the sum of each column... not the total sum of the table...
like
select a, b, a+b from dual
Tks
Roberto Falk
‎2006 Dec 20 11:29 AM
Hi,
select A B from db into corresponding fields of wa.
wa-c = a + b.
append wa to itab.
endselect.
I don't think there is some way other than iteration.