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

SLM Time Stamp Calculation help needed

Former Member
0 Likes
754

My organization is trying to keep trck of the average time it takes to close out a request ticket. I am able to pull a report that shows me the Creation Timestamp (MM/DD/YY HH:MM:SS) and the Closing Timestamp(MM/DD/YY HH:MM:SS). How ever I can not get the program to calculate the difference in a timestamp format ie: HH:MM:SS

It is not calculating the dates correctly.

Here is what I have so far. I am able to specify a date in which I want to find the totals and then display only the fields i want. Again I am missing something in the calculation portion of the below program.

REPORT ZSLMTIMERNOTIFWL.

DATA wa_dnod_notif TYPE dnod_notif.

PARAMETERS pa_dnod type D.

DATA: begin of wa1_dnod_notif occurs 0.

include structure dnod_notif.

DATA: end of wa1_dnod_notif.

DATA: tstamp type timestamp,

d TYPE D,

t TYPE T,

tz(06) type C.

DATA: tstamp1 type timestamp,

d1 TYPE D,

t1 TYPE T,

result TYPE Timestamp.

SELECT status processor numb crea_tstmp clo_tstmp

FROM dnod_notif

INTO CORRESPONDING FIELDS OF wa_dnod_notif.

NEW-LINE.

move wa_dnod_notif-CREA_TSTMP to tstamp.

CONVERT TIME STAMP tstamp TIME ZONE tz INTO DATE d TIME t.

move wa_dnod_notif-CLO_TSTMP to tstamp1.

CONVERT TIME STAMP tstamp1 TIME ZONE tz INTO DATE d1 TIME t1.

if d = pa_dnod.

COMPUTE Result = ( ( tstamp1 - tstamp ) ) .

WRITE wa_dnod_notif-status.

WRITE wa_dnod_notif-processor.

WRITE wa_dnod_notif-numb.

WRITE wa_dnod_notif-crea_tstmp.

WRITE wa_dnod_notif-clo_tstmp.

WRITE RESULT.

endif.

ENDSELECT.

IF SY-SUBRC NE 0.

WRITE 'Sorry no Data'.

ENDIF.

I have searched the threads and have not found a function specific to SLM or a line of code that will work. Can anyone recommend anything?

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
719

Hi,

Use function module TIMECALC_DIFF

aRs

My organization is trying to keep trck of the average time it takes to close out a request ticket. I am able to pull a report that shows me the Creation Timestamp (MM/DD/YY HH:MM:SS) and the Closing Timestamp(MM/DD/YY HH:MM:SS). How ever I can not get the program to calculate the difference in a timestamp format ie: HH:MM:SS

It is not calculating the dates correctly.

Here is what I have so far. I am able to specify a date in which I want to find the totals and then display only the fields i want. Again I am missing something in the calculation portion of the below program.

REPORT ZSLMTIMERNOTIFWL.

DATA wa_dnod_notif TYPE dnod_notif.

PARAMETERS pa_dnod type D.

DATA: begin of wa1_dnod_notif occurs 0.

include structure dnod_notif.

DATA: end of wa1_dnod_notif.

DATA: tstamp type timestamp,

d TYPE D,

t TYPE T,

tz(06) type C.

DATA: tstamp1 type timestamp,

d1 TYPE D,

t1 TYPE T,

result TYPE Timestamp.

SELECT status processor numb crea_tstmp clo_tstmp

FROM dnod_notif

INTO CORRESPONDING FIELDS OF wa_dnod_notif.

NEW-LINE.

move wa_dnod_notif-CREA_TSTMP to tstamp.

CONVERT TIME STAMP tstamp TIME ZONE tz INTO DATE d TIME t.

move wa_dnod_notif-CLO_TSTMP to tstamp1.

CONVERT TIME STAMP tstamp1 TIME ZONE tz INTO DATE d1 TIME t1.

if d = pa_dnod.

COMPUTE Result = ( ( tstamp1 - tstamp ) ) .

WRITE wa_dnod_notif-status.

WRITE wa_dnod_notif-processor.

WRITE wa_dnod_notif-numb.

WRITE wa_dnod_notif-crea_tstmp.

WRITE wa_dnod_notif-clo_tstmp.

WRITE RESULT.

endif.

ENDSELECT.

IF SY-SUBRC NE 0.

WRITE 'Sorry no Data'.

ENDIF.

I have searched the threads and have not found a function specific to SLM or a line of code that will work. Can anyone recommend anything?

3 REPLIES 3
Read only

Former Member
0 Likes
719

Hi,

I have found some info on this.Just check this and see whether the move statement is fine.

CONVERT - Converting Timestamps

CONVERT - Converting Timestamps

Variants:

1. CONVERT TIME STAMP tst TIME ZONE tz INTO DATE d TIME t.

2. CONVERT DATE d TIME t INTO TIME STAMP tst TIME ZONE tz.

Effect Converts the timestamp tst into date d or time t based on the

time zone tz.

tst must have the type P(8) (short form) or P(11) with 7

decimal places (long form). tz must have the type C(6). The

ABAP Dictionary contains the data elements TIMESTAMP,

TIMESTAMPL, and TIMEZONE, which you can use in DATA ... TYPE

... statements to declare tst and tz. There are no strict type

checks for the date d or time t. If you specify a variable

that does not have type T, the system uses the type conversion

rules applied in the MOVE statement.

As mentioned above, the data type of GS_TEST-TIMESTAMP_FROM should be p.

Hope it will be useful.

Thanks,

Sandeep.

Read only

former_member194669
Active Contributor
0 Likes
720

Hi,

Use function module TIMECALC_DIFF

aRs

Read only

Former Member
0 Likes
719

Thank you both for the help.