<?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: Loop Inside loop, time out error. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868995#M366083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Naresh, just a small correction &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;sort itablnpln by aufnr j_3asize.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITABLNPLN COMPARING ALL FIELDS.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itablnp by aufnr j_3asize.   &amp;lt;&amp;lt;&amp;lt; make sure your itablnp is sorted, in this case your inner loop below will be faster....I prefer to use "read table binary search... loop from sy-tabix... if any of key fields changes -&amp;gt; exit the loop".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itablnpln INTO walnpln.&lt;/P&gt;&lt;P&gt;contot = 0.&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0. &amp;lt;&amp;lt;&amp;lt;&amp;lt; not sure why would you need this check here...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itablnp ASSIGNING &amp;lt;fs_itablnp&amp;gt; where aufnr = walnpln-aufnr and j_3asize = walnpln-j_3akordx.&lt;/P&gt;&lt;P&gt;contot = contot + &amp;lt;fs_itablnp&amp;gt;-J_3ALMNGA.&lt;/P&gt;&lt;P&gt;move &amp;lt;fs_itablnp&amp;gt;-J_3ASIZE to walnpln-J_3ASIZE.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Feb 2007 18:23:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-01T18:23:46Z</dc:date>
    <item>
      <title>Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868980#M366068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pls look into the below code, In this im looping inside a loop. &lt;/P&gt;&lt;P&gt;Im looping thru the internal table( say 2000 records ) which has data from a select query, inside this loop  i need to calculate the total of output qty which is available in the another VIEW/TABLE which might return 10 records in each  iteration of the inner loop.&lt;/P&gt;&lt;P&gt;This process takes huge time to process also gives out runtime out error.&lt;/P&gt;&lt;P&gt;pls help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itablnpln INTO walnpln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;contot = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This particular query loop takes large time to process &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp&lt;/P&gt;&lt;P&gt;FROM zvprdconf where aufnr = walnpln-aufnr and&lt;/P&gt;&lt;P&gt;j_3asize = walnpln-j_3akordx and stzhl eq ' ' and stokz ne 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;*Earlier i used this looping.&lt;/P&gt;&lt;P&gt;*loop at itablnp into walnp.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;contot = contot + walnp-J_3ALMNGA.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;move walnp-J_3ASIZE to walnpln-J_3ASIZE.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Currently tried with the following, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itablnp ASSIGNING &amp;lt;fs_itablnp&amp;gt;.&lt;/P&gt;&lt;P&gt;contot = contot + &amp;lt;fs_itablnp&amp;gt;-J_3ALMNGA.&lt;/P&gt;&lt;P&gt;move &amp;lt;fs_itablnp&amp;gt;-J_3ASIZE to walnpln-J_3ASIZE.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;walnpln-output = contot.&lt;/P&gt;&lt;P&gt;move zvprdconf-isdd to walnpln-zdate.&lt;/P&gt;&lt;P&gt;move zvprdconf-isdz to walnpln-ztime.&lt;/P&gt;&lt;P&gt;endif.&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;regs,&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jan 2007 08:04:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868980#M366068</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-19T08:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868981#M366069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use where condition in nested loop. Means the loop you are using inside loop. give where condition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ashven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jan 2007 08:14:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868981#M366069</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-19T08:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868982#M366070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use where condition in nested loop. Means the loop you are using inside loop. give where condition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ashven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jan 2007 08:14:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868982#M366070</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-19T08:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868983#M366071</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;write the below code... iseteasd of selecting inside the loop... first fetch for entries then do the processing..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
IF NOT ITABLNPLN IS INITIAL.
  SELECT DISTINCT *
  INTO CORRESPONDING FIELDS OF TABLE ITABLNP
  FROM ZVPRDCONF
   FOR ALL ENTRIES IN ITABLNPLN
  WHERE AUFNR = ITABLNPLN-AUFNR AND
       J_3ASIZE = ITABLNPLN-J_3AKORDX AND
       STZHL EQ ' ' AND
       STOKZ NE 'X'.
  IF SY-SUBRC = 0.
    SORT ITABLNPLN.
  ENDIF.
ENDIF.

LOOP AT ITABLNPLN INTO WALNPLN.

  CONTOT = 0.

  LOOP AT ITABLNP ASSIGNING &amp;lt;FS_ITABLNP&amp;gt; WHERE AUFNR = WALNPLN-AUFNR
                                            AND J_3ASIZE = WALNPLN-J_3AKORDX.
    CONTOT = CONTOT + &amp;lt;FS_ITABLNP&amp;gt;-J_3ALMNGA.
    MOVE &amp;lt;FS_ITABLNP&amp;gt;-J_3ASIZE TO WALNPLN-J_3ASIZE.
  ENDLOOP.
  WALNPLN-OUTPUT = CONTOT.
  MOVE ZVPRDCONF-ISDD TO WALNPLN-ZDATE.
  MOVE ZVPRDCONF-ISDZ TO WALNPLN-ZTIME.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avoide using correspondig fields of table.....c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Close this thread.. when u r problem is solved&lt;/P&gt;&lt;P&gt;Reward if Helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;P&gt;Naresh Reddy K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Naresh Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jan 2007 08:18:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868983#M366071</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-19T08:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868984#M366072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will help you quite a bit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops&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, 19 Jan 2007 14:15:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868984#M366072</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-19T14:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868985#M366073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Try using 'SUM' as following,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   LOOP AT itablnp ASSIGNING &amp;lt;fs_itablnp&amp;gt;.&lt;/P&gt;&lt;P&gt;    contot = contot + &amp;lt;fs_itablnp&amp;gt;-J_3ALMNGA.&lt;/P&gt;&lt;P&gt;    move &amp;lt;fs_itablnp&amp;gt;-J_3ASIZE to walnpln-J_3ASIZE.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Instead of this please try using the following,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   LOOP AT itablnp.&lt;/P&gt;&lt;P&gt;    SUM(contot)  &lt;/P&gt;&lt;P&gt;   ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Or try using 'SUM ' aggregate function in the SELECT statement itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Hope this will help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Ali S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jan 2007 07:54:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868985#M366073</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-21T07:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868986#M366074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Naresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried your suggestions, but still getting the time out runtime error.&lt;/P&gt;&lt;P&gt;Pls see below, Error coming at indicated line of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not itablnpln is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp&lt;/P&gt;&lt;P&gt;        FROM zvprdconf FOR ALL ENTRIES IN itablnpln&lt;/P&gt;&lt;P&gt;        where aufnr = itablnpln-aufnr and&lt;/P&gt;&lt;P&gt;        j_3asize = itablnpln-j_3akordx and stzhl eq ' ' and stokz ne 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          sort itablnpln.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      148       LOOP AT itablnpln  INTO walnpln.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;         contot = 0.&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;  150         IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;  151           LOOP AT itablnp ASSIGNING &amp;lt;fs_itablnp&amp;gt;&lt;/P&gt;&lt;P&gt;  152             contot = contot + &amp;lt;fs_itablnp&amp;gt;-J_3AL&lt;/P&gt;&lt;P&gt;  153             move &amp;lt;fs_itablnp&amp;gt;-J_3ASIZE to walnpl&lt;/P&gt;&lt;P&gt;  154           ENDLOOP.&lt;/P&gt;&lt;P&gt;  155&lt;/P&gt;&lt;P&gt;  156           walnpln-output = contot.&lt;/P&gt;&lt;P&gt;  157           move zvprdconf-isdd to walnpln-zdate.&lt;/P&gt;&lt;P&gt;  158           move zvprdconf-isdz to walnpln-ztime.&lt;/P&gt;&lt;P&gt;  159         endif.&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;regs,&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 04:50:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868986#M366074</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T04:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868987#M366075</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;Use the parallel processing technique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITABLNP BY AUFNR J_3ASIZE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: LV_TABIX  TYPE SYTABIX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITABLNPLN INTO WALNPLN.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CONTOT = 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;  READ TABLE ITABLNP TRANSPORTING NO FIELDS&lt;/P&gt;&lt;P&gt;                       WITH KEY AUFNR = WALNPLN-AUFNR&lt;/P&gt;&lt;P&gt;                                        J_3ASIZE = WALNPLN-J_3AKORDX&lt;/P&gt;&lt;P&gt;                        BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC = 0.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;  LV_TABIX = SY-TABIX.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;  LOOP AT ITABLNP ASSIGNING &amp;lt;FS_ITABLNP&amp;gt; FROM LV_TABIX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXIT CONDITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       IF &amp;lt;FS_ITABLNP&amp;gt;-AUFNR &amp;lt;&amp;gt; WALNPLN-AUFNR OR&lt;/P&gt;&lt;P&gt;           &amp;lt;FS_ITABLNP&amp;gt;-J_3ASIZE &amp;lt;&amp;gt; WALNPLN-J_3AKORDX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         EXIT.&amp;lt;/b&amp;gt;&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;    CONTOT = CONTOT + &amp;lt;FS_ITABLNP&amp;gt;-J_3ALMNGA.&lt;/P&gt;&lt;P&gt;    MOVE &amp;lt;FS_ITABLNP&amp;gt;-J_3ASIZE TO WALNPLN-J_3ASIZE.&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;&amp;lt;b&amp;gt;  ENDIF.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WALNPLN-OUTPUT = CONTOT.&lt;/P&gt;&lt;P&gt;  MOVE ZVPRDCONF-ISDD TO WALNPLN-ZDATE.&lt;/P&gt;&lt;P&gt;  MOVE ZVPRDCONF-ISDZ TO WALNPLN-ZTIME.&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;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 05:08:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868987#M366075</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T05:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868988#M366076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the code as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITABLNPLN INTO WALNPLN.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CONTOT = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE ITABLNP WITH KEY AUFNR = WALNPLN-AUFNR&lt;/P&gt;&lt;P&gt;                                              J_3ASIZE = WALNPLN-J_3AKORDX.&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  LOOP AT ITABLNP FROM SY-TABIX &lt;/P&gt;&lt;P&gt;     ASSIGNING &amp;lt;FS_ITABLNP&amp;gt; .&lt;/P&gt;&lt;P&gt;   IF &amp;lt;FS_ITABLNP&amp;gt;-AUFNR = WALNPLN-AUFNR AND&lt;/P&gt;&lt;P&gt;       &amp;lt;FS_ITABLNP&amp;gt;- J_3ASIZE = WALNPLN-J_3AKORDX.&lt;/P&gt;&lt;P&gt;    CONTOT = CONTOT + &amp;lt;FS_ITABLNP&amp;gt;-J_3ALMNGA.&lt;/P&gt;&lt;P&gt;    MOVE &amp;lt;FS_ITABLNP&amp;gt;-J_3ASIZE TO WALNPLN-J_3ASIZE.&lt;/P&gt;&lt;P&gt;  ELSE&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDIF&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  WALNPLN-OUTPUT = CONTOT.&lt;/P&gt;&lt;P&gt;  MOVE ZVPRDCONF-ISDD TO WALNPLN-ZDATE.&lt;/P&gt;&lt;P&gt;  MOVE ZVPRDCONF-ISDZ TO WALNPLN-ZTIME.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 05:11:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868988#M366076</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T05:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868989#M366077</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;use &lt;/P&gt;&lt;P&gt;loop at walnpln.&lt;/P&gt;&lt;P&gt;use select sum(....) into walnpln-... from.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then modify that &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify walnpln.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; so no need to secound loop at all..&lt;/P&gt;&lt;P&gt;  i think this will help u....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 11:24:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868989#M366077</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T11:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868990#M366078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi raja wht uis the type of  &amp;lt;b&amp;gt;contot&amp;lt;/b&amp;gt;... u r here calculating the value...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the type.. and check whether the value is overflowing.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:30:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868990#M366078</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868991#M366079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Naresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The field &amp;lt;u&amp;gt;&amp;lt;b&amp;gt;CONTOT&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt; is of type i ( Integer), i found that is not overflowing. The error is also not because of the overflow value. pls find the error report as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;ShrtText&lt;/P&gt;&lt;P&gt;    Time limit exceeded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What happened?&lt;/P&gt;&lt;P&gt;    The program "SAPMZLPR" has exceeded the maximum permitted runtime without&lt;/P&gt;&lt;P&gt;    interruption, and has therefore been terminated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can you do?&lt;/P&gt;&lt;P&gt;    Print out the error message (using the "Print" function)&lt;/P&gt;&lt;P&gt;    and make a note of the actions and input that caused the&lt;/P&gt;&lt;P&gt;    error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    To resolve the problem, contact your SAP system administrator.&lt;/P&gt;&lt;P&gt;    You can use transaction ST22 (ABAP Dump Analysis) to view and administer&lt;/P&gt;&lt;P&gt;     termination messages, especially those beyond their normal deletion&lt;/P&gt;&lt;P&gt;    date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    is especially useful if you want to keep a particular message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error analysis&lt;/P&gt;&lt;P&gt;    After a certain length of time, the program is terminated. In the cas&lt;/P&gt;&lt;P&gt;    of a work area, this means that&lt;/P&gt;&lt;P&gt;    - endless loops (DO, WHILE, ...),&lt;/P&gt;&lt;P&gt;    - database accesses producing an excessively large result set,&lt;/P&gt;&lt;P&gt;    - database accesses without a suitable index (full table scan)&lt;/P&gt;&lt;P&gt;    do not block the processing for too long.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    The system profile "rdisp/max_wprun_time" contains the maximum runtim&lt;/P&gt;&lt;P&gt;     program. The&lt;/P&gt;&lt;P&gt;    current setting is 600 seconds. Once this time limit has been exceede&lt;/P&gt;&lt;P&gt;    the system tries to terminate any SQL statements that are currently&lt;/P&gt;&lt;P&gt;    being executed and tells the ABAP processor to terminate the current&lt;/P&gt;&lt;P&gt;    program. Then it waits for a maximum of 60 seconds. If the program is&lt;/P&gt;&lt;P&gt;    still active, the work process is restarted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    successfully processed, the system gives it another 600 seconds.&lt;/P&gt;&lt;P&gt;    Hence the maximum runtime of a program is at least twice the value of&lt;/P&gt;&lt;P&gt;    the system profile parameter "rdisp/max_wprun_time".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to correct the error&lt;/P&gt;&lt;P&gt;    You should usually execute long-running programs as batch jobs.&lt;/P&gt;&lt;P&gt;    If this is not possible, increase the system profile parameter&lt;/P&gt;&lt;P&gt;     "rdisp/max_wprun_time".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Depending on the cause of the error, you may have to take one of the&lt;/P&gt;&lt;P&gt;following measures:&lt;/P&gt;&lt;P&gt;- Endless loop: Correct program;&lt;/P&gt;&lt;P&gt;- Dataset resulting from database access is too large:&lt;/P&gt;&lt;P&gt;  Instead of "SELECT * ... ENDSELECT", use "SELECT * INTO internal table&lt;/P&gt;&lt;P&gt;  (for example);&lt;/P&gt;&lt;P&gt;- Database has an unsuitable index: Check index generation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may able to find an interim solution to the problem&lt;/P&gt;&lt;P&gt;in the SAP note system. If you have access to the note system yourself,&lt;/P&gt;&lt;P&gt;use the following search criteria:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;"TIME_OUT" C&lt;/P&gt;&lt;P&gt;"SAPMZLPR" or "SAPMZLPR"&lt;/P&gt;&lt;P&gt;"START-OF-SELECTION"&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;If you cannot solve the problem yourself and you wish to send&lt;/P&gt;&lt;P&gt;an error message to SAP, include the following documents:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. A printout of the problem description (short dump)&lt;/P&gt;&lt;P&gt;   To obtain this, select in the current display "System-&amp;gt;List-&amp;gt;&lt;/P&gt;&lt;P&gt;   Save-&amp;gt;Local File (unconverted)".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. A suitable printout of the system log&lt;/P&gt;&lt;P&gt;   To obtain this, call the system log through transaction SM21.&lt;/P&gt;&lt;P&gt;   Limit the time interval to 10 minutes before and 5 minutes&lt;/P&gt;&lt;P&gt;   after the short dump. In the display, then select the function&lt;/P&gt;&lt;P&gt;   "System-&amp;gt;List-&amp;gt;Save-&amp;gt;Local File (unconverted)".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. If the programs are your own programs or modified SAP programs,&lt;/P&gt;&lt;P&gt;   supply the source code.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;===========================================================&lt;/P&gt;&lt;P&gt; if not itablnpln is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp&lt;/P&gt;&lt;P&gt;   FROM zvprdconf FOR ALL ENTRIES IN itablnpln&lt;/P&gt;&lt;P&gt;   where aufnr = itablnpln-aufnr and&lt;/P&gt;&lt;P&gt;   j_3asize = itablnpln-j_3akordx and stzhl eq ' ' and stokz ne 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;     sort itablnpln.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT itablnpln  INTO walnpln.&lt;/P&gt;&lt;P&gt;  &amp;lt;b&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;contot = 0.&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt;   IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;     LOOP AT itablnp ASSIGNING &amp;lt;fs_itablnp&amp;gt; where aufnr = walnpln-aufnr and j_3asize =&lt;/P&gt;&lt;P&gt;       contot = contot + &amp;lt;fs_itablnp&amp;gt;-J_3ALMNGA.&lt;/P&gt;&lt;P&gt;       move &amp;lt;fs_itablnp&amp;gt;-J_3ASIZE to walnpln-J_3ASIZE.&lt;/P&gt;&lt;P&gt;     ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     walnpln-output = contot.&lt;/P&gt;&lt;P&gt;     move zvprdconf-isdd to walnpln-zdate.&lt;/P&gt;&lt;P&gt;     move zvprdconf-isdz to walnpln-ztime.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   walnpln-wip = walnpln-menge - contot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2007 06:38:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868991#M366079</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-24T06:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868992#M366080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI RAJA,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can u plese send the complete code.&lt;/P&gt;&lt;P&gt;1. &lt;/P&gt;&lt;P&gt;use the followindg code..for select.. use select then delete adjacent duplicates.. avoid distincs..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF NOT ITABLNPLN IS INITIAL.
  SELECT  *
  INTO CORRESPONDING FIELDS OF TABLE ITABLNP
  FROM ZVPRDCONF
   FOR ALL ENTRIES IN ITABLNPLN
  WHERE AUFNR = ITABLNPLN-AUFNR AND
        J_3ASIZE = ITABLNPLN-J_3AKORDX AND
        STZHL EQ ' ' AND
        STOKZ NE 'X'.
  IF SY-SUBRC = 0.
    SORT ITABLNPLN.
    DELETE ADJACENT DUPLICATE FROM ITABLNPLN COMPARING ALL FIELDS.
  ENDIF.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2007 08:15:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868992#M366080</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-24T08:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868993#M366081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Naresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even after changing the code as below, i m getting the same error.pls help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;   SORT ITABLNPLN.&lt;/P&gt;&lt;P&gt;   DELETE ADJACENT DUPLICATE FROM ITABLNPLN COMPARING ALL FIELDS.&lt;/P&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls find the complete code as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code]&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  SAPMZLINEPLANRPT&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INCLUDE ZLPR_TOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;*Event AT Selection-Screen on Block Param.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON BLOCK sorter.&lt;/P&gt;&lt;P&gt;  CHECK All = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;*Event Start-Of-Selection.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  Data: zstat type jest-stat.&lt;/P&gt;&lt;P&gt;  data: stklocaf type mska-lgort.&lt;/P&gt;&lt;P&gt;  data: stklocas type mska-lgort.&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS &amp;lt;fs_itablnp&amp;gt; LIKE LINE OF itablnp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR it_ZVPRODDET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT DISTINCT ZVPOD&lt;SUB&gt;bukrs ZVPOD&lt;/SUB&gt;aufnr ZVPOD~objnr&lt;/P&gt;&lt;P&gt;  jest&lt;SUB&gt;stat ZVPOD&lt;/SUB&gt;werks ZVPOD&lt;SUB&gt;arbpl ZVPOD&lt;/SUB&gt;J_3AKORD2&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;plnbez zvpod&lt;/SUB&gt;aufnr zvpod&lt;SUB&gt;kdauf zvpod&lt;/SUB&gt;kdpos&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;j_3akord1 zvpod&lt;/SUB&gt;j_3akord2 zvpod~j_3akordx&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;j_3absnr zvpod&lt;/SUB&gt;matnr zvpod~j_4kscat&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;mvgr4 zvpod&lt;/SUB&gt;j_3acada zvpod&lt;SUB&gt;j_4krcat zvpod&lt;/SUB&gt;menge&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;posnr zvpod&lt;/SUB&gt;kunnr zvpod&lt;SUB&gt;aufpl zvpod&lt;/SUB&gt;aplzl&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;plnnr zvpod&lt;/SUB&gt;arbid zvpod&lt;SUB&gt;steus zvpod&lt;/SUB&gt;bismt&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;werks zvpod&lt;/SUB&gt;j_3akvgr6 zvpod~j_3arqda&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;mvgr5 zvpod&lt;/SUB&gt;audat zvpod~j_3addat&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;vtweg zvpod&lt;/SUB&gt;objnr zvpod~bukrs&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;fsavd zvpod&lt;/SUB&gt;ssavd zvpod~bstkd&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;bstdk zvpod&lt;/SUB&gt;ihrez zvpod~bstkd_e&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;bstdk_e zvpod&lt;/SUB&gt;ihrez_e zvpod~arbpl&lt;/P&gt;&lt;P&gt;  zvpod&lt;SUB&gt;vgw01 zvpod&lt;/SUB&gt;kvgr2 zvpod~vsart&lt;/P&gt;&lt;P&gt;  FROM  ZVPOD&lt;/P&gt;&lt;P&gt;  INNER JOIN jest ON ZVPOD&lt;SUB&gt;objnr = jest&lt;/SUB&gt;objnr&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF table it_ZVPRODDET where&lt;/P&gt;&lt;P&gt;  plnbez in FGM and arbpl in wc and werks in plant&lt;/P&gt;&lt;P&gt;  and SSAVD in eldate&lt;/P&gt;&lt;P&gt;  and J_3AKORD2 in cups and jest~inact ne 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SORT it_ZVPRODDET BY aufnr stat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT it_ZVPRODDET INTO wa_ZVPRODDET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF wa_ZVPRODDET-stat = 'I0045' .  " TECO - compl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ELSEIF wa_ZVPRODDET-stat = 'I0009' .  " CNF - Confirmed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ELSEIF wa_ZVPRODDET-stat = 'I0012' .  " DLV - Delivered&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ELSEIF wa_ZVPRODDET-stat = 'I0046' .  " CLSD - Closed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ELSEIF wa_ZVPRODDET-stat = 'I0076' .  " DLFL - Del Flag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ELSEIF wa_ZVPRODDET-stat = 'E0003' .  " SCLS - Short Close&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CLEAR tj30t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT SINGLE txt04&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      FROM tj30t INTO tj30t-txt04&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      WHERE stsma = 'PRDHOLD' AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            estat = 'E0003' AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            txt04 = 'SCLS' AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            spras = 'EN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.&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;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Condition for Prod Order released - REL&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF wa_ZVPRODDET-stat = 'I0002'.&lt;/P&gt;&lt;P&gt;      mreleased = 'Y'.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      mreleased = 'N'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    zstat = wa_ZVPRODDET-stat.&lt;/P&gt;&lt;P&gt;    IF mreleased = 'N'.&lt;/P&gt;&lt;P&gt;      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr&lt;/P&gt;&lt;P&gt;      and stat = zstat.&lt;/P&gt;&lt;P&gt;    ENDIF.&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;  case mark.&lt;/P&gt;&lt;P&gt;    when All.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      LOOP AT it_ZVPRODDET INTO wa_ZVPRODDET.&lt;/P&gt;&lt;P&gt;        zaufnr = wa_zvproddet-aufnr.&lt;/P&gt;&lt;P&gt;        zarbid = wa_zvproddet-arbid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        move wa_zvproddet to walnpln.&lt;/P&gt;&lt;P&gt;        append walnpln to itablnpln.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear walnpln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      if not itablnpln is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp&lt;/P&gt;&lt;P&gt;        FROM zvprdconf FOR ALL ENTRIES IN itablnpln&lt;/P&gt;&lt;P&gt;        where aufnr = itablnpln-aufnr and&lt;/P&gt;&lt;P&gt;        j_3asize = itablnpln-j_3akordx and stzhl eq ' ' and stokz ne 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          sort itablnpln by aufnr j_3asize.&lt;/P&gt;&lt;P&gt;          DELETE ADJACENT DUPLICATES FROM ITABLNPLN COMPARING ALL     FIELDS.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      LOOP AT itablnpln  INTO walnpln.&lt;/P&gt;&lt;P&gt;        contot = 0.&lt;/P&gt;&lt;P&gt;        IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          LOOP AT itablnp ASSIGNING &amp;lt;fs_itablnp&amp;gt; where aufnr = walnpln-aufnr and j_3asize = walnpln-j_3akordx.&lt;/P&gt;&lt;P&gt;            contot = contot + &amp;lt;fs_itablnp&amp;gt;-J_3ALMNGA.&lt;/P&gt;&lt;P&gt;            move &amp;lt;fs_itablnp&amp;gt;-J_3ASIZE to walnpln-J_3ASIZE.&lt;/P&gt;&lt;P&gt;          ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          walnpln-output = contot.&lt;/P&gt;&lt;P&gt;          move zvprdconf-isdd to walnpln-zdate.&lt;/P&gt;&lt;P&gt;          move zvprdconf-isdz to walnpln-ztime.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        walnpln-wip = walnpln-menge - contot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if walnpln-werks = '1000'.&lt;/P&gt;&lt;P&gt;          stklocaf = '1050'.&lt;/P&gt;&lt;P&gt;          stklocas = '1060'.&lt;/P&gt;&lt;P&gt;        elseif walnpln-werks = '2000'.&lt;/P&gt;&lt;P&gt;          stklocaf = '2150'.&lt;/P&gt;&lt;P&gt;          stklocas = '2160'.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        select single kunnr into walnpln-ship from vbpa where&lt;/P&gt;&lt;P&gt;        vbeln = walnpln-KDAUF and PARVW = 'WE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        zship = walnpln-ship.&lt;/P&gt;&lt;P&gt;        move zship to walnpln-ship.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        select  single kalab into walnpln-zactqty from mska&lt;/P&gt;&lt;P&gt;        where matnr = walnpln-plnbez&lt;/P&gt;&lt;P&gt;        and j_3asize = walnpln-J_3AKORDX and LGORT = stklocaf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        condense walnpln-kdauf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        zsales = walnpln-kdauf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        concatenate zsales 'S' into zso.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        select single kalab into walnpln-zsndqty from mska&lt;/P&gt;&lt;P&gt;        where matnr = walnpln-plnbez&lt;/P&gt;&lt;P&gt;        and j_3asize = walnpln-J_3AKORDX and LGORT = stklocas&lt;/P&gt;&lt;P&gt;        and J_4KSCAT = zso.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        zmatn = walnpln-plnbez.&lt;/P&gt;&lt;P&gt;        zsale = walnpln-KDAUF.&lt;/P&gt;&lt;P&gt;        walnpln-kdauf = zsale.&lt;/P&gt;&lt;P&gt;        walnpln-plnbez = zmatn.&lt;/P&gt;&lt;P&gt;        zcust = walnpln-kunnr.&lt;/P&gt;&lt;P&gt;        walnpln-kunnr = zcust.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        select single bezei into walnpln-season from TVV2T where&lt;/P&gt;&lt;P&gt;        kvgr2 = walnpln-kvgr2 and SPRAS = 'E'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        select single bezei into walnpln-shipmode from T173T where&lt;/P&gt;&lt;P&gt;        vsart = walnpln-vsart and SPRAS = 'E'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        STRL = strlen( walnpln-j_3akord2 ).&lt;/P&gt;&lt;P&gt;        if  strl = 4.&lt;/P&gt;&lt;P&gt;          move walnpln-j_3akord2 to walnpln-j_3akord3.&lt;/P&gt;&lt;P&gt;          clear walnpln-j_3akord2.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        move zremk to walnpln-remk.&lt;/P&gt;&lt;P&gt;        MODIFY itablnpln FROM  walnpln.&lt;/P&gt;&lt;P&gt;        contot = 0.&lt;/P&gt;&lt;P&gt;        clear itablnp.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      PERFORM build_fieldcatalog.&lt;/P&gt;&lt;P&gt;      PERFORM build_layout.&lt;/P&gt;&lt;P&gt;      PERFORM display_alv_report.&lt;/P&gt;&lt;P&gt;  endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regs,&lt;/P&gt;&lt;P&gt;raja[&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jan 2007 06:29:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868993#M366081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-30T06:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868994#M366082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;raja&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have told u to removew the select Distinct..&lt;/P&gt;&lt;P&gt;remove the select &amp;lt;b&amp;gt;distinnct&amp;lt;/b&amp;gt; and then sort the table.. remove the adjacent duplicates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. i have told u write the select out side the loop..but still it inside the loop.&lt;/P&gt;&lt;P&gt;3.u r removing the records from table it_zvproddet... but i have told u there is an alternative..&lt;/P&gt;&lt;P&gt;4.there are alomost 5-6 selects inside the loop. remove all these .. select the data bofore the loop into internal tables use for all entires.. then use READ statement to get the records&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this pogram is completly poor..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;plese follow wht i have told..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but u have given me the smae code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Naresh Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jan 2007 12:12:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868994#M366082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-30T12:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Inside loop, time out error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868995#M366083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Naresh, just a small correction &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;sort itablnpln by aufnr j_3asize.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITABLNPLN COMPARING ALL FIELDS.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itablnp by aufnr j_3asize.   &amp;lt;&amp;lt;&amp;lt; make sure your itablnp is sorted, in this case your inner loop below will be faster....I prefer to use "read table binary search... loop from sy-tabix... if any of key fields changes -&amp;gt; exit the loop".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itablnpln INTO walnpln.&lt;/P&gt;&lt;P&gt;contot = 0.&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0. &amp;lt;&amp;lt;&amp;lt;&amp;lt; not sure why would you need this check here...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itablnp ASSIGNING &amp;lt;fs_itablnp&amp;gt; where aufnr = walnpln-aufnr and j_3asize = walnpln-j_3akordx.&lt;/P&gt;&lt;P&gt;contot = contot + &amp;lt;fs_itablnp&amp;gt;-J_3ALMNGA.&lt;/P&gt;&lt;P&gt;move &amp;lt;fs_itablnp&amp;gt;-J_3ASIZE to walnpln-J_3ASIZE.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 18:23:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop-time-out-error/m-p/1868995#M366083</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-01T18:23:46Z</dc:date>
    </item>
  </channel>
</rss>

