‎2004 Sep 08 9:37 PM
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
‎2004 Sep 09 12:03 PM
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
‎2004 Sep 08 10:18 PM
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.
‎2004 Sep 08 10:37 PM
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
‎2004 Sep 09 9:07 AM
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ç
‎2004 Sep 09 12:03 PM
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
‎2004 Sep 09 5:16 PM
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