<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Run Time Analysis And Performance Tuning. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511101#M567922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="5" type="ul"&gt;&lt;P&gt;Please Close the Duplicate Threads *****&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see a report performance in SE30(Runtime analysis)and&lt;/P&gt;&lt;P&gt;SQLtrace(ST05).&lt;/P&gt;&lt;P&gt;ST05 tells you the list of selected statements.&lt;/P&gt;&lt;P&gt;You should remember some points when you tuning the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- &lt;STRONG&gt;Use the GET RUN TIME command to help evaluate performance.&lt;/STRONG&gt; It's&lt;/P&gt;&lt;P&gt;hard to know whether that optimization technique REALLY helps unless you&lt;/P&gt;&lt;P&gt;test it out. Using this tool can help you know what is effective, under what&lt;/P&gt;&lt;P&gt;kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so&lt;/P&gt;&lt;P&gt;you should use it to test small pieces of your program, rather than the&lt;/P&gt;&lt;P&gt;whole program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- *Generally, try to reduce I/O first, then memory, then CPU activity.&lt;/P&gt;&lt;P&gt;*I/O operations that read/write to hard disk are always the most&lt;/P&gt;&lt;P&gt;expensive operations. Memory, if not controlled, may have to be written to&lt;/P&gt;&lt;P&gt;swap space on the hard disk, which therefore increases your I/O read/writes&lt;/P&gt;&lt;P&gt;to disk. CPU activity can be reduced by careful program design, and by using&lt;/P&gt;&lt;P&gt;commands such as SUM (SQL) and COLLECT (ABAP/4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Avoid 'SELECT *', especially in tables that have a lot of fields.&lt;/P&gt;&lt;P&gt;Use SELECT A B C INTO instead, so that fields are only read if they are&lt;/P&gt;&lt;P&gt;used. This can make a very big difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Field-groups can be useful for multi-level sorting and displaying.&lt;/P&gt;&lt;P&gt;However, they write their data to the system's paging space, rather than to&lt;/P&gt;&lt;P&gt;memory (internal tables use memory). For this reason, field-groups are only&lt;/P&gt;&lt;P&gt;appropriate for processing large lists (e.g. over 50,000 records). If&lt;/P&gt;&lt;P&gt;you have large lists, you should work with the systems administrator to&lt;/P&gt;&lt;P&gt;decide the maximum amount of RAM your program should use, and from that,&lt;/P&gt;&lt;P&gt;calculate how much space your lists will use. Then you can decide whether to&lt;/P&gt;&lt;P&gt;write the data to memory or swap space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Use as many table keys as possible in the WHERE part of your select&lt;/P&gt;&lt;P&gt;statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Whenever possible, design the program to access a relatively&lt;/P&gt;&lt;P&gt;constant number of records (for instance, if you only access the&lt;/P&gt;&lt;P&gt;transactions for one month, then there probably will be a reasonable range,&lt;/P&gt;&lt;P&gt;like 1200-1800, for the number of transactions inputted within that month).&lt;/P&gt;&lt;P&gt;Then use a SELECT A B C INTO TABLE ITAB statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Get a good idea of how many records you will be accessing. Log into&lt;/P&gt;&lt;P&gt;your productive system, and use SE80 -&amp;gt; Dictionary Objects (press Edit),&lt;/P&gt;&lt;P&gt;enter the table name you want to see, and press Display. Go To Utilities -&amp;gt;&lt;/P&gt;&lt;P&gt;Table Contents to query the table contents and see the number of records.&lt;/P&gt;&lt;P&gt;This is extremely useful in optimizing a program's memory allocation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Try to make the user interface such that the program gradually&lt;/P&gt;&lt;P&gt;unfolds more information to the user, rather than giving a huge list of&lt;/P&gt;&lt;P&gt;information all at once to the user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS&lt;/P&gt;&lt;P&gt;is the number of records you expect to be accessing. If the number of&lt;/P&gt;&lt;P&gt;records exceeds NUM_RECS, the data will be kept in swap space (not memory).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Use SELECT A B C INTO TABLE ITAB whenever possible. This will read&lt;/P&gt;&lt;P&gt;all of the records into the itab in one operation, rather than repeated&lt;/P&gt;&lt;P&gt;operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement.&lt;/P&gt;&lt;P&gt;Make sure that ITAB is declared with OCCURS NUM_RECS, where NUM_RECS is the&lt;/P&gt;&lt;P&gt;number of records you expect to access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- If the number of records you are reading is constantly growing, you&lt;/P&gt;&lt;P&gt;may be able to break it into chunks of relatively constant size. For&lt;/P&gt;&lt;P&gt;instance, if you have to read all records from 1991 to present, you can&lt;/P&gt;&lt;P&gt;break it into quarters, and read all records one quarter at a time. This&lt;/P&gt;&lt;P&gt;will reduce I/O operations. Test extensively with GET RUN TIME when using&lt;/P&gt;&lt;P&gt;this method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Know how to use the 'collect' command. It can be very efficient.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Use the SELECT SINGLE command whenever possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Many tables contain totals fields (such as monthly expense totals).&lt;/P&gt;&lt;P&gt;Use these avoid wasting resources by calculating a total that has already&lt;/P&gt;&lt;P&gt;been calculated and stored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to avoid joins more than 2 tables.&lt;/P&gt;&lt;P&gt;For all entries&lt;/P&gt;&lt;P&gt;The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of &lt;/P&gt;&lt;P&gt;entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the &lt;/P&gt;&lt;P&gt;length of the WHERE clause. &lt;/P&gt;&lt;P&gt;The plus &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Large amount of data &lt;/P&gt;&lt;P&gt;Mixing processing and reading of data &lt;/P&gt;&lt;P&gt;Fast internal reprocessing of data &lt;/P&gt;&lt;P&gt;Fast &lt;/P&gt;&lt;P&gt;The Minus &lt;/P&gt;&lt;P&gt;Difficult to program/understand &lt;/P&gt;&lt;P&gt;Memory could be critical (use FREE or PACKAGE size) &lt;/P&gt;&lt;P&gt;Some steps that might make FOR ALL ENTRIES more efficient: &lt;/P&gt;&lt;P&gt;Removing duplicates from the the driver table &lt;/P&gt;&lt;P&gt;Sorting the driver table &lt;/P&gt;&lt;P&gt;If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement: &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN i_tab &lt;/P&gt;&lt;P&gt;WHERE mykey &amp;gt;= i_tab-low and &lt;/P&gt;&lt;P&gt;mykey &amp;lt;= i_tab-high.&lt;/P&gt;&lt;P&gt;Nested selects&lt;/P&gt;&lt;P&gt;The plus: &lt;/P&gt;&lt;P&gt;Small amount of data &lt;/P&gt;&lt;P&gt;Mixing processing and reading of data &lt;/P&gt;&lt;P&gt;Easy to code - and understand &lt;/P&gt;&lt;P&gt;The minus: &lt;/P&gt;&lt;P&gt;Large amount of data &lt;/P&gt;&lt;P&gt;when mixed processing isn&amp;#146;t needed &lt;/P&gt;&lt;P&gt;Performance killer no. 1 &lt;/P&gt;&lt;P&gt;Select using JOINS&lt;/P&gt;&lt;P&gt;The plus &lt;/P&gt;&lt;P&gt;Very large amount of data &lt;/P&gt;&lt;P&gt;Similar to Nested selects - when the accesses are planned by the programmer &lt;/P&gt;&lt;P&gt;In some cases the fastest &lt;/P&gt;&lt;P&gt;Not so memory critical &lt;/P&gt;&lt;P&gt;The minus &lt;/P&gt;&lt;P&gt;Very difficult to program/understand &lt;/P&gt;&lt;P&gt;Mixing processing and reading of data not possible &lt;/P&gt;&lt;P&gt;Use the selection criteria &lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK. &lt;/P&gt;&lt;P&gt;CHECK: SBOOK-CARRID = 'LH' AND &lt;/P&gt;&lt;P&gt;SBOOK-CONNID = '0400'. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK &lt;/P&gt;&lt;P&gt;WHERE CARRID = 'LH' AND &lt;/P&gt;&lt;P&gt;CONNID = '0400'. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;Use the aggregated functions &lt;/P&gt;&lt;P&gt;C4A = '000'. &lt;/P&gt;&lt;P&gt;SELECT * FROM T100 &lt;/P&gt;&lt;P&gt;WHERE SPRSL = 'D' AND &lt;/P&gt;&lt;P&gt;ARBGB = '00'. &lt;/P&gt;&lt;P&gt;CHECK: T100-MSGNR &amp;gt; C4A. &lt;/P&gt;&lt;P&gt;C4A = T100-MSGNR. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT MAX( MSGNR ) FROM T100 INTO C4A &lt;/P&gt;&lt;P&gt;WHERE SPRSL = 'D' AND &lt;/P&gt;&lt;P&gt;ARBGB = '00'. &lt;/P&gt;&lt;P&gt;Select with view&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01L &lt;/P&gt;&lt;P&gt;WHERE DOMNAME LIKE 'CHAR%' &lt;/P&gt;&lt;P&gt;AND AS4LOCAL = 'A'. &lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM DD01T &lt;/P&gt;&lt;P&gt;WHERE DOMNAME = DD01L-DOMNAME &lt;/P&gt;&lt;P&gt;AND AS4LOCAL = 'A' &lt;/P&gt;&lt;P&gt;AND AS4VERS = DD01L-AS4VERS &lt;/P&gt;&lt;P&gt;AND DDLANGUAGE = SY-LANGU. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01V &lt;/P&gt;&lt;P&gt;WHERE DOMNAME LIKE 'CHAR%' &lt;/P&gt;&lt;P&gt;AND DDLANGUAGE = SY-LANGU. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;Select with index support&lt;/P&gt;&lt;P&gt;SELECT * FROM T100 &lt;/P&gt;&lt;P&gt;WHERE ARBGB = '00' &lt;/P&gt;&lt;P&gt;AND MSGNR = '999'. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM T002. &lt;/P&gt;&lt;P&gt;SELECT * FROM T100 &lt;/P&gt;&lt;P&gt;WHERE SPRSL = T002-SPRAS &lt;/P&gt;&lt;P&gt;AND ARBGB = '00' &lt;/P&gt;&lt;P&gt;AND MSGNR = '999'. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select &amp;#133; Into table&lt;/P&gt;&lt;P&gt;REFRESH X006. &lt;/P&gt;&lt;P&gt;SELECT * FROM T006 INTO X006. &lt;/P&gt;&lt;P&gt;APPEND X006. &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM T006 INTO TABLE X006.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select with selection list&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01L &lt;/P&gt;&lt;P&gt;WHERE DOMNAME LIKE 'CHAR%' &lt;/P&gt;&lt;P&gt;AND AS4LOCAL = 'A'. &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DOMNAME FROM DD01L &lt;/P&gt;&lt;P&gt;INTO DD01L-DOMNAME &lt;/P&gt;&lt;P&gt;WHERE DOMNAME LIKE 'CHAR%' &lt;/P&gt;&lt;P&gt;AND AS4LOCAL = 'A'. &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;Key access to multiple lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB. &lt;/P&gt;&lt;P&gt;CHECK TAB-K = KVAL. &lt;/P&gt;&lt;P&gt;" ... &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT TAB WHERE K = KVAL. &lt;/P&gt;&lt;P&gt;" ... &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Copying internal tables&lt;/P&gt;&lt;P&gt;REFRESH TAB_DEST. &lt;/P&gt;&lt;P&gt;LOOP AT TAB_SRC INTO TAB_DEST. &lt;/P&gt;&lt;P&gt;APPEND TAB_DEST. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAB_DEST[] = TAB_SRC[].&lt;/P&gt;&lt;P&gt;Modifying a set of lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB. &lt;/P&gt;&lt;P&gt;IF TAB-FLAG IS INITIAL. &lt;/P&gt;&lt;P&gt;TAB-FLAG = 'X'. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;MODIFY TAB. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAB-FLAG = 'X'. &lt;/P&gt;&lt;P&gt;MODIFY TAB TRANSPORTING FLAG &lt;/P&gt;&lt;P&gt;WHERE FLAG IS INITIAL. &lt;/P&gt;&lt;P&gt;Deleting a sequence of lines&lt;/P&gt;&lt;P&gt;DO 101 TIMES. &lt;/P&gt;&lt;P&gt;DELETE TAB_DEST INDEX 450. &lt;/P&gt;&lt;P&gt;ENDDO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TAB_DEST FROM 450 TO 550.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linear search vs. binary&lt;/P&gt;&lt;P&gt;READ TABLE TAB WITH KEY K = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.&lt;/P&gt;&lt;P&gt;Comparison of internal tables&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE: TAB1 LINES L1, &lt;/P&gt;&lt;P&gt;TAB2 LINES L2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF L1 &amp;lt;&amp;gt; L2. &lt;/P&gt;&lt;P&gt;TAB_DIFFERENT = 'X'. &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;TAB_DIFFERENT = SPACE. &lt;/P&gt;&lt;P&gt;LOOP AT TAB1. &lt;/P&gt;&lt;P&gt;READ TABLE TAB2 INDEX SY-TABIX. &lt;/P&gt;&lt;P&gt;IF TAB1 &amp;lt;&amp;gt; TAB2. &lt;/P&gt;&lt;P&gt;TAB_DIFFERENT = 'X'. EXIT. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF TAB_DIFFERENT = SPACE. &lt;/P&gt;&lt;P&gt;" ... &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF TAB1[] = TAB2[]. &lt;/P&gt;&lt;P&gt;" ... &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;Modify selected components&lt;/P&gt;&lt;P&gt;LOOP AT TAB. &lt;/P&gt;&lt;P&gt;TAB-DATE = SY-DATUM. &lt;/P&gt;&lt;P&gt;MODIFY TAB. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WA-DATE = SY-DATUM. &lt;/P&gt;&lt;P&gt;LOOP AT TAB. &lt;/P&gt;&lt;P&gt;MODIFY TAB FROM WA TRANSPORTING DATE. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;Appending two internal tables&lt;/P&gt;&lt;P&gt;LOOP AT TAB_SRC. &lt;/P&gt;&lt;P&gt;APPEND TAB_SRC TO TAB_DEST. &lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF TAB_SRC TO TAB_DEST.&lt;/P&gt;&lt;P&gt;Deleting a set of lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB_DEST WHERE K = KVAL. &lt;/P&gt;&lt;P&gt;DELETE TAB_DEST. &lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TAB_DEST WHERE K = KVAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tools available in SAP to pin-point a performance problem&lt;/P&gt;&lt;P&gt;The runtime analysis (SE30)&lt;/P&gt;&lt;P&gt;SQL Trace (ST05)&lt;/P&gt;&lt;P&gt;Tips and Tricks tool &lt;/P&gt;&lt;P&gt;The performance database&lt;/P&gt;&lt;P&gt;Optimizing the load of the database&lt;/P&gt;&lt;P&gt;Using table buffering&lt;/P&gt;&lt;P&gt;Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are: &lt;/P&gt;&lt;P&gt;Select DISTINCT &lt;/P&gt;&lt;P&gt;ORDER BY / GROUP BY / HAVING clause &lt;/P&gt;&lt;P&gt;Any WHERE clasuse that contains a subquery or IS NULL expression &lt;/P&gt;&lt;P&gt;JOIN s &lt;/P&gt;&lt;P&gt;A SELECT... FOR UPDATE &lt;/P&gt;&lt;P&gt;If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECT clause. &lt;/P&gt;&lt;P&gt;Use the ABAP SORT Clause Instead of ORDER BY&lt;/P&gt;&lt;P&gt;The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server. &lt;/P&gt;&lt;P&gt;If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Avoid ther SELECT DISTINCT Statement&lt;/P&gt;&lt;P&gt;As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2007 06:25:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-12T06:25:51Z</dc:date>
    <item>
      <title>Run Time Analysis And Performance Tuning.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511098#M567919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAPers,&lt;/P&gt;&lt;P&gt;what is the difference between Run Time Analysis And Performance Tuning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Explain in Details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ramana Prasad.T&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 06:01:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511098#M567919</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T06:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Run Time Analysis And Performance Tuning.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511099#M567920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Run Time Analysis&amp;lt;/b&amp;gt; includes finding out how much time a particular query is taking. i.e. Database hit for retrieving records takes how much time. It takes into account the Database hit time + Network load &amp;amp; bandwidth.&lt;/P&gt;&lt;P&gt;SE30 transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Performance tuning&amp;lt;/b&amp;gt; only check for the database hit period. It doesnt take into account Network load/bandwidth into consideration. &lt;/P&gt;&lt;P&gt;Optimizing a select query with proper where clause will hv a considerable impact on Performance tuning but if the Network bandwidth is not gud, then it wont reflect the impact on Run time Analysis.&lt;/P&gt;&lt;P&gt;ST05 transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 06:18:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511099#M567920</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T06:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Run Time Analysis And Performance Tuning.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511100#M567921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;Runtime Analysis &amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Tool for analyzing the execution of program parts or individual statements and for measuring their runtime. Call using transaction code SE30. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Tools provided for Performance Analysis&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following are the different tools provided by SAP for performance analysis of an ABAP object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   1. Run time analysis transaction SE30&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   2. SQL Trace transaction ST05&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    The trace list has many lines that are not related to the SELECT statement in the ABAP program. This is because the execution of any ABAP program requires additional administrative SQL calls. To restrict the list output, use the filter introducing the trace list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trace list contains different SQL statements simultaneously related to the one SELECT statement in the ABAP program. This is because the R/3 Database Interface - a sophisticated component of the R/3 Application Server - maps every Open SQL statement to one or a series of physical database calls and brings it to execution. This mapping, crucial to R/3s performance, depends on the particular call and database system. For example, the SELECT-ENDSELECT loop on the SPFLI table in our test program is mapped to a sequence PREPARE-OPEN-FETCH of physical calls in an Oracle environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    The WHERE clause in the trace list's SQL statement is different from the WHERE clause in the ABAP statement. This is because in an R/3 system, a client is a self-contained unit with separate master records and its own set of table data (in commercial, organizational, and technical terms). With ABAP, every Open SQL statement automatically executes within the correct client environment. For this reason, a condition with the actual client code is added to every WHERE clause if a client field is a component of the searched table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To see a statement's execution plan, just position the cursor on the PREPARE statement and choose Explain SQL. A detailed explanation of the execution plan depends on the database system in use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition check these links...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/perform/performhome.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/perform/performhome.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/perform/perform_pcursor.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/perform/perform_pcursor.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 06:22:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511100#M567921</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T06:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Run Time Analysis And Performance Tuning.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511101#M567922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="5" type="ul"&gt;&lt;P&gt;Please Close the Duplicate Threads *****&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see a report performance in SE30(Runtime analysis)and&lt;/P&gt;&lt;P&gt;SQLtrace(ST05).&lt;/P&gt;&lt;P&gt;ST05 tells you the list of selected statements.&lt;/P&gt;&lt;P&gt;You should remember some points when you tuning the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- &lt;STRONG&gt;Use the GET RUN TIME command to help evaluate performance.&lt;/STRONG&gt; It's&lt;/P&gt;&lt;P&gt;hard to know whether that optimization technique REALLY helps unless you&lt;/P&gt;&lt;P&gt;test it out. Using this tool can help you know what is effective, under what&lt;/P&gt;&lt;P&gt;kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so&lt;/P&gt;&lt;P&gt;you should use it to test small pieces of your program, rather than the&lt;/P&gt;&lt;P&gt;whole program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- *Generally, try to reduce I/O first, then memory, then CPU activity.&lt;/P&gt;&lt;P&gt;*I/O operations that read/write to hard disk are always the most&lt;/P&gt;&lt;P&gt;expensive operations. Memory, if not controlled, may have to be written to&lt;/P&gt;&lt;P&gt;swap space on the hard disk, which therefore increases your I/O read/writes&lt;/P&gt;&lt;P&gt;to disk. CPU activity can be reduced by careful program design, and by using&lt;/P&gt;&lt;P&gt;commands such as SUM (SQL) and COLLECT (ABAP/4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Avoid 'SELECT *', especially in tables that have a lot of fields.&lt;/P&gt;&lt;P&gt;Use SELECT A B C INTO instead, so that fields are only read if they are&lt;/P&gt;&lt;P&gt;used. This can make a very big difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Field-groups can be useful for multi-level sorting and displaying.&lt;/P&gt;&lt;P&gt;However, they write their data to the system's paging space, rather than to&lt;/P&gt;&lt;P&gt;memory (internal tables use memory). For this reason, field-groups are only&lt;/P&gt;&lt;P&gt;appropriate for processing large lists (e.g. over 50,000 records). If&lt;/P&gt;&lt;P&gt;you have large lists, you should work with the systems administrator to&lt;/P&gt;&lt;P&gt;decide the maximum amount of RAM your program should use, and from that,&lt;/P&gt;&lt;P&gt;calculate how much space your lists will use. Then you can decide whether to&lt;/P&gt;&lt;P&gt;write the data to memory or swap space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Use as many table keys as possible in the WHERE part of your select&lt;/P&gt;&lt;P&gt;statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Whenever possible, design the program to access a relatively&lt;/P&gt;&lt;P&gt;constant number of records (for instance, if you only access the&lt;/P&gt;&lt;P&gt;transactions for one month, then there probably will be a reasonable range,&lt;/P&gt;&lt;P&gt;like 1200-1800, for the number of transactions inputted within that month).&lt;/P&gt;&lt;P&gt;Then use a SELECT A B C INTO TABLE ITAB statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Get a good idea of how many records you will be accessing. Log into&lt;/P&gt;&lt;P&gt;your productive system, and use SE80 -&amp;gt; Dictionary Objects (press Edit),&lt;/P&gt;&lt;P&gt;enter the table name you want to see, and press Display. Go To Utilities -&amp;gt;&lt;/P&gt;&lt;P&gt;Table Contents to query the table contents and see the number of records.&lt;/P&gt;&lt;P&gt;This is extremely useful in optimizing a program's memory allocation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Try to make the user interface such that the program gradually&lt;/P&gt;&lt;P&gt;unfolds more information to the user, rather than giving a huge list of&lt;/P&gt;&lt;P&gt;information all at once to the user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS&lt;/P&gt;&lt;P&gt;is the number of records you expect to be accessing. If the number of&lt;/P&gt;&lt;P&gt;records exceeds NUM_RECS, the data will be kept in swap space (not memory).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Use SELECT A B C INTO TABLE ITAB whenever possible. This will read&lt;/P&gt;&lt;P&gt;all of the records into the itab in one operation, rather than repeated&lt;/P&gt;&lt;P&gt;operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement.&lt;/P&gt;&lt;P&gt;Make sure that ITAB is declared with OCCURS NUM_RECS, where NUM_RECS is the&lt;/P&gt;&lt;P&gt;number of records you expect to access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- If the number of records you are reading is constantly growing, you&lt;/P&gt;&lt;P&gt;may be able to break it into chunks of relatively constant size. For&lt;/P&gt;&lt;P&gt;instance, if you have to read all records from 1991 to present, you can&lt;/P&gt;&lt;P&gt;break it into quarters, and read all records one quarter at a time. This&lt;/P&gt;&lt;P&gt;will reduce I/O operations. Test extensively with GET RUN TIME when using&lt;/P&gt;&lt;P&gt;this method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Know how to use the 'collect' command. It can be very efficient.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Use the SELECT SINGLE command whenever possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Many tables contain totals fields (such as monthly expense totals).&lt;/P&gt;&lt;P&gt;Use these avoid wasting resources by calculating a total that has already&lt;/P&gt;&lt;P&gt;been calculated and stored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to avoid joins more than 2 tables.&lt;/P&gt;&lt;P&gt;For all entries&lt;/P&gt;&lt;P&gt;The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of &lt;/P&gt;&lt;P&gt;entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the &lt;/P&gt;&lt;P&gt;length of the WHERE clause. &lt;/P&gt;&lt;P&gt;The plus &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Large amount of data &lt;/P&gt;&lt;P&gt;Mixing processing and reading of data &lt;/P&gt;&lt;P&gt;Fast internal reprocessing of data &lt;/P&gt;&lt;P&gt;Fast &lt;/P&gt;&lt;P&gt;The Minus &lt;/P&gt;&lt;P&gt;Difficult to program/understand &lt;/P&gt;&lt;P&gt;Memory could be critical (use FREE or PACKAGE size) &lt;/P&gt;&lt;P&gt;Some steps that might make FOR ALL ENTRIES more efficient: &lt;/P&gt;&lt;P&gt;Removing duplicates from the the driver table &lt;/P&gt;&lt;P&gt;Sorting the driver table &lt;/P&gt;&lt;P&gt;If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement: &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN i_tab &lt;/P&gt;&lt;P&gt;WHERE mykey &amp;gt;= i_tab-low and &lt;/P&gt;&lt;P&gt;mykey &amp;lt;= i_tab-high.&lt;/P&gt;&lt;P&gt;Nested selects&lt;/P&gt;&lt;P&gt;The plus: &lt;/P&gt;&lt;P&gt;Small amount of data &lt;/P&gt;&lt;P&gt;Mixing processing and reading of data &lt;/P&gt;&lt;P&gt;Easy to code - and understand &lt;/P&gt;&lt;P&gt;The minus: &lt;/P&gt;&lt;P&gt;Large amount of data &lt;/P&gt;&lt;P&gt;when mixed processing isn&amp;#146;t needed &lt;/P&gt;&lt;P&gt;Performance killer no. 1 &lt;/P&gt;&lt;P&gt;Select using JOINS&lt;/P&gt;&lt;P&gt;The plus &lt;/P&gt;&lt;P&gt;Very large amount of data &lt;/P&gt;&lt;P&gt;Similar to Nested selects - when the accesses are planned by the programmer &lt;/P&gt;&lt;P&gt;In some cases the fastest &lt;/P&gt;&lt;P&gt;Not so memory critical &lt;/P&gt;&lt;P&gt;The minus &lt;/P&gt;&lt;P&gt;Very difficult to program/understand &lt;/P&gt;&lt;P&gt;Mixing processing and reading of data not possible &lt;/P&gt;&lt;P&gt;Use the selection criteria &lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK. &lt;/P&gt;&lt;P&gt;CHECK: SBOOK-CARRID = 'LH' AND &lt;/P&gt;&lt;P&gt;SBOOK-CONNID = '0400'. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK &lt;/P&gt;&lt;P&gt;WHERE CARRID = 'LH' AND &lt;/P&gt;&lt;P&gt;CONNID = '0400'. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;Use the aggregated functions &lt;/P&gt;&lt;P&gt;C4A = '000'. &lt;/P&gt;&lt;P&gt;SELECT * FROM T100 &lt;/P&gt;&lt;P&gt;WHERE SPRSL = 'D' AND &lt;/P&gt;&lt;P&gt;ARBGB = '00'. &lt;/P&gt;&lt;P&gt;CHECK: T100-MSGNR &amp;gt; C4A. &lt;/P&gt;&lt;P&gt;C4A = T100-MSGNR. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT MAX( MSGNR ) FROM T100 INTO C4A &lt;/P&gt;&lt;P&gt;WHERE SPRSL = 'D' AND &lt;/P&gt;&lt;P&gt;ARBGB = '00'. &lt;/P&gt;&lt;P&gt;Select with view&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01L &lt;/P&gt;&lt;P&gt;WHERE DOMNAME LIKE 'CHAR%' &lt;/P&gt;&lt;P&gt;AND AS4LOCAL = 'A'. &lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM DD01T &lt;/P&gt;&lt;P&gt;WHERE DOMNAME = DD01L-DOMNAME &lt;/P&gt;&lt;P&gt;AND AS4LOCAL = 'A' &lt;/P&gt;&lt;P&gt;AND AS4VERS = DD01L-AS4VERS &lt;/P&gt;&lt;P&gt;AND DDLANGUAGE = SY-LANGU. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01V &lt;/P&gt;&lt;P&gt;WHERE DOMNAME LIKE 'CHAR%' &lt;/P&gt;&lt;P&gt;AND DDLANGUAGE = SY-LANGU. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;Select with index support&lt;/P&gt;&lt;P&gt;SELECT * FROM T100 &lt;/P&gt;&lt;P&gt;WHERE ARBGB = '00' &lt;/P&gt;&lt;P&gt;AND MSGNR = '999'. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM T002. &lt;/P&gt;&lt;P&gt;SELECT * FROM T100 &lt;/P&gt;&lt;P&gt;WHERE SPRSL = T002-SPRAS &lt;/P&gt;&lt;P&gt;AND ARBGB = '00' &lt;/P&gt;&lt;P&gt;AND MSGNR = '999'. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select &amp;#133; Into table&lt;/P&gt;&lt;P&gt;REFRESH X006. &lt;/P&gt;&lt;P&gt;SELECT * FROM T006 INTO X006. &lt;/P&gt;&lt;P&gt;APPEND X006. &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM T006 INTO TABLE X006.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select with selection list&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01L &lt;/P&gt;&lt;P&gt;WHERE DOMNAME LIKE 'CHAR%' &lt;/P&gt;&lt;P&gt;AND AS4LOCAL = 'A'. &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DOMNAME FROM DD01L &lt;/P&gt;&lt;P&gt;INTO DD01L-DOMNAME &lt;/P&gt;&lt;P&gt;WHERE DOMNAME LIKE 'CHAR%' &lt;/P&gt;&lt;P&gt;AND AS4LOCAL = 'A'. &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;Key access to multiple lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB. &lt;/P&gt;&lt;P&gt;CHECK TAB-K = KVAL. &lt;/P&gt;&lt;P&gt;" ... &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT TAB WHERE K = KVAL. &lt;/P&gt;&lt;P&gt;" ... &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Copying internal tables&lt;/P&gt;&lt;P&gt;REFRESH TAB_DEST. &lt;/P&gt;&lt;P&gt;LOOP AT TAB_SRC INTO TAB_DEST. &lt;/P&gt;&lt;P&gt;APPEND TAB_DEST. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAB_DEST[] = TAB_SRC[].&lt;/P&gt;&lt;P&gt;Modifying a set of lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB. &lt;/P&gt;&lt;P&gt;IF TAB-FLAG IS INITIAL. &lt;/P&gt;&lt;P&gt;TAB-FLAG = 'X'. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;MODIFY TAB. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAB-FLAG = 'X'. &lt;/P&gt;&lt;P&gt;MODIFY TAB TRANSPORTING FLAG &lt;/P&gt;&lt;P&gt;WHERE FLAG IS INITIAL. &lt;/P&gt;&lt;P&gt;Deleting a sequence of lines&lt;/P&gt;&lt;P&gt;DO 101 TIMES. &lt;/P&gt;&lt;P&gt;DELETE TAB_DEST INDEX 450. &lt;/P&gt;&lt;P&gt;ENDDO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TAB_DEST FROM 450 TO 550.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linear search vs. binary&lt;/P&gt;&lt;P&gt;READ TABLE TAB WITH KEY K = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.&lt;/P&gt;&lt;P&gt;Comparison of internal tables&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE: TAB1 LINES L1, &lt;/P&gt;&lt;P&gt;TAB2 LINES L2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF L1 &amp;lt;&amp;gt; L2. &lt;/P&gt;&lt;P&gt;TAB_DIFFERENT = 'X'. &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;TAB_DIFFERENT = SPACE. &lt;/P&gt;&lt;P&gt;LOOP AT TAB1. &lt;/P&gt;&lt;P&gt;READ TABLE TAB2 INDEX SY-TABIX. &lt;/P&gt;&lt;P&gt;IF TAB1 &amp;lt;&amp;gt; TAB2. &lt;/P&gt;&lt;P&gt;TAB_DIFFERENT = 'X'. EXIT. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF TAB_DIFFERENT = SPACE. &lt;/P&gt;&lt;P&gt;" ... &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF TAB1[] = TAB2[]. &lt;/P&gt;&lt;P&gt;" ... &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;Modify selected components&lt;/P&gt;&lt;P&gt;LOOP AT TAB. &lt;/P&gt;&lt;P&gt;TAB-DATE = SY-DATUM. &lt;/P&gt;&lt;P&gt;MODIFY TAB. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WA-DATE = SY-DATUM. &lt;/P&gt;&lt;P&gt;LOOP AT TAB. &lt;/P&gt;&lt;P&gt;MODIFY TAB FROM WA TRANSPORTING DATE. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;Appending two internal tables&lt;/P&gt;&lt;P&gt;LOOP AT TAB_SRC. &lt;/P&gt;&lt;P&gt;APPEND TAB_SRC TO TAB_DEST. &lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF TAB_SRC TO TAB_DEST.&lt;/P&gt;&lt;P&gt;Deleting a set of lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB_DEST WHERE K = KVAL. &lt;/P&gt;&lt;P&gt;DELETE TAB_DEST. &lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TAB_DEST WHERE K = KVAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tools available in SAP to pin-point a performance problem&lt;/P&gt;&lt;P&gt;The runtime analysis (SE30)&lt;/P&gt;&lt;P&gt;SQL Trace (ST05)&lt;/P&gt;&lt;P&gt;Tips and Tricks tool &lt;/P&gt;&lt;P&gt;The performance database&lt;/P&gt;&lt;P&gt;Optimizing the load of the database&lt;/P&gt;&lt;P&gt;Using table buffering&lt;/P&gt;&lt;P&gt;Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are: &lt;/P&gt;&lt;P&gt;Select DISTINCT &lt;/P&gt;&lt;P&gt;ORDER BY / GROUP BY / HAVING clause &lt;/P&gt;&lt;P&gt;Any WHERE clasuse that contains a subquery or IS NULL expression &lt;/P&gt;&lt;P&gt;JOIN s &lt;/P&gt;&lt;P&gt;A SELECT... FOR UPDATE &lt;/P&gt;&lt;P&gt;If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECT clause. &lt;/P&gt;&lt;P&gt;Use the ABAP SORT Clause Instead of ORDER BY&lt;/P&gt;&lt;P&gt;The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server. &lt;/P&gt;&lt;P&gt;If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Avoid ther SELECT DISTINCT Statement&lt;/P&gt;&lt;P&gt;As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 06:25:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511101#M567922</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T06:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Run Time Analysis And Performance Tuning.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511102#M567923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Runtime analysis is one of the tool used for performance tuning.&lt;/P&gt;&lt;P&gt;The other tool is sqltrace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Runtime Analysis&lt;/P&gt;&lt;BR /&gt;The following documentation describes the runtime analysis application in the ABAP Workbench. The runtime analysis provides an overview of the duration of your source code, from individual statements up to complete transactions. &lt;BR /&gt;&lt;BR /&gt;Choose Menu ®Test ®Runtime Analysis or transaction SE30 to start the runtime analysis. On the initial screen, you will find the four main functions of this tool. They can be activated using the appropriate pushbutton:&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;&lt;P&gt;sql trace&lt;/P&gt;&lt;/B&gt;&lt;BR /&gt;The Performance Trace allows you to record database access, locking activities, remote calls of reports and transactions, and table buffer calls from the SAP system in a trace file and to display the performance log as a list. The Performance Trace additionally offers wide support when analyzing individual trace records in detail. &lt;BR /&gt;&lt;BR /&gt;1. SQL Trace: This allows you to monitor the database access of reports and transactions. &lt;BR /&gt;See also SQL Trace Analysis.&lt;BR /&gt;&lt;BR /&gt; 2. Enqueue Trace: This allows you to monitor the locking system.&lt;BR /&gt;See also Enqueue Trace Analysis.&lt;BR /&gt;&lt;BR /&gt; 3. RFC Trace: This provides information about Remote Function Calls between instances.&lt;BR /&gt;See also RFC Trace Analysis.&lt;BR /&gt;&lt;BR /&gt; 4. Table buffer trace: You can use this to monitor database calls of reports and transactions made via the table buffer. See also, Table Buffer Trace Analysis.&lt;BR /&gt;&lt;BR /&gt;Hope this answers your curiosity,&lt;BR /&gt;Award points if useful else getbk,&lt;BR /&gt;Aleem.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;· Measurement in dialog status&lt;BR /&gt;&lt;BR /&gt;· Measurement of external session&lt;BR /&gt;&lt;BR /&gt;· Planning a measurement&lt;BR /&gt;&lt;BR /&gt;· Selection of measurement restrictions&lt;BR /&gt;&lt;BR /&gt;· Analyzing measurement results &lt;BR /&gt;&lt;BR /&gt;For large applications it is recommended that you first analyze the entire application and hit list.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;&lt;/B&gt;&lt;B&gt;&lt;/B&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 06:28:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/run-time-analysis-and-performance-tuning/m-p/2511102#M567923</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T06:28:43Z</dc:date>
    </item>
  </channel>
</rss>

