<?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 and endselect in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265042#M491420</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi saritha,&lt;/P&gt;&lt;P&gt;    we can write any no.of selects or select.. endselect( also another form of loop) statements within the loop. but it leads to poor performance since you are trying to access the same database table many times in the loop.&lt;/P&gt;&lt;P&gt;    use for all entries clause to improve the performance.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 May 2007 15:53:03 GMT</pubDate>
    <dc:creator>srinivas_akiri</dc:creator>
    <dc:date>2007-05-25T15:53:03Z</dc:date>
    <item>
      <title>select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265038#M491416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello friends,&lt;/P&gt;&lt;P&gt;following is my scenario.&lt;/P&gt;&lt;P&gt;it seems little tricky and complex. can some one help me with this.&lt;/P&gt;&lt;P&gt;i never used select and endselect.&lt;/P&gt;&lt;P&gt;can we transfer data beteween different itabs and also get data from ztable at a time inside select and endselect	&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab1&lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;             select ztable3  where  field4 = itab1-field4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        move  itab1-field1 to itab2-field1.&lt;/P&gt;&lt;P&gt;                           &lt;/P&gt;&lt;P&gt;                        move ztable3-field3 to itab2-field3.&lt;/P&gt;&lt;P&gt;                     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                    itab2-field5 = ztable3-field7 * itab1-field6 * itab1-field5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            endselect.	&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:43:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265038#M491416</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265039#M491417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT...ENDSELECT is like a LOOP only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * INTO ITAB1&lt;/P&gt;&lt;P&gt;FROM TAB.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1.&lt;/P&gt;&lt;P&gt;ITAB2-FIELD = ITAB1-FIELD1 * X.&lt;/P&gt;&lt;P&gt;APPEND ITAB2.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is same as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM TAB.&lt;/P&gt;&lt;P&gt;ITAB2-FIELD = TAB-FIELD1 * X.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:46:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265039#M491417</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265040#M491418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saritha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The select .. endselect works as a loop fetching single record for every loop pause..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as you kept a select inside a loop .. you have 2 loops.. going to the database unnecessarily so many times is not a good idea...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead you can write &lt;/P&gt;&lt;P&gt;   select * from ztable3 for all entries in itab1 where field4 = itab1-field4.&lt;/P&gt;&lt;P&gt;then ...&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;read table ztable3 with key field4 = itab1-field4.&lt;/P&gt;&lt;P&gt;..move your fields...&lt;/P&gt;&lt;P&gt;append itab2.&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;Vidya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:50:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265040#M491418</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265041#M491419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Saritha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do not use  select endselect and it gives more performance issue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from ztable3 into table itab2&lt;/P&gt;&lt;P&gt;                         where field4 = itab1-field4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab2.&lt;/P&gt;&lt;P&gt;move itab1-field1 to itab2-field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move ztable3-field3 to itab2-field3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2-field5 = ztable3-field7 * itab1-field6 * itab1-field5&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;endloop &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if it is helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:51:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265041#M491419</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265042#M491420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi saritha,&lt;/P&gt;&lt;P&gt;    we can write any no.of selects or select.. endselect( also another form of loop) statements within the loop. but it leads to poor performance since you are trying to access the same database table many times in the loop.&lt;/P&gt;&lt;P&gt;    use for all entries clause to improve the performance.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:53:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265042#M491420</guid>
      <dc:creator>srinivas_akiri</dc:creator>
      <dc:date>2007-05-25T15:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265043#M491421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi darshil&lt;/P&gt;&lt;P&gt;thanks for response,&lt;/P&gt;&lt;P&gt;here i just  want to know how to handle a situation where in data transfers and calculations  happen between two itabs and a ztable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:53:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265043#M491421</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265044#M491422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks friends,&lt;/P&gt;&lt;P&gt;can we use read on ztable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:55:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265044#M491422</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265045#M491423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Saritha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we cannot use a read on a database table directly.&lt;/P&gt;&lt;P&gt;we need to make a select from the ztable into an internal table and then read on that internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vidya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:58:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265045#M491423</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: select and endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265046#M491424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What exactly is the scenario? You want to move data to itab2 or you want to get data from itab1, itab2 and ztable3?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you move data to itab2 or you want to get data from itab1, itab2 and ztable3:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ztable3 where field4 = itab1-field4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Use a read statement:&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;READ TABLE ITAB2 WITH KEY ...&lt;/P&gt;&lt;P&gt;(or you can use LOOP AT ITAB2 in case of multiple records)&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;move itab1-field1 to itab2-field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move ztable3-field3 to itab2-field3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2-field5 = ztable3-field7 * itab1-field6 * itab1-field5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endselect. &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;If ITAB2 is your destination table then:&lt;/P&gt;&lt;P&gt;loop at itab1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ztable3 where field4 = itab1-field4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move itab1-field1 to itab2-field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move ztable3-field3 to itab2-field3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2-field5 = ztable3-field7 * itab1-field6 * itab1-field5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;APPEND ITAB2.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;endselect. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 15:59:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-endselect/m-p/2265046#M491424</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T15:59:30Z</dc:date>
    </item>
  </channel>
</rss>

