Application Development and Automation 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: 
Read only

Retrieving milli or microseconds?

Former Member
0 Likes
2,686

Hello

I have a time stamp question in ABAP.

I can retrieve the current time in HHMMSS with SY-UZEIT or SY-TIMLO, but how do I retrieve a smaller increment than SS (seconds). i.e. milli or microseconds?

Many Thanks

Peter

1 ACCEPTED SOLUTION
Read only

MalaGo
Explorer
0 Likes
1,826

Hi,

I think you can use a field type TIMESTAMPL ( not just TIMESTAMP !!! ) and fill it using statement GET TIME STAMP FIELD ... and store this value in a table during update.

Regards,

Malgorzata

Message was edited by: Malgorzata Jaworek

5 REPLIES 5
Read only

nablan_umar
Product and Topic Expert
Product and Topic Expert
0 Likes
1,826

Hi Peter,

Are you trying to evaluate the processing time between 2 actions. Look at GET RUN TIME FIELD f where field f is an integer. The number is in microseconds.

Read only

0 Likes
1,826

Hi Nablan

Thanks for the reply.

No, I am not trying to measure the time between 2 actions. I would like to know how (if possible) to get the current milli or microseconds.

Eg: if a process updates a table with a timestamp, I would like to get an increment smaller than seconds. As sometimes 2 independent processes might have the same timestamp using HHMMSS and I would like to see which really happened first.

I will look at GET RUN TIME FIELD to see if it can help.

Many Thanks

Peter

Read only

0 Likes
1,826

Peter, I can only thing in a case where you need this:

- you hare having 2 processes who are inserting data in the same table, with the same key at the same time, and you were using the timestamp to differ them

If you are working with a Z table, just add one more field to the primary key called "program" or "transaction" and put the name of the program/transaction there. Your programs could put data in the same second, but the primary key will be different.

You can do this using a hard-coded number, in example

- report ZINSERT_A and ZINSERT_B are your programs

- create a new field in your table "report_id type c long 1"

- modify your reports to change the append instruction to put "A" and "B" in the table (changing the internal tables or so)

If you don't like these kind of hard-coding, just define the field a longer string and use sy-repid.

Wish it helps if you are not able to use milliseconds,

Vicenç

Read only

MalaGo
Explorer
0 Likes
1,827

Hi,

I think you can use a field type TIMESTAMPL ( not just TIMESTAMP !!! ) and fill it using statement GET TIME STAMP FIELD ... and store this value in a table during update.

Regards,

Malgorzata

Message was edited by: Malgorzata Jaworek

Read only

Former Member
0 Likes
1,826

Thank everyone how replied.

Malgorzata, I tried your trick and it seem to work.

See dump below. It looks like the mircroseconds are

to the right of the decimal. Thanks again!!!

TIMESTAMPL -


sy-datum -- sy-uzeit

======================================

20,040,909,160,856.7075290 2004.09.09 10:08:56

20,040,909,160,857.4794180 2004.09.09 10:08:57

20,040,909,160,858.2537190 2004.09.09 10:08:58

20,040,909,160,859.0396030 2004.09.09 10:08:59