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: 

how to improve the performance of the abap program

Former Member
0 Kudos

hi all,

I have created an abap program. And it taking long time since the number of records are more. And can anyone let me know how to improve the performance of my abap program.

Using se30 and st05 transaction.

can anyone help me out step by step

regds

haritha

6 REPLIES 6

former_member223537
Active Contributor
0 Kudos

Hi,

Goto transaction ST05

Click ACTIVATE TRACE

Do a /O in command line(To open antoher session)

Run your program

Once you get the ouput

Come back to ST05 screen & Click DEACTIVATE TRACE

Then click on List trace

Check where in the list, more time is consumped

Then try to optimize the query

Select statements should not be inside loop. Check if you have any.

0 Kudos

Hi,

Using SE30 find out what is the Performance distribution of your program.

Make sure that your programs Database performance is less than 50%.

Donto execute any SELECT- ENDSELECT in your program, donot execute SELECT in LOOP ENDLOOP.

Donot call Function modules in LOOP ENDLOOP.

Avoid INNER JOIN where ever possible instead use FOR ALL ENTRIES.

Regards,

Sesh

Former Member
0 Kudos

Go to se30 Tcode and execute the report.

Find out what is the % hitting the database, normally it should be around 30-40 %

And run St05 sql trace find out which table it is hitting more. Try to Fine tune that sql query and reexecute once again in SE30 & ST05.

Hope this info will help you.

Rewards points if useful.

With regards,

K K V

Former Member
0 Kudos

hi,

try to follow this in ur program.

1. dont use into corresponding fields of in select statement until n unless its required.

2. use into table keyword for select statement rather than single select.

3. dont use select statement inside a loop.

4. in order to move data from one table to another try like this.

itab1[] = itab2[] .

5. use transactions SE30 and ST05[sql trace] to find which statements are using more time.

if helpful reward some points.

with regards,

Suresh Aluri.

Former Member
0 Kudos

Hi Haritha,

->Run Any program using SE30 (performance analysis)

Note: Click on the Tips & Tricks button from SE30 to get performance improving tips.

Using this you can improve the performance by analyzing your code part by part.

->To turn runtim analysis on within ABAP code insert the following code

SET RUN TIME ANALYZER ON.

->To turn runtim analysis off within ABAP code insert the following code

SET RUN TIME ANALYZER OFF.

->Always check the driver internal tables is not empty, while using FOR ALL ENTRIES

->Avoid for all entries in JOINS

->Try to avoid joins and use FOR ALL ENTRIES.

->Try to restrict the joins to 1 level only ie only for tables

->Avoid using Select *.

->Avoid having multiple Selects from the same table in the same object.

->Try to minimize the number of variables to save memory.

->The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)

->Avoid creation of index as far as possible

->Avoid operators like <>, > , < & like % in where clause conditions

->Avoid select/select single statements in loops.

->Try to use 'binary search' in READ internal table. -->Ensure table is sorted before using BINARY SEARCH.

->Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)

->Avoid using ORDER BY in selects

->Avoid Nested Selects

->Avoid Nested Loops of Internal Tables

->Try to use FIELD SYMBOLS.

->Try to avoid into Corresponding Fields of

->Avoid using Select Distinct, Use DELETE ADJACENT

Check the following Links

http://www.sapgenie.com/abap/performance.htm

http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp

check the below link

http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm

See the following link if it's any help:

http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp

Check also http://service.sap.com/performance

and

books like

http://www.sap-press.com/product.cfm?account=&product=H951

http://www.sap-press.com/product.cfm?account=&product=H973

http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm

http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp

Performance tuning for Data Selection Statement

http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm

Debugger

http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm

http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc

http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm

Run Time Analyser

http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm

SQL trace

http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm

CATT - Computer Aided Testing Too

http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm

Test Workbench

http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm

Coverage Analyser

http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm

Runtime Monitor

http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm

Memory Inspector

http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm

ECATT - Extended Computer Aided testing tool.

http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm

Just refer to these links...

You can go to the transaction SE30 to have the runtime analysis of your program.Also try the transaction SCI , which is SAP Code Inspector.

edited by,

Naveenan

Former Member
0 Kudos

Hi

<b>Tools for Performance Analysis</b>

<b>Run time analysis transaction SE30

SQL Trace transaction ST05

Extended Program Check (SLIN)

Code Inspector ( SCI)</b>

<b>Run time analysis transaction SE30</b>

In Transaction SE30, fill in the transaction name or the program name which needs to be analyzed for performance tuning.

For our case, let this be “ZABAP_PERF_TUNING”

After giving the required inputs to the program, execute it. After the final output list has been displayed, PRESS the “BACK” button.

On the original SE30 screen, now click on “ANALYZE” button.

The percentage across each of the areas ABAP/ Database/System shows the percentage of total time used for those areas and load on these areas while running the program . The lesser the database load faster the program runs.

<b>SQL Trace – ST05</b>

Starting the Trace:

To analyze a trace file, do the following:

...

Choose the menu path Test &#61614; Performance Trace in the ABAP Workbench or go to Transaction ST05. The initial screen of the test tool appears. In the lower part of the screen, the status of the Performance Trace is displayed. This provides you with information as to whether any of the Performance Traces are switched on and the users for which they are enabled. It also tells you which user has switched the trace on.

Using the selection buttons provided, set which trace functions you wish to have switched on (SWL trace, enqueue trace, RFC trace, table buffer trace).

If you want to switch on the trace under your user name, choose Trace on. If you want to pass on values for one or several filter criteria, choose Trace with Filter. Typical filter criteria are: the name of the user, transaction name, process name, and program name.

Now run the program to be analyzed.

Stopping the Trace:

To deactivate the trace:

...

Choose Test &#61614;Performance Trace in the ABAP Workbench. The initial screen of the test tool appears. It contains a status line displaying the traces that are active, the users for whom they are active, and the user who activated them.

Select the trace functions that you want to switch off.

Choose Deactivate Trace. If you started the trace yourself, you can now switch it off immediately. If the performance trace was started by a different user, a confirmation prompt appears before deactivation-

Analyzing a Sample trace data:

PREPARE: Prepares the OPEN statement for use and determines the access method.

OPEN: Opens the cursor and specifies the selection result by filling the selection fields with concrete values.

FETCH: Moves the cursor through the dataset created by the OPEN operation. The array size displayed beside the fetch data means that the system can transfer a maximum package size of 392 records at one time into the buffered area.

<b>Extended Program Check</b>

<b>Code Inspector ( SCI)</b>

for the above 2 u can directly exectute your program and you will find all the errors and warnings

try to make all the points as zero then the performance will be very good

<b>reward if usefull</b>