<?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: Performance Tuning in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926748#M384449</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Nirav, &lt;/P&gt;&lt;P&gt;Check this link : &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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Feb 2007 09:45:40 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-22T09:45:40Z</dc:date>
    <item>
      <title>Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926746#M384447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a Report which displays data from 2 tables and uses 2 Select Statements to get the data. I have modified a Report and now there are 5 Select Statements. This has slowed down the report considerably. How to display the data in quick time. ANY TIPS?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nirav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2007 09:42:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926746#M384447</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-22T09:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926747#M384448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do some of these to improve the performance &lt;/P&gt;&lt;P&gt;1. avoid using nested selects and nested loops.&lt;/P&gt;&lt;P&gt;2. avoid using selects inside a loop.&lt;/P&gt;&lt;P&gt;3. avoid using select ... end select statements&lt;/P&gt;&lt;P&gt;4. avoid using joins ... use for all entries statement ..&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2007 09:45:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926747#M384448</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-22T09:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926748#M384449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Nirav, &lt;/P&gt;&lt;P&gt;Check this link : &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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2007 09:45:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926748#M384449</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-22T09:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926749#M384450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could post part of the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But: -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Use Inner Joins&lt;/P&gt;&lt;P&gt;2. INTO TABLE&lt;/P&gt;&lt;P&gt;3. No nested loop&lt;/P&gt;&lt;P&gt;4. FOR ALL ENTRIES&lt;/P&gt;&lt;P&gt;5. Use as much of the key as possible&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2007 09:46:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926749#M384450</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-22T09:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926750#M384451</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;First select data from the Main Table into an Internal Table.&lt;/P&gt;&lt;P&gt;Then for all entries of that Int table and fetch the individual table data into different internal Tables.&lt;/P&gt;&lt;P&gt;Then Loop the first int table and read the data of others into a final table and display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or if all the tables are properly linked with proper relation fields then JOINING will fetch the data faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2007 09:46:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926750#M384451</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-22T09:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926751#M384452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;5. try to use primary or secondary keys in where condition. When using key fields, start with first key field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. Select only the fields you need for display/processing - avoid select *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2007 09:48:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926751#M384452</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2007-02-22T09:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926752#M384453</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;1) Dont use nested seelct statement&lt;/P&gt;&lt;P&gt;2) If possible use for all entries in addition&lt;/P&gt;&lt;P&gt;3) In the where addition make sure you give all the primary key&lt;/P&gt;&lt;P&gt;4) Use Index for the selection criteria.&lt;/P&gt;&lt;P&gt;5) You can also use inner joins&lt;/P&gt;&lt;P&gt;6) You can try to put the data from the first select statement into an Itab and then in order to select the data from the second table use for all entries in.&lt;/P&gt;&lt;P&gt;7) Use the runtime analysis SE30 and SQL Trace (ST05) to identify the performance and also to identify where the load is heavy, so that you can change the code accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if found helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2007 09:53:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926752#M384453</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-22T09:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926753#M384454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please have a look at below link:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2007 09:55:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926753#M384454</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-22T09:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926754#M384455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;Part of code is:&lt;/P&gt;&lt;P&gt;**********************************&lt;/P&gt;&lt;P&gt;SELECT BUDAT MBLNR FROM MKPF INTO CORRESPONDING FIELDS OF &lt;/P&gt;&lt;P&gt;                         ITAB WHERE BUDAT IN PDATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT MATNR BWART DMBTR SAKTO FROM MSEG INTO &lt;/P&gt;&lt;P&gt;                  CORRESPONDING FIELDS OF ITAB WHERE &lt;/P&gt;&lt;P&gt;                  MBLNR = ITAB-MBLNR&lt;/P&gt;&lt;P&gt;                  AND SAKTO IN &lt;/P&gt;&lt;P&gt;                       ('0000404000' ,  '0000404002' , '0000404006' , '0000404011' ,&lt;/P&gt;&lt;P&gt;                        '0000404100' , '0000404200', '0000404201', '0000404300', &lt;/P&gt;&lt;P&gt;                         '0000404400', '0000404800', '0000404900' , '0000405000', &lt;/P&gt;&lt;P&gt;                         '0000475090', '0000475085').&lt;/P&gt;&lt;P&gt;      SELECT SINGLE TXT20 FROM SKAT INTO CORRESPONDING FIELDS OF &lt;/P&gt;&lt;P&gt;                    ITAB WHERE SAKNR = ITAB-SAKTO AND SPRAS = 'EN'.&lt;/P&gt;&lt;P&gt;      SELECT SINGLE MAKTX FROM MAKT INTO CORRESPONDING FIELDS OF &lt;/P&gt;&lt;P&gt;                   ITAB WHERE MATNR = ITAB-MATNR AND SPRAS = 'EN'.&lt;/P&gt;&lt;P&gt;      SELECT SINGLE MATKL FROM MARA INTO CORRESPONDING FIELDS &lt;/P&gt;&lt;P&gt;                    OF ITAB WHERE MATNR = ITAB-MATNR.&lt;/P&gt;&lt;P&gt;    APPEND ITAB.&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;awaiting your tips.&lt;/P&gt;&lt;P&gt;Nirav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 05:30:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926754#M384455</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T05:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926755#M384456</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;/P&gt;&lt;P&gt;avaoid using select * instead use select clause&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie select only those fields which you need.&lt;/P&gt;&lt;P&gt;eg : select mara,matnr....from mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when using select single in where clause give exactly primary key ,&lt;/P&gt;&lt;P&gt;and when using select single check for sy-subrc = 0&lt;/P&gt;&lt;P&gt;ie eg select single from mara where matnr = '001'.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;message e001(z).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and when using for all entries try to test that internal table is empty or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avoid join and use for all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avoid using select/select single in loops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope these might help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers!&lt;/P&gt;&lt;P&gt;sri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 05:41:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926755#M384456</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T05:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926756#M384457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to avoid select endselect as this statment works as a loop and everytime it accesses the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use different internal tables to fetch the data from the datbase tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT BUDAT MBLNR FROM MKPF INTO CORRESPONDING FIELDS OF &lt;/P&gt;&lt;P&gt;ITAB WHERE BUDAT IN PDATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not itab[] is initial.&lt;/P&gt;&lt;P&gt;SELECT MATNR BWART DMBTR SAKTO FROM MSEG INTO &lt;/P&gt;&lt;P&gt;CORRESPONDING FIELDS OF &amp;lt;b&amp;gt;ITAB1 for all entries in itab&amp;lt;/b&amp;gt; WHERE &lt;/P&gt;&lt;P&gt;MBLNR = ITAB-MBLNR&lt;/P&gt;&lt;P&gt;AND SAKTO IN &lt;/P&gt;&lt;P&gt;('0000404000' , '0000404002' , '0000404006' , '0000404011' ,&lt;/P&gt;&lt;P&gt;'0000404100' , '0000404200', '0000404201', '0000404300', &lt;/P&gt;&lt;P&gt;'0000404400', '0000404800', '0000404900' , '0000405000', &lt;/P&gt;&lt;P&gt;'0000475090', '0000475085').&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT TXT20 FROM SKAT INTO CORRESPONDING FIELDS OF &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;ITAB2 for all entries in itab&amp;lt;/b&amp;gt; WHERE SAKNR = ITAB-SAKTO AND SPRAS = 'EN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT MAKTX FROM MAKT INTO CORRESPONDING FIELDS OF &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;ITAB3 for all entries in itab&amp;lt;/b&amp;gt; WHERE MATNR = ITAB-MATNR AND SPRAS = 'EN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT MATKL FROM MARA INTO CORRESPONDING FIELDS &lt;/P&gt;&lt;P&gt;OF &amp;lt;b&amp;gt;ITAB4 for all entries in itab&amp;lt;/b&amp;gt; WHERE MATNR = ITAB-MATNR.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;Then you can combine data from these internal table into a single final internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If possible try to avoid into corresponding fields by decalring appropriate structure of internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of for all entries you can use inner joins also if you can specify most of the key fields in where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 05:42:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926756#M384457</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T05:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926757#M384458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When using the statement:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM table&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;In order to extract all records from a given table, &lt;/P&gt;&lt;P&gt;it is more efficient to narrow the selection using specific table fields as search keys.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM VBAK... 
WRITE: / VBAK-VBELN...
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Instead use:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT VBELN, AUART, BNAME, KUNNR INTO
 (VBAK-VBELN, VBAK-AUART, &amp;#133;.)  
FROM VBAK...
WRITE: / VBAK-VBELN, VBAK-AUART, ...
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;When using the statement:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;SELECT FROM table ... EXIT&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;In order to EXIT from a select loop when a required condition is met, it is more efficient to use the &lt;/P&gt;&lt;P&gt;UP TO statement as the required exit point.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT VBELN BNAME &amp;#133; INTO (VBAK-VBELN&amp;#133;) 
FROM VBAK.
 
IF SY-DBCNT &amp;gt; 1000.    
EXIT.       
ENDIF.
 
WRITE: / VBAK-VBELN, VBAK-BNAME&amp;#133;
 
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;This select loop is exited when 1000 records &lt;/P&gt;&lt;P&gt;have been written.  It is better to use a&lt;/P&gt;&lt;P&gt; more focused select statement such as:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT VBELN, AUART, BNAME, KUNNR INTO 
(VBAK-VBELN, VBAK-AUART, &amp;#133;.)  
FROM VBAK&amp;#133; UP TO 1000 ROWS.
 
WRITE: / VBAK-VBELN, VBAK-AUART&amp;#133;
 
ENDSELECT.
 
Where table fields are specified and the 
UP TO statement is used to exit the loop.
When using a nested select statement like:
 
SELECT VBELN AUART VTWEG VKORG SPART 
INTO IVBAK FROM VBAK
WHERE VBELN BETWEEN... AND...
                   
SELECT POSNR MATNR ZMENG MEINS INTO IVBAP 
FROM VBAP
WHERE VBELN = IVBAK-VBELN.
 
     	WRITE: /IVBAK-VBELN, ...
 
ENDSELECT.
 
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;It is better to use DATABASE VIEWS like:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM ZV_VBAK
       WHERE VBELN BETWEEN... AND...
       WRITE: ZV_VBAK-VBELN...
ENDSELECT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;When performing an ABAP calculation &lt;/P&gt;&lt;P&gt;within a select statement such as:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT MATNR KWMENG MEINS INTO VBQTY 
FROM VBAP WHERE...
 
COLLECT VBQTY.
 
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Where the COLLECT statement is used to calculate &lt;/P&gt;&lt;P&gt;the sum of records populated in internal table VBQTY, it is better to use:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT MATNR SUM(KWMENG) MEINS INTO TABLE VBQTY 
FROM VBAP 
WHERE...
GROUP BY....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When populating an internal table with records from another internal table:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB1.
MOVE ITAB1 TO ITAB2.
	APPEND ITAB2.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;It is better to use:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;I&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;tab2[ ] = itab1[ ].
 
LOOP AT ITAB1.
MOVE ITAB1 TO ITAB2.
	APPEND ITAB2.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;It is better to use this statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
APPEND LINES OF ITAB1 TO ITAB2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;When deleting records from an internal table, &lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT IVBAK WHERE BNAME = &amp;#145;SMITH&amp;#146;.
DELETE BNAME.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;It is better to use this statement:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DELETE IVBAK WHERE BNAME = &amp;#145;Smith&amp;#146;.&lt;/P&gt;&lt;P&gt;If you are looping at a table where records have&lt;/P&gt;&lt;P&gt; a certain property it is more efficient to sort&lt;/P&gt;&lt;P&gt; by the property, read the index of the first &lt;/P&gt;&lt;P&gt;record with the property and then loop at the &lt;/P&gt;&lt;P&gt;table from the index, exiting when the property&lt;/P&gt;&lt;P&gt; no longer holds true.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;When deleting records from an internal table, &lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
LOOP AT IVBAK WHERE BNAME = &amp;#145;Smith&amp;#146;.
&amp;#133;
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;It is significantly more efficient to use these statements:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT IVBAK BY BNAME ASCENDING.
READ TABLE IVBAK INTO WVBAK
WITH KEY BNAME = &amp;#145;Smith&amp;#146;.
LOOP AT IVBAK FROM INDEX SY-TABIX.
	IF BNAME &amp;lt;&amp;gt; &amp;#145;Smith&amp;#146;.
		EXIT.
	ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if this helsp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 05:54:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/1926757#M384458</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T05:54:36Z</dc:date>
    </item>
  </channel>
</rss>

