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: 

Time taken to execute my report?

Former Member
0 Kudos

Hi Expects,

I want to print in the output how much time taken to execute my report. Please help on this.

regards,

vijay

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

You can use the statement

GET RUN TIME field t1.

gives the runtime till that particular statement.

If you give the statement in the end of the report it will give you the run time taken to execute the entire report.

Regards.

Lavanya.

8 REPLIES 8

Former Member
0 Kudos

Vijay,

At the starting of the report

GET TIME field1

At the ending.

GET TIME field2.

Field2 - Field1 will the time taken for execution.

REgards,

Ravi

Former Member
0 Kudos

Hi vijay,

1. simple

2. we have to use two things to get Current time.

GET TIME

SY-UZEIT.

3.

report abc.

*----


data : t1 type sy-uzeit.

data : t2 type sy-uzeit.

data : diff type i.

data : ekko like table of ekko with header line.

*----


get time.

t1 = sy-uzeit.

select * from ekko into table ekko.

select * from ekko into table ekko.

*----


get time.

t2 = sy-uzeit.

*----


write 😕 t1.

write 😕 t2.

diff = t2 - t1.

write 😕 'Time Taken : ' , diff.

regards,

amit m.

Former Member
0 Kudos

Hi Vijay,

You can check this code.

Code:

Data:v_time like sy-uzeit,

v_start like sy-uzeit,

v_diff like sy-uzeit,

v_message type string,

v_mes type string.

Initialization.

v_start = sy-uzeit.

start-of-selection.

get time.

v_time = sy-uzeit.

v_diff = v_time - v_start.

concatenate v_diff v_message into v_mes.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

text = v_mes

This will print time along with message in status bar.

I hope this code reach your functionality.

Regards,

Murali

former_member188685
Active Contributor
0 Kudos

Hi,

You can get the total duration from BACKGROUND job also.

enter all the inputs in selection screen.

set the Background job from Menu EXCUTE Background job or F9. fill print parameters, and then set the job.

once job finishes you can find the total execution time.

Regards

vijay

Former Member
0 Kudos

Hi

You can use the statement

GET RUN TIME field t1.

gives the runtime till that particular statement.

If you give the statement in the end of the report it will give you the run time taken to execute the entire report.

Regards.

Lavanya.

Former Member
0 Kudos

Finding the time difference is a bit tricky in the case where the program finishes on a different date than it starts. You have to take the difference in dates into account as well as the time. Fortunately, there is at least one FM that will do this: L_TO_TIME_DIFF.

Rob

0 Kudos

This worked quite well:


REPORT ztest MESSAGE-ID zc.

DATA: start_dt LIKE sy-datum,
      start_tm LIKE sy-uzeit,
      end_dt   LIKE sy-datum,
      end_tm   LIKE sy-uzeit,
      dif      LIKE ltak-istwm.


START-OF-SELECTION.
  GET TIME.
  start_dt = sy-datum.
  start_tm = sy-uzeit.

* Program logic

END-OF-SELECTION.
  GET TIME.
  end_dt = sy-datum.
  end_tm = sy-uzeit.

  CALL FUNCTION 'L_TO_TIME_DIFF'
       EXPORTING
            i_start_date     = start_dt
            i_start_time     = start_tm
            i_end_date       = end_dt
            i_end_time       = end_tm
            i_time_uom       = 'S'
       IMPORTING
            e_time_diff      = dif
       EXCEPTIONS
            input_data_empty = 1
            OTHERS           = 2.

  WRITE: /001 'Start date    :', start_dt,
         /001 'Start time    :', start_tm,
         /001 'End date      :', end_dt,
         /001 'End time      :', end_tm,
         /001 'Execution time:', dif, 'seconds'.

Rob

former_member181966
Active Contributor
0 Kudos

Try FM

SWO_GET_RUNTIME_INFO

Tip: Go to se37-> search string runtime or TIM . You’ll get lots of Functions modules.

Thanks

Saquib