Skip to Content
-2

ABAP- Read data that have been created today

Apr 06 at 09:36 AM

87

avatar image

Dear All,

I have a question regarding to ABAP where statement. in my table I have a field that is CreatedTimestamp of record, But I need to read the data that are created today(Based on system time obviously)

My requirement is to

Select * from Ztable where (CreatedTimestamp is today)

Any help will be appreciate.

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Amy King Apr 09 at 03:10 PM
1

Hi,

You could generate two timestamps, one representing 12:00AM TODAY and another representing 11:59PM TODAY, then write your query as...

SELECT * 
       FROM Ztable 
       WHERE CreatedTimestamp BETWEEN low_timestamp AND high_timestamp.

Cheers,

Amy

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Amy,

Thanks a lot for your response,

I knew that I should write between, but I do not know how can I write "12:00AM TODAY" and "11:59PM TODAY"

This is my question.

Could you please help me about this?


Thanks
Sin

0

Hi Sin,

Take a look at the ABAP documentation for CONVERT INTO TIME STAMP. You can use this to create your LOW and HIGH timestamps for use in the SQL query.

Cheers,

Amy

0
Horst Keller
Apr 06 at 10:02 AM
0
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Horst,

Thanks for your reply,

But I dont know how should I can achieve my requirement... I am not going to convert my timestamp to any other value.

I want to say this phrase: CreatedTimestamp is between (CurrentTimestamp -00:01 AND CurrentTimestamp -23:59)

Something like below:

TSTMP_SECONDS_BETWEEN( tstmp1, tstmp2, on_error )


But I dont know how can I write it and how can I say Today at 00:01 until today 23:59


Could you please help me about this?

0

You can convert ts to date and compare with date of today.

0