‎2006 Jun 27 6:33 AM
Hi All
The scenario...
I am having two dates.. date1 = 20060105 and date2=20063105.
Now i need to select few fields from VBRK within these dates.
As per requirement, i should not use selection screen, so that user can easily input the above dates to get the data.
Can anybody provde me the SELECT code..???
How to write WHERE condition for this requirement..???
‎2006 Jun 27 6:37 AM
Check sy-date format and use BETWEEN with Select query.
Regards
vinod
‎2006 Jun 27 6:35 AM
Hi
Create a Ranage and Fetch the data based on the range.
Regards,
Baburaj
‎2006 Jun 27 6:37 AM
Check sy-date format and use BETWEEN with Select query.
Regards
vinod
‎2006 Jun 27 6:39 AM
HI,
SELECT * FROM VBRK
INTO TABLE itab
WHERE FKDAT GE date1 AND
FDDAT LE date2.
Regards,
WAsim Ahmed
‎2006 Jun 27 6:39 AM
Hi,
RANGES : r_prodno FOR sy-datum.
MOVE: 'I' TO r_prodno-sign.
MOVE: 'EQ' TO r_prodno-option.
MOVE: 'BT' TO r_prodno-option.
APPEND r_prodno.
U can define the ranges as above.
And use the same in ur select statement.
Cheers,
Simha.
‎2006 Jun 27 6:40 AM
Hi,
Use the foll code .
DATA : i_vbrk type vbrk occurs 0.
<b>
select * from VBRK into table i_vbrk where
ERDAT GE date1 and
ERDAT LE date2 .
</b>
Rgds,
Jothi.
Mark useful answers.
‎2006 Jun 27 6:41 AM
syntex is...
<b>Select * from test
where date between date1 and date2.</b>
‎2006 Jun 27 6:43 AM
2 options:
use erdat ge l_date1
and erdate le l_date2.
or
erdat between l_date1 and l_date2.
Reward points if it helps
Regards
Gunjan
‎2006 Jun 27 6:42 AM
ranges : r_range like vbrk-FKDAT.
r_date-sign = 'I'.
r_date-option = 'EQ'.
r_date-low = '20060105'.
r_date-high = '20063105'.
select field1 field2
into itab
from VBRK
where datefieldname in r_date.
‎2006 Jun 27 6:44 AM
use ranges ,
is the user enters atlest one data on screen..? or not..
plz let us know clearly..pls!!
Ramesh.
‎2006 Jun 27 6:49 AM
Hi,
If u want to restrict the dates for current month,
then use this code..
data : lv_date(8) type c,
lv_month(2) type c,
lv_year(4) type c,
date1 type dats,
date2 type dats.
lv_month = sy-datum+3(2).
lv_year = sy-datum+0(4).
concatenate lv_year lv_month '01' into lv_date.
date1 = lv_date.
*Get the last date of the month.
CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = date1
IMPORTING
LAST_DAY_OF_MONTH = date2
EXCEPTIONS
DAY_IN_NOT_VALID = 1
OTHERS = 2.
select * from VBRK where date1 >= '<date1>' and date2 <= '<date2>' .
Rgds,
Prakash
‎2006 Jun 27 6:49 AM
Hello,
1. Create a ranges.
2. Prepare the range.
3. Access the range.
Ex:
RANGES <sel> FOR <f>.
Now,
clear <sel>
<sel>-option = 'I'.
<sel>-sign = 'BT'.
<sel>-low = 'XXXX'.
<sel>-high = 'YYYY'.
append <sel>.
Now use this range in the select query like,
select * from <ABC> where datab in <sel>.
Regs,
Venkat Ramanan
‎2006 Jun 27 7:05 AM
Hi,
Try this,
SELECT * FROM VBRK INTO TABLE itab
WHERE FKDAT BETWEEN date1 AND date2.
Kind regards,
Thangesh