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

select Query addition subraction

Former Member
0 Likes
640

hi all ...

Fetch total invoice cost as VBRK-NETWR+VBRK-MWSBK ..

now can i write it one select select querry ??

select ( netwr + mwsbk ) as abc from vbrk . ??

can this be done??

please help ..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
585

>

hi,

you can try this way..


select sum(netwr) sum(mwsbk) from vbrk into ( w_netwr , w_mwsbk)
where <condition>.
if sy-subrc = 0.
w_total = w_netwr + w_mwsbk.
endif.

regards,

Prabhudas

4 REPLIES 4
Read only

former_member404244
Active Contributor
0 Likes
585

Hi,

This is not possible....Get the data into an internal table and then loop it and modify the record..

Regards,

Nagaraj

Read only

Former Member
0 Likes
586

>

hi,

you can try this way..


select sum(netwr) sum(mwsbk) from vbrk into ( w_netwr , w_mwsbk)
where <condition>.
if sy-subrc = 0.
w_total = w_netwr + w_mwsbk.
endif.

regards,

Prabhudas

Read only

Former Member
0 Likes
585

Hi,

Thats not possible in a single select statement in ABAP. You cannot sum multiple fields of the same table in a single select query.

Only this is possible.


SELECT SUM ( netwr ) SUM (mwsbk ) 
into ( v_netwr, v_mwsbk )
from vbrk.

Regards,

Vikranth

Read only

Former Member
0 Likes
585

thanks all!!