<?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: append statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117421#M443360</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please follow the simple rule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dont use Into cooresponding when you are reffering only part of the fields.&lt;/P&gt;&lt;P&gt;remove select with in loop-endloop.use &amp;lt;b&amp;gt;for all entries instead&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Apr 2007 07:42:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-13T07:42:31Z</dc:date>
    <item>
      <title>append statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117418#M443357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i wanna select process orders from aufm &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT aufnr budat werks bwart menge mblnr INTO CORRESPONDING FIELDS OF TABLE it_dtl FROM aufm&lt;/P&gt;&lt;P&gt;         WHERE budat IN s_date&lt;/P&gt;&lt;P&gt;         AND aufnr IN s_po&lt;/P&gt;&lt;P&gt;         AND werks IN s_plant&lt;/P&gt;&lt;P&gt;         AND bwart = '101'&lt;/P&gt;&lt;P&gt;         AND lgort IN ('0002','0005').&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT it_dtl.&lt;/P&gt;&lt;P&gt;    SELECT aufnr budat werks bwart menge mblnr INTO (it_dtl-aufnr, it_dtl-budat, it_dtl-werks,&lt;/P&gt;&lt;P&gt;    it_dtl-bwart, it_dtl-menge, it_dtl-mblnr) FROM aufm&lt;/P&gt;&lt;P&gt;            WHERE aufnr = it_dtl-aufnr&lt;/P&gt;&lt;P&gt;            AND werks IN s_plant&lt;/P&gt;&lt;P&gt;            AND bwart IN ('102','531','532')&lt;/P&gt;&lt;P&gt;            AND lgort IN ('0002','0005').&lt;/P&gt;&lt;P&gt;      append it_dtl.&lt;/P&gt;&lt;P&gt;    ENDSELECT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but becoz of append statement, the performance is becoming very slow.&lt;/P&gt;&lt;P&gt;tel me the alternative quary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2007 06:57:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117418#M443357</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-13T06:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: append statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117419#M443358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Better to break this statement , get data into another internal table , finally have a look up.&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;Prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2007 07:05:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117419#M443358</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-13T07:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: append statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117420#M443359</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&amp;gt; avoid into corresponding fields of &amp;lt;itab&amp;gt;&lt;/P&gt;&lt;P&gt;2&amp;gt; dont use select endselect&lt;/P&gt;&lt;P&gt;3&amp;gt; wat u can do is fetch all required fields into an Internal table.rather than selecting between loop....endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Navneeth.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2007 07:18:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117420#M443359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-13T07:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: append statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117421#M443360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please follow the simple rule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dont use Into cooresponding when you are reffering only part of the fields.&lt;/P&gt;&lt;P&gt;remove select with in loop-endloop.use &amp;lt;b&amp;gt;for all entries instead&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2007 07:42:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117421#M443360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-13T07:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: append statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117422#M443361</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;chk this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT aufnr budat werks bwart menge mblnr 
INTO TABLE it_dtl 
FROM aufm
WHERE aufnr IN s_po 
AND budat IN s_date
AND werks IN s_plant
AND bwart IN ('101')
AND lgort IN ('0002','0005').

IF SY-SUBRC = 0.
SORT it_dtl BY AUFNR.  ' check here
DELETE ADJACENT DUPLICATES FROM it_dtl COMPARING AUFNR. 'check here

SELECT aufnr budat werks bwart menge mblnr INTO TABLE it_dtl_temp  'temporary internal table
FROM aufm
FOR ALL ENTRIES IN it_dtl  'check here
WHERE aufnr = it_dtl-aufnr
AND werks IN s_plant
AND bwart IN ('102','531','532')
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u can then process the records.&lt;/P&gt;&lt;P&gt;the select inside the LOOP-ENDLOOP will go to dump.&lt;/P&gt;&lt;P&gt;try to avoid SELECTS on the same table. you can process the records using LOOPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**reward if helpful&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;madhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2007 08:12:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117422#M443361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-13T08:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: append statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117423#M443362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deepa,&lt;/P&gt;&lt;P&gt;When ur implimenting the code we have to follow the some standards because client dont want  to waste his time for that we have go for the performance and extended Syntax check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;follow the standards.&lt;/P&gt;&lt;P&gt;&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;Rewards some points if it is helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;P.Nag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2007 08:27:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117423#M443362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-13T08:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: append statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117424#M443363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deepa,&lt;/P&gt;&lt;P&gt;               If you write a select statement inside a loop, it will hit the database many times. this will affect the performance. Hence you retrieve those records into an internal table and then use that internal table in a loop statement. In real scenario, database has multiple records in a single table. so, never use select statement inside a loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AWARD POINTSIF USEFULL &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sekhar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 10:48:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117424#M443363</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T10:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: append statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117425#M443364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because of the APPEND your code is not becoming very slow it is becoming infinite!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you are looping through the table you are adding new rows with the same key (AUFNR). So eventually you are reading 102, 531, 532 rows and selecting another set of row with the same key, which in turn will add a new set with the same key, etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using two internal tables, and join them at the end.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select into itab1 where 101.
Select into itab2 For all entries in itab1 where 102,531,532.
Append lines of itab2 to itab1.
free itab2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 16:53:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2117425#M443364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T16:53:21Z</dc:date>
    </item>
  </channel>
</rss>

