<?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: Program running too long in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449670#M1649366</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basically, you have:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_phy_inv_his INTO wa_phy_inv_his.
  READ TABLE it_lqua WITH KEY
    lenum = wa_phy_inv_his-sto_unit BINARY SEARCH
    INTO wa_lqua
    TRANSPORTING lgnum matnr lgtyp lgpla gesme lenum lgort.
  IF sy-subrc = 0.
*Delete compared line from Internal table
    DELETE it_lqua WHERE lenum = wa_lqua-lenum.      " &amp;lt;=====
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The DELETE WHERE inside the LOOP is your problem. You should either just delete this record or keep a list of LENUM that need to be deleted from the internal table and do that in one shot after the LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You posted essentially the same question in the Performance and Tuning Forum yesterday. I moved it to the test and playground forum because you hadn't done a runtime analysis to help you find the problem. If you had done that, you would have had your answer yesterday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Dec 2011 21:49:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-12-09T21:49:55Z</dc:date>
    <item>
      <title>Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449659#M1649355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Requirement&lt;/STRONG&gt; : Get all entries from Custom tabale and from LQUA and compare both tables and write rest of the entries from each table to excel files.There are 200,000 records in each table ZPHY_INV_HIS and LQUA. Please see below code, I couldn;t do more interms of performence and Program is taking almost &lt;STRONG&gt;2 hours&lt;/STRONG&gt; to give output. Please help me and let me know that how can i increase performence of this program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ZPHY_INV_HIS INTO TABLE IT_PHY_INV_HIS.&lt;/P&gt;&lt;P&gt;SORT IT_PHY_INV_HIS BY STO_UNIT.&lt;/P&gt;&lt;P&gt;*Get all entries from LQUA table&lt;/P&gt;&lt;P&gt;SELECT LGNUM MATNR LGTYP LGPLA MEINS GESME LENUM LGORT&lt;/P&gt;&lt;P&gt;FROM LQUA INTO CORRESPONDING FIELDS OF TABLE IT_LQUA&lt;/P&gt;&lt;P&gt;WHERE LGNUM = I_LGNUM.&lt;/P&gt;&lt;P&gt;IF NOT IT_LQUA IS INITIAL.&lt;/P&gt;&lt;P&gt;SORT IT_LQUA BY LENUM ASCENDING.&lt;/P&gt;&lt;P&gt;LOOP AT IT_PHY_INV_HIS INTO WA_PHY_INV_HIS.&lt;/P&gt;&lt;P&gt;IF NOT WA_PHY_INV_HIS-STO_UNIT IS INITIAL.&lt;/P&gt;&lt;P&gt;READ TABLE IT_LQUA WITH KEY&lt;/P&gt;&lt;P&gt;LENUM = WA_PHY_INV_HIS-STO_UNIT BINARY SEARCH&lt;/P&gt;&lt;P&gt;INTO WA_LQUA&lt;/P&gt;&lt;P&gt;TRANSPORTING LGNUM MATNR LGTYP LGPLA GESME LENUM LGORT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure if this is something to do with READ statement because when i run in debugging mode in LOOP statment itself program is taking so much time to come out and for Select statements are fine as those tables have secondary indexs in it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2011 23:08:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449659#M1649355</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-08T23:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449660#M1649356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you mean by rest of the entries ..??? &lt;/P&gt;&lt;P&gt;Do you want all the 200,000 records to be in output or need to filter some of those, if want to filter. Please clearly explain that.&lt;/P&gt;&lt;P&gt;You can use &lt;STRONG&gt;Inner join or For all entries&lt;/STRONG&gt; to filter data by comparing two tables, (if database table use inner join, internal tables use for all entries)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 00:51:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449660#M1649356</guid>
      <dc:creator>surajarafath</dc:creator>
      <dc:date>2011-12-09T00:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449661#M1649357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for reply playsuji, Below are the 2 custom tables involved &lt;/P&gt;&lt;P&gt;1.Custom table (ZPHY_INV_HIS) - 200,000 entries&lt;/P&gt;&lt;P&gt;2.Custom table ZLQUA*(Copy of LQUA table including data) - 200,000 entries &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Requirement:&lt;/STRONG&gt; Compare above tables each other and need to write rest of entries into 2 excel file. &lt;/P&gt;&lt;P&gt;Means lets say take one Handling Unit from Custom table and look into ZLQUA table if its not there write to Excel file, vice versa with other table too. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the process &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Get all the entries from &lt;STRONG&gt;Custom table (ZPHY_INV_HIS)&lt;/STRONG&gt; into Internal table IT_PHY_INV_HIS&lt;/P&gt;&lt;P&gt;2.Get all the entries from &lt;STRONG&gt;ZLQUA&lt;/STRONG&gt;(Copy of LQUA table including data) into internal table IT_LQUA&lt;/P&gt;&lt;P&gt;3. Loop at Custom table (ZPHY_INV_HIS) and compare ZPHY_INV_HIS-STO_UNIT with ZLQUA-LENUM &lt;/P&gt;&lt;P&gt;4. If you find entry delete that entry from LQUA table (IT_LQUA). &lt;/P&gt;&lt;P&gt;5. If you don't find entry move to Internal table (IT_BAD_RECORDS)&lt;/P&gt;&lt;P&gt;6. for both above internal tables get all the prices from MBEW table (Extra details)&lt;/P&gt;&lt;P&gt;7. Write Both Files into Excel. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sure I am doing wrong with READ statement. Please help me in achieving performence.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 01:26:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449661#M1649357</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T01:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449662#M1649358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Try this , and let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM ZPHY_INV_HIS INTO TABLE IT_PHY_INV_HIS.
SORT IT_PHY_INV_HIS BY STO_UNIT.
*Get all entries from LQUA table
SELECT LGNUM MATNR LGTYP LGPLA MEINS GESME LENUM LGORT
FROM LQUA INTO CORRESPONDING FIELDS OF TABLE IT_LQUA
WHERE LGNUM = I_LGNUM.

delete IT_PHY_INV_HIS WHERE STO_UNIT is INITIAL.

  SORT IT_LQUA BY LENUM ASCENDING.

  LOOP AT IT_PHY_INV_HIS INTO WA_PHY_INV_HIS.
 
      read TABLE it_lqua INTO wa_lqwa with KEY LENUM = WA_PHY_INV_HIS-STO_UNIT BINARY SEARCH.
 
    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 06:03:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449662#M1649358</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T06:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449663#M1649359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kaushik,&lt;/P&gt;&lt;P&gt;I see below the difference between my code and your code.&lt;/P&gt;&lt;P&gt;delete IT_PHY_INV_HIS WHERE STO_UNIT is INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above statement is not going to make any change in number of entries as i know that custom table data don't have blanks or Duplicates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 06:29:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449663#M1649359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T06:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449664#M1649360</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;Can you please tell us how much time (roughly) is taken for each select statement and for looping.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 09:40:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449664#M1649360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T09:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449665#M1649361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use field symbols for better performance and use Binary search in read statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 10:05:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449665#M1649361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T10:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449666#M1649362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. First is select only those fields which are needed along with key fields.&lt;/P&gt;&lt;P&gt;2. Check if select is taking a long time if yes in case no key fields are there then we create secondary index or use concept of package size.&lt;/P&gt;&lt;P&gt;3. Read with binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nabheet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 10:45:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449666#M1649362</guid>
      <dc:creator>nabheetscn</dc:creator>
      <dc:date>2011-12-09T10:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449667#M1649363</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;Select statements are not taking too much time or only taking less than 2 minutes, Both the tables have Secondary indexes. So SELECT Statements are not the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the problem is where LOOPING happens and I am using BINARY SEARCH for READ Command in LOOP Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select statements taking less than 2 minutes.&lt;/P&gt;&lt;P&gt;LOOP taking almost hour.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 19:54:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449667#M1649363</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T19:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449668#M1649364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is nothing wrong with the code you have posted. I suspect the problem is elsewhere. Have you posted all the code being executed in the LOOP. Is this code being called from within a nested SELECT or LOOP?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 20:59:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449668#M1649364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T20:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449669#M1649365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the code in LOOP. NO below code is not getting called in any of other LOOPS or Nested SELECTES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_PHY_INV_HIS INTO WA_PHY_INV_HIS.&lt;/P&gt;&lt;P&gt;    IF NOT WA_PHY_INV_HIS-STO_UNIT IS INITIAL.&lt;/P&gt;&lt;P&gt;      READ TABLE IT_LQUA WITH KEY&lt;/P&gt;&lt;P&gt;                      LENUM = WA_PHY_INV_HIS-STO_UNIT BINARY SEARCH&lt;/P&gt;&lt;P&gt;                      INTO WA_LQUA&lt;/P&gt;&lt;P&gt;                      TRANSPORTING LGNUM MATNR LGTYP LGPLA GESME LENUM LGORT.&lt;/P&gt;&lt;P&gt;      IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-SER_NO          = WA_PHY_INV_HIS-SER_NO.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-LGNUM           = WA_LQUA-LGNUM.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-STO_UNIT        = WA_PHY_INV_HIS-STO_UNIT.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-CUST_MATNR      = WA_PHY_INV_HIS-MATNR.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-LQUA_MATNR      = WA_LQUA-MATNR.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-UNIT_OF_MEASURE = WA_PHY_INV_HIS-UNIT_OF_MEASURE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-CUST_STO_BIN    = WA_PHY_INV_HIS-STO_BIN.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-CUST_STO_TYPE   = WA_PHY_INV_HIS-STO_TYPE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-CUST_STO_LOC    = WA_PHY_INV_HIS-STO_LOC.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-CUST_QUANTITY   = WA_PHY_INV_HIS-QUANTITY.&lt;/P&gt;&lt;P&gt;        CONCATENATE '''' WA_LQUA-LGPLA INTO WA_LQUA-LGPLA.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-LQUA_STO_BIN    = WA_LQUA-LGPLA.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-LQUA_STO_TYPE   = WA_LQUA-LGTYP.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-LQUA_STO_LOC    = WA_LQUA-LGORT.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-LQUA_QUANTITY   = WA_LQUA-GESME.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-QUANTITY_DIFF   = WA_LQUA-GESME - WA_PHY_INV_HIS-QUANTITY.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-LICE_PLATE      = WA_PHY_INV_HIS-LICE_PLATE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-SCANNER_ID      = WA_PHY_INV_HIS-SCANNER_ID.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-UPLOAD_DATE     = WA_PHY_INV_HIS-UPLOAD_DATE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_GOOD-USER_NAME       = WA_PHY_INV_HIS-USER_NAME.&lt;/P&gt;&lt;P&gt;        APPEND WA_RECORD_GOOD TO IT_RECORD_GOOD.&lt;/P&gt;&lt;P&gt;        CLEAR WA_RECORD_GOOD.&lt;/P&gt;&lt;P&gt;*Delete compared line from Internal table&lt;/P&gt;&lt;P&gt;        DELETE IT_LQUA WHERE LENUM = WA_LQUA-LENUM.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-SER_NO          =  WA_PHY_INV_HIS-SER_NO.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-STO_UNIT        =  WA_PHY_INV_HIS-STO_UNIT.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-MATNR           =  WA_PHY_INV_HIS-MATNR.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-STO_BIN         =  WA_PHY_INV_HIS-STO_BIN.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-QUANTITY        =  WA_PHY_INV_HIS-QUANTITY.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-STO_TYPE        =  WA_PHY_INV_HIS-STO_TYPE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-LICE_PLATE      =  WA_PHY_INV_HIS-LICE_PLATE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-UNIT_OF_MEASURE =  WA_PHY_INV_HIS-UNIT_OF_MEASURE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-UPLOAD_DATE     =  WA_PHY_INV_HIS-UPLOAD_DATE.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-USER_NAME       =  WA_PHY_INV_HIS-USER_NAME.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-SCANNER_ID      =  WA_PHY_INV_HIS-SCANNER_ID.&lt;/P&gt;&lt;P&gt;        WA_RECORD_BAD-STO_LOC         =  WA_PHY_INV_HIS-STO_LOC.&lt;/P&gt;&lt;P&gt;        APPEND WA_RECORD_BAD TO IT_RECORD_BAD.&lt;/P&gt;&lt;P&gt;        CLEAR WA_RECORD_BAD.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 21:38:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449669#M1649365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T21:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449670#M1649366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basically, you have:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_phy_inv_his INTO wa_phy_inv_his.
  READ TABLE it_lqua WITH KEY
    lenum = wa_phy_inv_his-sto_unit BINARY SEARCH
    INTO wa_lqua
    TRANSPORTING lgnum matnr lgtyp lgpla gesme lenum lgort.
  IF sy-subrc = 0.
*Delete compared line from Internal table
    DELETE it_lqua WHERE lenum = wa_lqua-lenum.      " &amp;lt;=====
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The DELETE WHERE inside the LOOP is your problem. You should either just delete this record or keep a list of LENUM that need to be deleted from the internal table and do that in one shot after the LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You posted essentially the same question in the Performance and Tuning Forum yesterday. I moved it to the test and playground forum because you hadn't done a runtime analysis to help you find the problem. If you had done that, you would have had your answer yesterday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 21:49:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449670#M1649366</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T21:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Program running too long</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449671#M1649367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob thanks for the mail, I did runtime anaysis and i even put Messages so that i can check those when i run program in background then only i figured Loop has the problem. well I have already tried taking out DELETE statement and I didn't see any performence improvement. I even tried TRANSPORTING NO FIELDS Option and no change in performence&lt;/P&gt;&lt;P&gt;Do you think this COncatenating is problem. I have to do this because in excel i would like to see value starting with ' so that formating is not problem&lt;/P&gt;&lt;P&gt;CONCATENATE '''' WA_LQUA-LGPLA INTO WA_LQUA-LGPLA.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 22:52:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-running-too-long/m-p/8449671#M1649367</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-09T22:52:20Z</dc:date>
    </item>
  </channel>
</rss>

