‎2008 Nov 07 6:36 AM
Hi All,
Requirement,
Fetch the data based on date and time.
Input parameter.
Selection screen :----
Select-options : Entry Date .
Select-options : Entry Time.
I have written code to fetch the data based on Entry Date and Entry time.
Code :----
select *
from tablename
into table i_tab
where entrydate in s_enntdat and
entrytime in s_ennttim.
this code fetches the data from date and time.
But i must get the data betweeb entry date and entry time.
Eg:-.... when I give
Entry Date : 22.09.2008 to 07.11.2008
Entry Time Low : 11:00:20
Entry Time High: 06:00:00.
I am getting only entries from date 22.09.2008.
My requirement is that it has to get all the datas from table between 22.09.2008 to 07.11.2008.
And documents between time 11:00:00 to 06:00:00.
That is data should start from 22.09.2008 and time 11:00:00
and end at 07.11.2008 and time 06:00:00.
If there are any entries between 22.09.2008 and 07.11.2008. Irrespective of time all the entries must be retrived.
how to write a single select query for this.
‎2008 Nov 07 6:39 AM
Hi This is TIME related query ...
So u need to use the TIME macros for this for example..
after GET pernr events.
write
RP_READ_ALL_TIME_ITY PERNR SPACE PN-BEGDA PN-ENDDA.
and after this loop on the pernr based on your requirement and fetch the data and this will solve your requirement.
Regards
Sas
‎2008 Nov 07 6:41 AM
Hi Praveen,
According to me u have done only half the code.
U need to now LOOP the internal table and then move the values to an OUTPUT table
LOOP at tablename into wa_tablename.
move: tablename-entrydate to wa_out-entrydate,
tablename-entrytime to wa_out-entrytime.
append wa_out to it_out.
clear wa_out.
regards,
suryakiran
‎2008 Nov 07 6:43 AM
Hi......
I think there is no data on 07.11.2008 between this time
11:00:20 & 06:00:00.
that's why data is not coming out......
Just try running you select statement with out time options......
it will work as your select query is fine....
Thanks
Saurabh
‎2008 Nov 07 6:48 AM
hi.. try this..
select *
from tablename
into table i_tab
where entrydate between s_enntdat and s_ennttim.
regards,
Padma.
‎2008 Nov 07 7:02 AM
Hi,
Try like this.
REPORT YSAMPLE.
tables: vbak.
data: begin of itab occurs 0,
vbeln type VBELN_VA,
erdat type erdat,
erzet type erzet,
end of itab.
SELECTION-SCREEN: begin of block b1 with frame title text-001.
select-OPTIONS: date for vbak-ERDAT,
time for vbak-ERZET.
SELECTION-SCREEN: end of block b1.
select * from vbak into CORRESPONDING FIELDS OF TABLE itab where erdat in date and erzet in time.
loop at itab.
write: / itab-vbeln, itab-erdat, itab-erzet.
endloop.
Thanks,
Srilakshmi
‎2008 Nov 07 7:05 AM
Hi Praveen,
I think that the select statement that is written is correct.Have u checked whether data is there in the database for that particular date period and time period?
I think there will be no data.Please check
Rgds,
khadeer.