<?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: select statement &amp; loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783435#M337553</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dasr,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use SELECT... FOR ALL ENTRIES... before LOOP-ENDLOOP, let's say you save the data into internal table itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can replace the select statment which was used between LOOP-ENDLOOP with READ TABLE itab1 WITH KEY ... BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would be much faster...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hendy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Dec 2006 06:48:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-11T06:48:29Z</dc:date>
    <item>
      <title>select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783429#M337547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to fine tune one report.......in which one slect statement was used in between loop and end loop ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how to avoid it........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can u give any ex: code for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:37:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783429#M337547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783430#M337548</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;Any possible to inner join with the existing select query? else use for all entries or specific selection. Fine tune by giving the exact condition, it will giving the result immediately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give ue code, then we can find the right solution&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:40:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783430#M337548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783431#M337549</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;It is the no 1 performence killer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead use FOR ALL ENTRIES .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guru&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;mark if helpful&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:41:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783431#M337549</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783432#M337550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;U can use for all entries in table..&lt;/P&gt;&lt;P&gt; for ex&lt;/P&gt;&lt;P&gt;Select matnr  from mara into table itab_mara where matnr in s_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from makt into table itab_makt for all entries in itab_mara where matnr = itab_mara-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make sure that itab_ara is not initial.&lt;/P&gt;&lt;P&gt;sort the itab_mara table for performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:42:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783432#M337550</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783433#M337551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT MATNR FROM MARA INTO TABLE ITAB.

LOOP AT IT_MAKTX.

  READ TABLE IT_MATNR WITH KEY MATNR = IT_MATKX-MATNR.
   IF SY-SUBRC EQ 0.
  
   *u can do the processing here

    ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:43:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783433#M337551</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783434#M337552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thids is the code iam having.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the itab 1 is it_parent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of it_parent occurs 0,&lt;/P&gt;&lt;P&gt;      lead_aufnr like caufv-lead_aufnr,                            " LEAD ORDER NUMBER&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     aufnr LIKE caufv-aufnr,                                      " Order no&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      gstrp like caufv-gstrp,                                      " Basic Start Date&lt;/P&gt;&lt;P&gt;      werks like caufv-werks,                                      " PLANT&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     auart LIKE caufv-auart,                                      " Order Type&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      stlbez LIKE caufv-stlbez,                                    " Material ( FROM CAUFV)&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     matnr LIKE mara-matnr,                                       " Material&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      sldate like zpp_po_loc-sldate,&lt;/P&gt;&lt;P&gt;      rsnum like caufv-rsnum,&lt;/P&gt;&lt;P&gt;      collective type c length 1,&lt;/P&gt;&lt;P&gt;      end of it_parent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: l_sldate2 like sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; loop at it_parent.                          "&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       select single sldate into l_sldate2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                            from zpp_po_loc&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                            where aufnr = it_parent-lead_aufnr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                              and matnr = it_parent-stlbez.&lt;/P&gt;&lt;/LI&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;       endselect.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           it_parent-sldate = l_sldate2.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           modify it_parent transporting sldate.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           clear l_sldate2.&lt;/P&gt;&lt;/LI&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;       clear it_parent.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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;this is the code........&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:47:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783434#M337552</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783435#M337553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dasr,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use SELECT... FOR ALL ENTRIES... before LOOP-ENDLOOP, let's say you save the data into internal table itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can replace the select statment which was used between LOOP-ENDLOOP with READ TABLE itab1 WITH KEY ... BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would be much faster...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hendy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:48:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783435#M337553</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783436#M337554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To avoid select statement between loop  and end loop&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;use  loop and read statements.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g:- &amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;1.&amp;lt;b&amp;gt; Select all data related to your internal table in one hit by for all entries.&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; if have list of material numbers in your interal table say itab_matno.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;for all these materials you have to select the material description into another &amp;lt;br&amp;gt;internal table say itab_desc by for all entries.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr maktx into table ITAB_desc&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;from MAKT for all entries in ITAB_MATNO&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;where matnr = ITAB-MATNR.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will fetch the decription for all entries. &amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. 1.&amp;lt;b&amp;gt; Use read inside loop and modify internal table&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i will read between loop and endloop staemnt and modify my internal table&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop at  ITAB_MATNO.&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*read and modify the plant name in an internal table&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;    read table ITAB with&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;                   key matnr = ITAB-matnr. &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;    ITAB_MATNO-MAKTX = ITAB-MAKTX.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    modify ITAB_MATNO.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;    clear ITAB_MATNO.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;    clear ITAB.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;  endloop.&amp;lt;br&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:49:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783436#M337554</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: select statement &amp; loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783437#M337555</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;data : begin of itab2 occurs 0&lt;/P&gt;&lt;P&gt;         aufnr type zpp_po_lac-aufnr,&lt;/P&gt;&lt;P&gt;         matnr type zpp_po_lac-matnr,&lt;/P&gt;&lt;P&gt;         sldate type zpp_po_lac-sldate,&lt;/P&gt;&lt;P&gt;         end of itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ....into table it_parent where..&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;select aufnr matnr sldate from zpp_po_lac into table itab2 for all entries in it_parent&lt;/P&gt;&lt;P&gt;where aufnr = it_parent-lead_aufnr&lt;/P&gt;&lt;P&gt; and matnr = it_parent-stlbez.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_parent.&lt;/P&gt;&lt;P&gt;clear itab2.&lt;/P&gt;&lt;P&gt;read table itab2 with key aufnr = it_parent-aufnr&lt;/P&gt;&lt;P&gt;                                     matnr = it_parent-matnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt; it_parent-sldate = l_sldate2.&lt;/P&gt;&lt;P&gt; modify it_parent transporting sldate where aufnr = it_parent-aufnr&lt;/P&gt;&lt;P&gt;                                     matnr = it_parent-matnr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;clear it_parent.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly reward points if it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:55:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-loop/m-p/1783437#M337555</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2006-12-11T06:55:16Z</dc:date>
    </item>
  </channel>
</rss>

