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

Re:Performance tunning

Former Member
0 Likes
770

Hi,

How to check each and every stmt in my code to see which is taking lot of time for executing,my program taking 5 min time to execute which is very poor in performance, i have used more select stmt, havent used any joins, mine is a .csv file generation

Plz any one help

Hi,

How to check each and every stmt in my code to see which is taking lot of time for executing,my program taking 5 min time to execute which is very poor in performance, i have used more select stmt, havent used any joins, mine is a .csv file generation

Plz any one help

5 REPLIES 5
Read only

Former Member
0 Likes
746

Hi Sravanthi,

Use <b>ST05</b> : SQL trace

SQL trace is used to find out the database requests that a transaction made during its processing. you can find out the tables been used.

you can do this by opening the tcode 'ST05' and selecting the 'TRACE ON'. Now run your program. Again go to 'ST05' and do 'TRACE OFF' and 'LIST TRACE' to view the trace. Now you can see what time each statement took.

You can also use Runtime ABAP analysis using transaction <b>SE30</b>

Regards

Aneesh.

Read only

0 Likes
746

iam not understanding how to check, what is duration colums,in trace list

Read only

Former Member
0 Likes
746

Hello Sravanthii,

Use ST05 Transaction ,Goto ST05->click on trace on ->enter ur transaction and execute->come to st05 ->trace off ->display

I have written simple abap query to check the time

Internal table with header line

here i am using get time field command ,so use both program and see comparision time

report zxyz.

  • Internal table with header line.

DATA:BEGIN OF itab OCCURS 0,

lifnr LIKE lfa1-lifnr,

name1 LIKE lfa1-name1,

END OF itab.

data : f1 type i,

f2 type i,

f3 type i.

start-of-selection.

get run time field f1.

SELECT lifnr name1 FROM lfa1 INTO TABLE itab up to 200 rows.

loop at itab.

endloop.

get run time field f2.

f3 = f2 - f1 .

write 😕 'Time taken by query in Micro seconds', f3.

Internal table without header line

report zxyz1.

  • Internal table without header line.

types : begin of ty_itab ,

lifnr LIKE lfa1-lifnr,

name1 LIKE lfa1-name1,

end of ty_itab.

data itab type standard table of ty_itab.

data wa_itab like line of itab.

data : f1 type i,

f2 type i,

f3 type i.

start-of-selection.

get run time field f1.

SELECT lifnr name1 FROM lfa1 INTO TABLE itab up to 200 rows.

loop at itab into wa_itab.

endloop.

get run time field f2.

f3 = f2 - f1 .

write 😕 'Time taken by query in Micro seconds', f3.

Reward Points if it is helpful

Thanks

Seshu

Read only

0 Likes
746

hi,

The below is the prg

FORM GET_DATA.

IF NOT P_UNAME IS INITIAL.

SELECT * FROM USR02 INTO CORRESPONDING FIELDS OF TABLE USER_ROLE

WHERE BNAME IN P_UNAME.

ELSE.

SELECT * FROM USR02 INTO CORRESPONDING FIELDS OF TABLE USER_ROLE.

ENDIF.

LOOP AT USER_ROLE.

MOVE-CORRESPONDING USER_ROLE TO US_ROLES.

SELECT * FROM AGR_USERS WHERE UNAME = USER_ROLE-BNAME.

IF SY-SUBRC = 0.

MOVE AGR_USERS-AGR_NAME TO US_ROLES-AGR_NAME.

APPEND US_ROLES.

ENDIF.

ENDSELECT.

IF SY-SUBRC NE 0.

APPEND US_ROLES.

ENDIF.

CLEAR US_ROLES.

ENDLOOP.

DELETE US_ROLES WHERE BNAME = ' '.

LOOP AT US_ROLES.

SELECT SINGLE * FROM USR21 WHERE BNAME = US_ROLES-BNAME.

IF SY-SUBRC = 0.

US_ROLES-KOSTL = USR21-KOSTL.

ENDIF.

IF SY-SUBRC = 0.

SELECT SINGLE * FROM ADCP WHERE PERSNUMBER = USR21-PERSNUMBER.

IF SY-SUBRC = 0.

US_ROLES-FUNCTION = ADCP-FUNCTION.

US_ROLES-DEPARTMENT = ADCP-DEPARTMENT.

ENDIF.

ENDIF.

SELECT SINGLE * FROM AGR_TEXTS WHERE AGR_NAME = US_ROLES-AGR_NAME

AND SPRAS = 'E'.

IF SY-SUBRC = 0.

US_ROLES-TEXT = AGR_TEXTS-TEXT.

ENDIF.

MODIFY US_ROLES.

CLEAR US_ROLES.

ENDLOOP.

SELECT AGR_NAME OBJECT LOW FROM AGR_1251 INTO CORRESPONDING FIELDS OF TABLE T_TRAN

FOR ALL ENTRIES IN US_ROLES

WHERE AGR_NAME = US_ROLES-AGR_NAME

AND OBJECT = 'S_TCODE'.

ENDFORM. " GET_DATA

Read only

0 Likes
746

HI Sravanthi,

Check sy-subrc = 0 after evrey select stmt,

avoid the select smt in the loops,

select the data from DB into one internal table before loop wht ever u want.

instead of select stmt in loops just use read stmt,

Regards

suresh.d