<?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 a loop is recommended or not? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116242#M1363097</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;Dont use loop inside loop, &lt;/P&gt;&lt;P&gt;The better way is u can use loop at one internaltable1 to workarea1 .&lt;/P&gt;&lt;P&gt;then read internaltable2 with key belnr = workarea1-belnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This improves ur performance alot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Sep 2009 12:18:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-15T12:18:50Z</dc:date>
    <item>
      <title>Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116236#M1363091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;   I have a code as follows.&lt;/P&gt;&lt;P&gt;PARAMETERS: P_DC LIKE MARC-WERKS OBLIGATORY.&lt;/P&gt;&lt;P&gt;loop at it_x.&lt;/P&gt;&lt;P&gt;  abc = p_dc. //p_dc is input parameter.&lt;/P&gt;&lt;P&gt;  Some Logic/function modules are called.......&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i have to change p_dc as s_dc i.e. select option in input screen.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: S_DC    FOR MARC-WERKS OBLIGATORY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in above logic -- 1 way to do this is writting loop inside a loop to process that logic for every record in s_dc in above code.&lt;/P&gt;&lt;P&gt;IS IT RECOMMENED TO WRITE LOOP INSIDE A LOOP?&lt;/P&gt;&lt;P&gt;If not then what is another way to handle this?&lt;/P&gt;&lt;P&gt;As i am trying to find out some other way than loop since morning but not able to find the way out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:00:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116236#M1363091</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116237#M1363092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried searching this site using loop within loop....?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:03:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116237#M1363092</guid>
      <dc:creator>christine_evans</dc:creator>
      <dc:date>2009-09-15T12:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116238#M1363093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi kiran..&lt;/P&gt;&lt;P&gt;definite NO for loop inside loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can either read the select option and modify the it_x according to that first or fetch according to s_dc while writing select statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can compare select option values as abc in s_dc etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:05:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116238#M1363093</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116239#M1363094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all, i'm not pretty sure about your requirement. &lt;/P&gt;&lt;P&gt;If you can clearly explain you requirement, i can help you out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding loop inside a loop, Its usually not recommended because of Performance Issues. But there are cases, when you can't avoid using the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Asha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:06:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116239#M1363094</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116240#M1363095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran Chorge ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In General it's not recommended to use LOOP inside LOOP..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But at last it all depends on the requirement... there are cases where you have to write loop inside loop as per the user requirement...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to avoid LOOP inside LOOP then you can use READ statement for the header table data selection in general...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It all depends on the requirement..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you are using WERKS ==&amp;gt; Plant &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will not be having much impact because in master data there will be countable number of plants present... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope it will solve your problem..&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;ilesh 24x7&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ilesh Nandaniya&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:13:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116240#M1363095</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116241#M1363096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well if you want to avoid nested loop try this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

SELECT-OPTIONS: S_DC FOR MARC-WERKS OBLIGATORY.

data: count type i.

loop at it_x.
count = count + 1.
read table s_dc index count.
if sy-subrc = 0.
abc = s_dc-low.                        //s_dc is input parameter.
endif.
Some Logic/function modules are called.......
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:15:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116241#M1363096</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116242#M1363097</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;Dont use loop inside loop, &lt;/P&gt;&lt;P&gt;The better way is u can use loop at one internaltable1 to workarea1 .&lt;/P&gt;&lt;P&gt;then read internaltable2 with key belnr = workarea1-belnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This improves ur performance alot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:18:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116242#M1363097</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116243#M1363098</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;That's purely depends on your requirement.&lt;/P&gt;&lt;P&gt;If there is no way other than Loop Inside Loop,we can do that.&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;Sreeram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:20:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116243#M1363098</guid>
      <dc:creator>sreeramkumar_madisetty</dc:creator>
      <dc:date>2009-09-15T12:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116244#M1363099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vikranth,&lt;/P&gt;&lt;P&gt;  But in my case it_x for eg. has 10 records and s_dc hav say 3 records.&lt;/P&gt;&lt;P&gt;Now i have to execute that logic for every record of it_x with every record of s_dc..&lt;/P&gt;&lt;P&gt;its like&lt;/P&gt;&lt;P&gt;it_x-1 with s_dc-1&lt;/P&gt;&lt;P&gt;it_x-1 with s_dc-2&lt;/P&gt;&lt;P&gt;it_x-1 with s_dc-3&lt;/P&gt;&lt;P&gt;it_x-2 with s_dc-1&lt;/P&gt;&lt;P&gt;it_x-2 with s_dc-2&lt;/P&gt;&lt;P&gt;it_x-2 with s_dc-3&lt;/P&gt;&lt;P&gt;it_x-3 with s_dc-1&lt;/P&gt;&lt;P&gt;it_x-3 with s_dc-2&lt;/P&gt;&lt;P&gt;it_x-4 with s_dc-3&lt;/P&gt;&lt;P&gt;so on......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:22:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116244#M1363099</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116245#M1363100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran,&lt;/P&gt;&lt;P&gt;Try this way..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data:
t_werks type table of marc-werks with header line.
select werks 
into table t_werks
from marc
where werks in s_dc.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;//The selection table s_dc vl contain only 2 rec s_dc-low &amp;amp; s_dc-high.&lt;/P&gt;&lt;P&gt;   the above code vl get u all the entries in b/w s_dc-low &amp;amp; s_dc-high.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: w_idx type i value '1',
         w_lines type i.
describe table t_werks lines w_lines. // this gets no. of lines in t_werks.
loop at it_x.
read table t_werks index w_idx.
if sy-subrc eq 0.
abc = t_werks.
add 1 to w_idx.
endif.
if w_idx gt w_lines.
  w_idx = 1.
endif.
// othr functionality.......
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope it helps....&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mdi.Deeba&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Mdi.Deeba on Sep 15, 2009 6:02 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:30:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116245#M1363100</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116246#M1363101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kiran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That wouldnt be possible without using the nested loops. The parallel processing technique will be applicable only if its a M:1 relationship. In case of M:M relationship, nested loop is unavoidable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you are just assigning values of the internal table with the select option values there shouldnt be much of a performance constraint even if you use nested loop here. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:33:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116246#M1363101</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116247#M1363102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Kiran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is usually not recommended to use Loop within a Loop as the performance of the program worsens. But there are few scenarios where the Loop within Loop concept cannot be avoided and those cases we can use a Read Statement with a condition that satisfies your requirement. If that also cannot be used then go for Loop within Loop logic but make sure that you use the below algorithm so the performance of the program is not affected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Algorithm for Nested Loops:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If ITAB1 has n1 entries and ITAB2 has n2 entries, the time needed for the nested loop with the straightforward algorithm is O(n1 * n2), whereas the parallel cursor approach takes only O(n1 + n2) time. &lt;/P&gt;&lt;P&gt;The below parallel cursor algorithm assumes that ITAB2 contains only entries also contained in ITAB1. If this assumption does not hold, the parallel cursor algorithm gets slightly more complicated, but its performance characteristics remain the same.&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;Entries: 100 (ITAB1), 1000 (ITAB2)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Line width: 100&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Both tables sorted by key K&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1 INTO WA1.&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB2 INTO WA2&lt;/P&gt;&lt;P&gt;                WHERE K = WA1-K.&lt;/P&gt;&lt;P&gt;    " ...&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;**********************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Entries: 100 (ITAB1), 1000 (ITAB2)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Line width: 100&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Both tables sorted by key K&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I = 1.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1 INTO WA1.&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB2 INTO WA2 FROM I.&lt;/P&gt;&lt;P&gt;    IF WA2-K &amp;lt;&amp;gt; WA1-K.&lt;/P&gt;&lt;P&gt;      I = SY-TABIX.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank,&lt;/P&gt;&lt;P&gt;Harini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 12:43:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116247#M1363102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T12:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116248#M1363103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mdi.Deeba&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ur first part is really helpfull.&lt;/P&gt;&lt;P&gt;But as per my understanding in second part...&lt;/P&gt;&lt;P&gt;u r assuming only 1 record of s_dc per it_x record..which is not the case&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its like for every record read from it_x, i have to process say 3 records which r in s_dc&lt;/P&gt;&lt;P&gt;SO if it_x hase say 5 recs and s_dc has 2 recs..then for every rec in it_x i have to consider 2 recs of s_dc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx for ur reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 13:03:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116248#M1363103</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T13:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116249#M1363104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LOOP INSIDE THE LOOP IS RECOMENDED, BECAUSE IT IS IMPLEMENTED FOR HIERARCHICAL TABLES. WHERE AS LOOP WITH READ IS PREFERED FOR PEER TABLES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT IS COMMONLY USED CONCEPT IN REAL TIME.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 13:12:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116249#M1363104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T13:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116250#M1363105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran ,&lt;/P&gt;&lt;P&gt;Here is the modified code.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: w_idx type i value '1',
         w_lines type i.
describe table t_werks lines w_lines. // this gets no. of lines in t_werks.
loop at it_x.
*do w_lines times.*
read table t_werks index w_idx.
if sy-subrc eq 0.
abc = t_werks.
add 1 to w_idx.
endif.
if w_idx gt w_lines.
  w_idx = 1.
endif.
// othr functionality.......
*enddo*
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else u can also prefer loop inside loop bt thr are performance issues...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at it_x.
  loop at t_werks.
    abc = t_werks.
  // othr functionality.......
  endloop.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 13:24:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116250#M1363105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-15T13:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a loop is recommended or not?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116251#M1363106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hI GUYS ,&lt;/P&gt;&lt;P&gt;THX FOR UR REPLIES...&lt;/P&gt;&lt;P&gt;AT THE END I HAVE DECIDED TO USE LOOP STATEMENT..AS I THINK THERE IS NO OTHER WAY OUT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 07:23:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop-is-recommended-or-not/m-p/6116251#M1363106</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T07:23:17Z</dc:date>
    </item>
  </channel>
</rss>

