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: 

to select from database table based on date range

Former Member
0 Kudos
1,878

hi

i have a selection screen in which date range is being given

say eg 23/06/07 to 23/12/08

based on this date i want to select data from a ztable

eg i want to select a field amount from table

and three is a field date range on the table

for this particular field i want to select all records for amount field and factual field falling wiithing this date range and sum it

eg

based on date range as in selcetion screen

select amount( field1) factual ( field2) from ztable into it_ztable where date = ?....

please give me code for it and how to sum all values as i will get from the ztable into internal table the two values as fetched from the ztable

please suggest asap

regards

arora

1 ACCEPTED SOLUTION

former_member673464
Active Contributor
0 Kudos
292

hi,

You can use the ranges table for your requirement.It is similar to select -option. You have to fill low as lower date , high as high data ,option as 'EQ' and sign as 'I'. You can write select query as

select sum(currency)

from dtab1

......

where date in r_date.

Regards,

Veeresh

3 REPLIES 3

former_member673464
Active Contributor
0 Kudos
293

hi,

You can use the ranges table for your requirement.It is similar to select -option. You have to fill low as lower date , high as high data ,option as 'EQ' and sign as 'I'. You can write select query as

select sum(currency)

from dtab1

......

where date in r_date.

Regards,

Veeresh

0 Kudos
292

hi

i am using

sELECT field1 field2 FROM Ztable INto it_matu

where DATE GE sl_dat-low

AND DATE LE sl_dat-high.

i am getting data in internal table but

say i have twelve records now i want to sum it the both the columns into and use that sum final amount to display

let me know how to use sume in the intrranal tabl do i need to use control statement

how to use the sum for two columns and take into a serperate variable to display

regards

aRora

Former Member
0 Kudos
292

problem solved got the solution