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

Former Member
0 Likes
1,430

I have selection screen with select-options field Validity

If the user enters some date

I have to fetch the data from A017 table depends on Datab Datbi that record should display

How to write select query to check the entered date is in between database fields Datab and Datbi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,161

You can write like

if user enters only low value and high value..

declare two variables

data : v_date1 type sy-datum,

v_date2 type sy-datum.

start-of-selection.

loop at s_date. -> select option

v_date1 = s_date-low.

v_date2 = s_date-high.

endloop.

select * from A017 into table int_a017

where datab ge v_date1

and datbi le v_date2.

Thanks

Seshu

8 REPLIES 8
Read only

Former Member
0 Likes
1,161

Hi Pradeep,

If the date entered is in the select-option then it is very hard to validate the same.

As it involve lots of things to be checked.

Better define date as parameter and use you can check very easily.

Regards,

Atish

Read only

0 Likes
1,161

if i declare it as parameter how to use it in select query

How to write select query

Can u please tell me

Read only

Former Member
0 Likes
1,162

You can write like

if user enters only low value and high value..

declare two variables

data : v_date1 type sy-datum,

v_date2 type sy-datum.

start-of-selection.

loop at s_date. -> select option

v_date1 = s_date-low.

v_date2 = s_date-high.

endloop.

select * from A017 into table int_a017

where datab ge v_date1

and datbi le v_date2.

Thanks

Seshu

Read only

Former Member
0 Likes
1,161

hi

good

with the select query stament add the A017-FIELD NAME EQ that field name where you r going to entered the date,

thanks

mrutyun^

Read only

dev_parbutteea
Active Contributor
0 Likes
1,161

Hi,

why don't you use :

where s_validity is your select option

select * from A017

into table int_a017

where datab in s_validity

and datbi in s_validity.

Regards

Read only

Former Member
0 Likes
1,161

select-options: s-date for a017-datab.

SELECT *

FROM a017 into itab

WHERE datab LE s_date

AND datbi GE s-date.

reward if useful

anju

Read only

Former Member
0 Likes
1,161

Thank you for all answers

Read only

Former Member
0 Likes
1,161

Thank you