Application Development 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: 

date & time field

Former Member
0 Kudos

hi

i wanted to know whether there is any datatype for holding both date& time together.

for example:

if i wanted to the entries between 17.01.2005 15.00 to 19.01.2005 5.00 ..

Our query is

.... ...WHERE out_tm BETWEEN from_time AND to_time

AND out_dt BETWEEN from_date AND to_date.

which is not performing as wanted since from time is greater than to time ...

One of the records is having date-time as 18.01.2005 16.00 has to come as per requirements.

Regards,

Nigesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi nigesh,

1. WHERE out_tm BETWEEN from_time AND to_time

AND out_dt BETWEEN from_date AND to_date

Such condition of Date & Time is <b>Little TRICKY.</b>

2.

<b>

where

(

( out_dt > from_date and out_dt < to_date)

or

( out_dt = from_date and out_tm >= from_time)

or

( out_dt = to_date and out_tm <= to_time)</b>

)

regards,

amit m.

6 REPLIES 6

former_member784222
Active Participant
0 Kudos

Hi,

You have time stamp field. eg domain: RSLGTIME, element: RSPOCRTIME fieldname RQCRETIME table TSP01.

Thanks and regards,

S. Chandra Mouli.

former_member181962
Active Contributor
0 Kudos

YOu should write your where condition as follows:

where out_tm > from_time and out_dt >= from_date

and out_tm < to_time and out_dt <= to_date.

Former Member
0 Kudos

Hi Nigesh,

Define a field of type TIMESTAMPL, and use the ABAP command GET TIME STAMP FIELD to fill it. This combines date and time together.

You can use the command CONVERT TIME STAMP to convert it back to date and time.

Former Member
0 Kudos

Hi Nigesh,

Probably the data type TIMESTAMP or TIMESTAMPL might be use to you. Check them out.

<b>Reward points if this info helps,</b>

Kiran

Former Member
0 Kudos

***u can adapt and modify ur query like this

data:

itab like table of ztabsac01 with header line,

date_from like sy-datum,

date_to like sy-datum,

time_from type sy-uzeit,

time_to type sy-uzeit,

temp_date_from like sy-datum,

temp_date_to like sy-datum.

****e.g test data

date_from = sy-datum - 5.

date_to = sy-datum.

time_from = sy-uzeit.

time_to = sy-uzeit.

temp_date_from = date_from + 1.

temp_date_to = date_to - 1.

write:

date_from,time_from,/ date_to,time_to.

select * from ztabsac01

into table itab

where

entry_date between temp_date_from and temp_date_to.

select * from ztabsac01

appending table itab

where

entry_date eq date_from and

( entry_time between time_from and '235959' ).

select * from ztabsac01

appending table itab

where

entry_date eq date_to and

( entry_time between '000000' and time_to ).

      • now the internal table contains the records u wanted

reward points if helpful

Former Member
0 Kudos

Hi nigesh,

1. WHERE out_tm BETWEEN from_time AND to_time

AND out_dt BETWEEN from_date AND to_date

Such condition of Date & Time is <b>Little TRICKY.</b>

2.

<b>

where

(

( out_dt > from_date and out_dt < to_date)

or

( out_dt = from_date and out_tm >= from_time)

or

( out_dt = to_date and out_tm <= to_time)</b>

)

regards,

amit m.