2006 Jun 01 8:41 AM
Wanna select 5 fields (numeric) from a ztable based on date :
After selecting want to <b>add</b> them and move them to respective variable .
Say APP_SITES to gv_btr21,
SITE_CON to gv_btr22 etc.,
Query I wrote:
select APP_SITES SITE_CON LAND_COST TOTAL_CIP TOTAL_EXCL RES_NEED
from zreserve
into ( gv_btr21, gv_btr22, gv_btr24, gv_btr23, gv_btr26, gv_btr30 )
where erdat in s_pper.
Wanna select 5 fields (numeric) from a ztable based on date :
After selecting want to <b>add</b> them and move them to respective variable .
Say APP_SITES to gv_btr21,
SITE_CON to gv_btr22 etc.,
Query I wrote:
select APP_SITES SITE_CON LAND_COST TOTAL_CIP TOTAL_EXCL RES_NEED
from zreserve
into ( gv_btr21, gv_btr22, gv_btr24, gv_btr23, gv_btr26, gv_btr30 )
where erdat in s_pper.
2006 Jun 01 8:44 AM
Hi Mohan,
You can use the SUM command in the select query ..
Just refer this link in SAP Library..
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm
Also go through the program <b>demo_select_group_by</b>.
In that instead of MAX(carrid) , just type SUM(CARRID) and find out the results.
Hope you got me..
Regards,
SP.
2006 Jun 01 8:44 AM
Hi,
select APP_SITES SITE_CON LAND_COST TOTAL_CIP TOTAL_EXCL RES_NEED
from zreserve
into ( gv_btr21, gv_btr22, gv_btr24, gv_btr23, gv_btr26, gv_btr30 )
where erdat in s_pper.
w_total = w_total + gv_btr21 + gv_btr22 ... + gv_btr30
endselect.
Or you can declare a internal table and then dump the data into the table and thnen loop at the table and do the sum.
Regards,
Ravi
2006 Jun 01 8:45 AM
HI Mohan
You have to use Group By to obtain the sum for each fields seperately.
i.e seperate query for each fields.
regards
kishore
2006 Jun 01 9:32 AM
select sum( APP_SITES ) sum( SITE_CON ) sum( LAND_COST ) sum( TOTAL_CIP ) sum( TOTAL_EXCL ) sum( RES_NEED )
from zreserve
into (gv_btr21,gv_btr22,gv_btr24,gv_btr23, gv_btr26, gv_btr30)
where erdat in s_pper.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |