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: 

ABAP- Read data that have been created today

sinaei
Contributor
0 Kudos

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

6 REPLIES 6

0 Kudos

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?

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

amy_king
Active Contributor

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

0 Kudos

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

amy_king
Active Contributor
0 Kudos

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