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 query

Former Member
0 Kudos

Hi,

HOW TO FIND OUT TIME TAKEN TO EXECUTE SELECT QUERY IN SAP, SAY FOR EXAMPLE

SELECT * FROM MARA WHERE MATNR BETWEEN '100' AND '1000'.

HOW TO PRINT TIME TAKEN TO EXECUTE ABOVE QUERY i.e. TIME IN MICROSECONDS...

IF YOU HAVE SAMPLE PROGRAM THEN PLEASE LET ME KNOW.

THANKS,

JOHN.

1 ACCEPTED SOLUTION

dani_mn
Active Contributor
0 Kudos

first write your query in a program and then use the transaction SE30 to analyze every detail.

Regards,

Wasim Ahmed

8 REPLIES 8

dani_mn
Active Contributor
0 Kudos

first write your query in a program and then use the transaction SE30 to analyze every detail.

Regards,

Wasim Ahmed

Former Member
0 Kudos

just declare.

END-OF-SELECTION.

GET TIME.

end_dt = sy-datum.

end_tm = sy-uzeit.

<b>ex--</b>

select * from ekko into table ekko.

get time.

t1 = sy-uzeit.

select * from ekko into table ekko.

*----


get time.

t2 = sy-uzeit.

*----


write 😕 t1.

write 😕 t2.

diff = t2 - t1.

write 😕 'Time Taken : ' , diff.

Former Member

Former Member
0 Kudos

Hi John,

You can do this through TCode ST05. You can get the time taken to execute the SQL statement in this. Enter the SQL statement in ST05 and execute the same and you get the time taken for execution.

Regards,

Ram Mohan

Pls reward points if helpful....

Former Member
0 Kudos

best way is ST05.

Regards

Prabhu

Former Member
0 Kudos

HI

GOOD

YOU CAN SEE THE TIME TAKEN TO EXECUTE THE QUERY IN THE TCODE SCI AND YOU CAN TAKE THE PRINT OUT OF THAT ALSO.

THANKS

MRUTYUN

Former Member
0 Kudos

You can do this:


data: start   TYPE i,
      end     TYPE i,
      dif     TYPE i.

  GET RUN TIME FIELD start.

  SELECT SINGLE bukrs belnr gjahr blart budat
    FROM  bkpf
    INTO (cc, doc, fy, doc_ty, pst_dt)
    WHERE bukrs = p_bukrs
    AND   belnr = p_belnr
    AND   gjahr = p_gjahr.

  GET RUN TIME FIELD end.
  dif = end - start.

  WRITE: /001 'Time for select',
          067  ':', dif, 'microseconds'.

Rob

Former Member
0 Kudos

Hi,

Execute your in background mode and check

sm37 job log for start time and end time.

Regards

Amole