<?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 abap performance in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711175#M311050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to do performance tunning of a program&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Nov 2006 13:58:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-07T13:58:48Z</dc:date>
    <item>
      <title>abap performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711175#M311050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to do performance tunning of a program&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Nov 2006 13:58:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711175#M311050</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-07T13:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: abap performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711176#M311051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are a couple things that you can do to help with performance, but the most important is to make sure that your SELECT statements are optimized.  You can check the performance using SQL trace, transaction ST05&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Nov 2006 14:02:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711176#M311051</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-11-07T14:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: abap performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711177#M311052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use runtime analysis/performance analysis using SE30 and ST05 transaction codes. This will give you an idea of processing times and you can fine tune your program accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Nov 2006 14:02:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711177#M311052</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-07T14:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: abap performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711178#M311053</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;&lt;A href="http://www.erpgenie.com/abap/performance.htm" target="test_blank"&gt;http://www.erpgenie.com/abap/performance.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp" target="test_blank"&gt;http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm" target="test_blank"&gt;http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance tuning for Data Selection Statement  &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;PRE&gt;&lt;CODE&gt;SELECT * FROM SBOOK.                    
  CHECK: SBOOK-CARRID = 'LH' AND        
                  SBOOK-CONNID = '0400'.         
ENDSELECT.                              
SELECT * FROM SBOOK                      
  WHERE CARRID = 'LH' AND                
        CONNID = '0400'.                 
ENDSELECT.                               
Use the aggregated functions 
C4A = '000'.               
SELECT * FROM T100         
  WHERE SPRSL = 'D' AND    
        ARBGB = '00'.      
  CHECK: T100-MSGNR &amp;gt; C4A. 
  C4A = T100-MSGNR.        
ENDSELECT.                 

SELECT MAX( MSGNR ) FROM T100 INTO C4A  
 WHERE SPRSL = 'D' AND                 
       ARBGB = '00'.                   
Select with view
SELECT * FROM DD01L                     
  WHERE DOMNAME LIKE 'CHAR%'            
        AND AS4LOCAL = 'A'.             
  SELECT SINGLE * FROM DD01T            
    WHERE   DOMNAME    = DD01L-DOMNAME  
        AND AS4LOCAL   = 'A'            
        AND AS4VERS    = DD01L-AS4VERS  
        AND DDLANGUAGE = SY-LANGU.      
ENDSELECT.                              

SELECT * FROM DD01V                     
 WHERE DOMNAME LIKE 'CHAR%'            
       AND DDLANGUAGE = SY-LANGU.      
ENDSELECT.                              
Select with index support
SELECT * FROM T100             
 WHERE     ARBGB = '00'       
       AND MSGNR = '999'.     
ENDSELECT.                     

SELECT * FROM T002.              
  SELECT * FROM T100             
    WHERE     SPRSL = T002-SPRAS 
          AND ARBGB = '00'       
          AND MSGNR = '999'.     
  ENDSELECT.                     
ENDSELECT.                       


Select &amp;#133; Into table
REFRESH X006.                  
SELECT * FROM T006 INTO X006.  
  APPEND X006.                 
ENDSELECT

SELECT * FROM T006 INTO TABLE X006.


Select with selection list
SELECT * FROM DD01L               
  WHERE DOMNAME LIKE 'CHAR%'      
        AND AS4LOCAL = 'A'.       
ENDSELECT

SELECT DOMNAME FROM DD01L     
 INTO DD01L-DOMNAME          
 WHERE DOMNAME LIKE 'CHAR%'  
       AND AS4LOCAL = 'A'.   
ENDSELECT
Key access to multiple lines
LOOP AT TAB.           
 CHECK TAB-K = KVAL.  
 " ...                
ENDLOOP.               

LOOP AT TAB WHERE K = KVAL.      
  " ...                          
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&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;PRE&gt;&lt;CODE&gt;REFRESH TAB_DEST.               
LOOP AT TAB_SRC INTO TAB_DEST.  
  APPEND TAB_DEST.              
ENDLOOP.                        

TAB_DEST[] = TAB_SRC[].
Modifying a set of lines
LOOP AT TAB.              
  IF TAB-FLAG IS INITIAL. 
    TAB-FLAG = 'X'.       
  ENDIF.                  
  MODIFY TAB.             
ENDLOOP.                  

TAB-FLAG = 'X'.                   
MODIFY TAB TRANSPORTING FLAG      
           WHERE FLAG IS INITIAL. 
Deleting a sequence of lines
DO 101 TIMES.                
  DELETE TAB_DEST INDEX 450. 
ENDDO.                       

DELETE TAB_DEST FROM 450 TO 550.


Linear search vs. binary
READ TABLE TAB WITH KEY K = 'X'.

READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.
Comparison of internal tables
DESCRIBE TABLE: TAB1 LINES L1,       
                TAB2 LINES L2.       
                                     
IF L1 &amp;lt;&amp;gt; L2.                         
  TAB_DIFFERENT = 'X'.               
ELSE.                                
  TAB_DIFFERENT = SPACE.             
  LOOP AT TAB1.                      
    READ TABLE TAB2 INDEX SY-TABIX.  
    IF TAB1 &amp;lt;&amp;gt; TAB2.                 
      TAB_DIFFERENT = 'X'. EXIT.     
    ENDIF.                           
  ENDLOOP.                           
ENDIF.                               
                                     
IF TAB_DIFFERENT = SPACE.            
  " ...                              
ENDIF.                               

IF TAB1[] = TAB2[].   
 " ...               
ENDIF.                
Modify selected components
LOOP AT TAB.            
 TAB-DATE = SY-DATUM.  
 MODIFY TAB.           
ENDLOOP.                

WA-DATE = SY-DATUM.                     
LOOP AT TAB.                            
 MODIFY TAB FROM WA TRANSPORTING DATE. 
ENDLOOP.                                
Appending two internal tables
LOOP AT TAB_SRC.               
  APPEND TAB_SRC TO TAB_DEST.  
ENDLOOP

APPEND LINES OF TAB_SRC TO TAB_DEST.
Deleting a set of lines
LOOP AT TAB_DEST WHERE K = KVAL.  
  DELETE TAB_DEST.                
ENDLOOP

DELETE TAB_DEST WHERE K = KVAL.&lt;/CODE&gt;&lt;/PRE&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;Regards&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;lt;b&amp;gt;pls mark points to all helpful answers&amp;lt;/b&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Anversha s&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Nov 2006 14:03:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-performance/m-p/1711178#M311053</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-11-07T14:03:14Z</dc:date>
    </item>
  </channel>
</rss>

