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 using range

Former Member
0 Likes
21,459

hi

i have a req to use in a select statement two dates variables

eg variable dat1 and dat2 has some date for eg say 01-09-08 and 09-02-09 and i want to use select statement with both the dates

for eg say

SELECT * FROM table INTO table it_text

WHERE key1 = var1

  • date = date1.

now i want to use range for defining the dates as i have nw two dates. and i want to get records for both the dates.

pls suggest

rgds

Arora

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,128

hi,

check this code:


ranges: d for table-date.
d-sign = 'I'.
d-option = 'EQ'.
d-low = '20080101'.
append d.

d-sign = 'I'.
d-option = 'EQ'.
d-low = '20091001'.
append d.

SELECT * FROM table INTO table it_text
WHERE key1 = var1 AND
 date IN d.

regards,darek

4 REPLIES 4
Read only

Former Member
0 Likes
3,129

hi,

check this code:


ranges: d for table-date.
d-sign = 'I'.
d-option = 'EQ'.
d-low = '20080101'.
append d.

d-sign = 'I'.
d-option = 'EQ'.
d-low = '20091001'.
append d.

SELECT * FROM table INTO table it_text
WHERE key1 = var1 AND
 date IN d.

regards,darek

Read only

Former Member
0 Likes
3,128

I remember your all previous questions and following them closely.

I suspects if you read moderatoru2019s message or not? Yet your question should be forbidden because you must follow youu2019re below thread but updating your additional problem regarding ranges in select.

Moderator message - Moved to the correct forum

Edited by: Rob Burbank on Sep 9, 2009 10:14 AM

Take care and yet you not deserve to reactive the answers anymore since you did not share your solutions with us.

Edited by: Amit Gujargoud on Sep 29, 2009 3:52 PM

Read only

0 Likes
3,128

here is the solution...

DATA r_netwr type range of table-netwr,

wa_datvr like line of r_netwr

Constants: lc_sign type C value 'I',

lc_options(2) type C Value 'BT'.

clear r_netwr.

wa_datvr-sign = lc_sign .

wa_datvr-option = lc_options.

wa_datvr-low = l_predat.

wa_datvr-high = gs_toav0_old-ar_date.

append wa_datvr to r_netwr

SELECT * FROM table INTO TABLE gt_table

AND datvr in r_netwr.

thanks

regards

Nishant

Read only

Former Member
0 Likes
3,128

problme resolved self