<?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: problem with loop statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212781#M1377934</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Vikranth, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the second tabix.&lt;/P&gt;&lt;P&gt;exnum    exyear  matnr zeile   exc_zeile&lt;/P&gt;&lt;P&gt;90005    2009     AB       02        SPACE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry in the original I couldnt able to edit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the second table there is no exc_zeile .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I want to display the material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Tell some idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Sep 2009 18:07:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-29T18:07:09Z</dc:date>
    <item>
      <title>problem with loop statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212779#M1377932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tables : J_1iexcdtl, j_1igrxsub.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;exnum  exyear  matnr              zeile    exc_zeile            mblnr
          90005    2009     AA      01          01          4500001
                                                             4500002
          
          90005    2009     AB       02          02

          90005    2009     AC       03          03          4500007
                                                             4500008 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the final output I need.But I am getting below output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;exnum  exyear  matnr              zeile    exc_zeile            mblnr
          90005    2009     AA      01          01          4500001
                                                             4500002
          
 

          90005    2009     AC       03          03          4500007
                                                             4500008 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from  J_1iexcdtl into corresponding fields of table it_exe
                   where exnum in s_exnum and exyear in s_exyear.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; if not it_exe[] is initial.
select * from  j_1igrxsub into corresponding fields of table it_sub 
  for all entries in it_exe where exnum = it_exe-exnum and mjahr = it_exe-exyear.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at it_exe into wa_exe.
loop at it_sub into wa_sub where exnum = wa_exnum
                                and exc_zeile = wa_exe-zeile.
move-corresponding wa_exe to wa_final.
move  : wa_sub-mblnr to wa_final-mblnr.
append wa_final to it_final.
clear : wa_exe,wa_sub.
endloop.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please suggest some idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bathri&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bathrinath Sankaranarayanan on Sep 30, 2009 1:33 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bathrinath Sankaranarayanan on Sep 30, 2009 1:36 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 17:32:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212779#M1377932</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-29T17:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: problem with loop statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212780#M1377933</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;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at it_exe into wa_exe.
move-corresponding wa_exe to wa_final.
read table it_sub into wa_sub with key exnum = wa_exnum
                                and exc_zeile = wa_exe-zeile.
if sy-subrc = 0.
move  : wa_sub-mblnr to wa_final-mblnr.
endif.
append wa_final to it_final.
clear: wa_exe,wa_sub.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of nested loops use read to increase performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or if you have M:M relation between the internal tables, use nested loops as its unavoidable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at it_exe into wa_exe.
move-corresponding wa_exe to wa_final.
loop at it_sub into wa_sub where exnum = wa_exnum
                                and exc_zeile = wa_exe-zeile.
move  : wa_sub-mblnr to wa_final-mblnr.
append wa_final to it_final.
clear: wa_exe,wa_sub.
endloop.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vikranth.Reddy on Sep 29, 2009 11:11 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 17:37:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212780#M1377933</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-29T17:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: problem with loop statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212781#M1377934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Vikranth, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the second tabix.&lt;/P&gt;&lt;P&gt;exnum    exyear  matnr zeile   exc_zeile&lt;/P&gt;&lt;P&gt;90005    2009     AB       02        SPACE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry in the original I couldnt able to edit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the second table there is no exc_zeile .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I want to display the material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Tell some idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 18:07:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212781#M1377934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-29T18:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: problem with loop statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212782#M1377935</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;Then remove just that condition in the second loop and try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at it_exe into wa_exe.
move-corresponding wa_exe to wa_final.
loop at it_sub into wa_sub where exnum = wa_exnum.  "remove where on exc_zeile
move  : wa_sub-mblnr to wa_final-mblnr.
append wa_final to it_final.
clear: wa_exe,wa_sub.
endloop.
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, 29 Sep 2009 18:36:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-loop-statement/m-p/6212782#M1377935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-29T18:36:02Z</dc:date>
    </item>
  </channel>
</rss>

