<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491775#M1256713</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you simply need to loop at it1, then loop at it2 checking conditions and update it3&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: check type char1.
loop at it1.
" it1 data to it3.
.
loop at it2 &amp;lt;your condition comparing the field from it1&amp;gt;.
clear check.
" it2 data to it3
append it3. " Here you need to update if entry exist in it2.
check = 'X'.
endloop.
if check ne 'X'.
append it3. " Here you need to update if entry does not exist in it2.
endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Apr 2009 15:52:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-23T15:52:17Z</dc:date>
    <item>
      <title>loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491773#M1256711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have 2 internal tables (for ex it1 and it2).....it1 has 10 records and 9 fields and it2 has 6 records which has 1 field..........i.e i hav to display 10 fields in my output(i.e 9 from it1 and 1 from it2)........for 1st record in it1 i have 3 records in it2 and for 6th record in it1 i have 3 records in it2.....so i hav to get all 10 records from it1 and 6 from it2.........i.e totally i have to get 14 records in my output.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now the issue is on wich table i have to put loop ad how to fill the final internal table....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2009 14:09:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491773#M1256711</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-23T14:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491774#M1256712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey..&lt;/P&gt;&lt;P&gt;try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare an internal table itab3 with fields of it1+it2 .&lt;/P&gt;&lt;P&gt;data flag type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at it1.&lt;/P&gt;&lt;P&gt;  move-corresponding it1 to itab3.&lt;/P&gt;&lt;P&gt;  Loop at it2 where ( condition comparing a field of it1 ).&lt;/P&gt;&lt;P&gt;     move it2 -f1 to itab3-f10.&lt;/P&gt;&lt;P&gt;     append itab 3.&lt;/P&gt;&lt;P&gt;     clear itab3.&lt;/P&gt;&lt;P&gt;     flag = X.&lt;/P&gt;&lt;P&gt;     clear: it2.&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt;if flag NE X.&lt;/P&gt;&lt;P&gt; append itab 3.&lt;/P&gt;&lt;P&gt; clear itab3.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;clear it1,&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Krishna Chaitanya G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2009 14:38:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491774#M1256712</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-23T14:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491775#M1256713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you simply need to loop at it1, then loop at it2 checking conditions and update it3&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: check type char1.
loop at it1.
" it1 data to it3.
.
loop at it2 &amp;lt;your condition comparing the field from it1&amp;gt;.
clear check.
" it2 data to it3
append it3. " Here you need to update if entry exist in it2.
check = 'X'.
endloop.
if check ne 'X'.
append it3. " Here you need to update if entry does not exist in it2.
endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2009 15:52:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491775#M1256713</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-23T15:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491776#M1256714</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;PRE&gt;&lt;CODE&gt;LOOP AT it1.
  LOOP AT it2 WHERE &amp;lt;field&amp;gt; = &amp;lt;it1-field&amp;gt;  AND/OR &amp;lt;field&amp;gt; = &amp;lt;it1-field&amp;gt; .
    "  WRITE all the 10 fields (9 from it1 and 1 from it2)
  ENDLOOP.
  IF sy-subrc NE 0.
    " write 9 fields from it1 and there is no correponding entry in it2 so 10 field will be blank
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2009 16:10:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491776#M1256714</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-23T16:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491777#M1256715</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;Both tables should have a common field (IT1 and IT2).&lt;/P&gt;&lt;P&gt;Sort both tables on the field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort IT1 on FLD1(assuming fld1 is available in both tables)&lt;/P&gt;&lt;P&gt;sort IT2 on FLD1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then,&lt;/P&gt;&lt;P&gt;Loop through IT1 using work area (WA1) and read the second table IT2 using binary search with key as FLD1 = WA1-FLD1.&lt;/P&gt;&lt;P&gt;if read is success, then move the fields from IT1 and IT2 to IT3 using work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before endloop of IT1 append the work area3 to IT3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will solve your problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best wishes,&lt;/P&gt;&lt;P&gt;Sai Prasad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2009 06:19:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-loop/m-p/5491777#M1256715</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-24T06:19:47Z</dc:date>
    </item>
  </channel>
</rss>

