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

Handling timestamp

Former Member
0 Likes
1,539

Hi All,

I have a requirement where each row in the Flat file should have different timestamp..... (There will be different time stamps for each individual row in the report)

"This date input will be the value of the timestamp from when the scheduled job was started"

Now the problem is i had used sy-datum and sy-uzeit to get the timestamp.... as the format was to have 2010-05-27 19:48:25

so here i get just 1 time stamp for all the rows....

Coded as below...

Inside the Loop.

MOVE sy-datum+0(4) TO lv_year.

MOVE sy-datum+4(2) TO lv_month.

MOVE sy-datum+6(2) TO lv_day.

CONCATENATE lv_year lv_month lv_day INTO lv_date SEPARATED BY c_colon.

MOVE sy-uzeit+0(2) TO lv_hh.

MOVE sy-uzeit+1(2) TO lv_mm.

MOVE sy-uzeit+2(2) TO lv_ss.

CONCATENATE lv_hh lv_mm lv_ss INTO lv_time SEPARATED BY c_colon.

CONCATENATE lv_date lv_time INTO wa_final-timestamp SEPARATED BY space.

Please let me know......

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,221

Hi friend,

I think get time will work.

because while debugging it takes time so time is updating. but if you run directly it run in a fraction of second so same time will update for all the records.

check large number of data then you will see a updating time.

Thanks and regards,

Viru.

Hi All,

I have a requirement where each row in the Flat file should have different timestamp..... (There will be different time stamps for each individual row in the report)

"This date input will be the value of the timestamp from when the scheduled job was started"

Now the problem is i had used sy-datum and sy-uzeit to get the timestamp.... as the format was to have 2010-05-27 19:48:25

so here i get just 1 time stamp for all the rows....

Coded as below...

Inside the Loop.

MOVE sy-datum+0(4) TO lv_year.

MOVE sy-datum+4(2) TO lv_month.

MOVE sy-datum+6(2) TO lv_day.

CONCATENATE lv_year lv_month lv_day INTO lv_date SEPARATED BY c_colon.

MOVE sy-uzeit+0(2) TO lv_hh.

MOVE sy-uzeit+1(2) TO lv_mm.

MOVE sy-uzeit+2(2) TO lv_ss.

CONCATENATE lv_hh lv_mm lv_ss INTO lv_time SEPARATED BY c_colon.

CONCATENATE lv_date lv_time INTO wa_final-timestamp SEPARATED BY space.

Please let me know......

8 REPLIES 8
Read only

matt
Active Contributor
0 Likes
1,221

According to your spec: ""This date input will be the value of the timestamp from when the scheduled job was started""

This implies that each row is to have the timestamp of the scheduled job. So they will be the same. If you need the timestamp the record was cut, then read the ABAP help on GET TIME.

matt

Read only

Former Member
0 Likes
1,221

cording to your spec: ""This date input will be the value of the timestamp from when the scheduled job was started""

ok if they are talking about when the scheduled job was started then the logic what i have written is fine or not??

Read only

matt
Active Contributor
0 Likes
1,221

Looks fine to me. Except your first c_colon needs to be c_hyphen. And of course the construction of the timestamp can be outside the loop.

Read only

Former Member
0 Likes
1,221

ok.. i did use get time... before using sy-datum and sy-uzeit.....

i guess this will work.... it showing me different time when i debug... but when i see the output without debugging it shows all same value

Read only

Subhankar
Active Contributor
0 Likes
1,221

Hi ,

You can use the statement like below.

CONVERT DATE sy-datum TIME sy-uzeit INTO TIME STAMP l_timestamp TIME ZONE sy-zonlo.

Thanks

Subhankar

Read only

Former Member
0 Likes
1,221

I am getting some error for this convert thing

Read only

matt
Active Contributor
0 Likes
1,221

Without knowing the precise nature of the error, and without telepathy, it's hard to know precisely what you've done wrong, but you are aware, are you, that timestamp is a decimal fields - (type length 8 or 11 with 7 dp ).

Did you read the ABAP help on the statement?

GET TIME is only accurate (for sy-uzeit) to 1 second. Your ABAP probably manages to process all your records rather quicker than that.

Edited by: Matt on Aug 27, 2010 11:38 AM

Read only

Former Member
0 Likes
1,222

Hi friend,

I think get time will work.

because while debugging it takes time so time is updating. but if you run directly it run in a fraction of second so same time will update for all the records.

check large number of data then you will see a updating time.

Thanks and regards,

Viru.