‎2007 Jan 22 11:36 AM
Hi Friends,
I want to write a select querry with the date limit example: want to select data till particular date, How can I write it. Can any one tell me how to tell me.
Thanx in advance
Line
‎2007 Jan 22 11:39 AM
parameters : p_date like sy-datum
select field1 field2 into table itab from ztable where date LE p_date.
‎2007 Jan 22 11:41 AM
Thanx for your reply,
I need to collect the data in the internal table till 31.03.2006 how can I write the select querry.
Thanx in advance,
Line
‎2007 Jan 22 11:45 AM
‎2007 Jan 22 11:41 AM
Hi,
If this Date is a Select-option field then
Select field1 field 2 field 3 into table Itab from XXX
where Date<b> in</b> S_DATE.
If the date is not a Select-option, then
Select field1 field 2 field 3 into table Itab from XXX
where Date between DATE1 and DATE2.
Regards
Sudheer
‎2007 Jan 22 11:41 AM
Hi,
You an write using relational operators.
select *
into lt_mkpf
from mkpf
where budat LE p_date.Regards
Bhupal Reddy
‎2007 Jan 22 11:43 AM
Hi
You can add that condition in where statement.
For the standard tables date format is like YYYYMMDD.
so you can give like WHERE endda LE 20060331 . This will fetch upto required date.
Special cases check the date format in table and give it in where condition using less then (LE) or greater than(GE).
By
Yuvaram
‎2007 Jan 22 11:44 AM
Hi
U can create two parameter: one for date from and one for date to.
PARAMETERS: P_FROM TYPE SY-DATUM,
P_TO TYPE SY-DATUM.
AT SELECTION-SCREEN.
IF P_TO < P_FROM.
MESSAGE E208(00) WITH 'Dates are wrong'.
ENDIF.
START-OF-SELECTION.
SELECT * FROM <TABLE> WHERE DATE => P_FROM AND
DATE <= P_TOMax
‎2007 Jan 22 11:49 AM
use WHERE extension of select statemet.
tables: vbak.
parameters : s_date like sy-datum.
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
end of itab.
select vbeln erdat from vbak into table itab up to 5 rows <b>WHERE</b> erdat <b>LT</b>
s_date.
if sy-subrc eq 0.
loop at itab.
write:/ itab-vbeln, itab-erdat.
endloop.
endif.
‎2007 Jan 22 12:31 PM