<?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 select problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411343#M1048211</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;i do this select with while loop.&lt;/P&gt;&lt;P&gt;the logic is that the select is running until i get in ukurs data ,&lt;/P&gt;&lt;P&gt;otherwise it add 1 to datecur and and try to find ukurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the problem is that in prod it run to long there is a way to improve this performance?&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;&lt;/P&gt;&lt;P&gt;      ukurs = ''.&lt;/P&gt;&lt;P&gt;      WHILE ukurs = ''.&lt;/P&gt;&lt;P&gt;        SELECT SINGLE ukurs&lt;/P&gt;&lt;P&gt;        FROM tcurr&lt;/P&gt;&lt;P&gt;        INTO ukurs&lt;/P&gt;&lt;P&gt;        WHERE kurst = '1002' AND&lt;/P&gt;&lt;P&gt;              fcurr = wa_dp-currency AND&lt;/P&gt;&lt;P&gt;              tcurr =  'USD0' AND&lt;/P&gt;&lt;P&gt;              gdatu = datecur.&lt;/P&gt;&lt;P&gt;        datecur = datecur + 1.&lt;/P&gt;&lt;P&gt;      ENDWHILE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Sep 2008 09:31:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-18T09:31:26Z</dc:date>
    <item>
      <title>select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411343#M1048211</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;i do this select with while loop.&lt;/P&gt;&lt;P&gt;the logic is that the select is running until i get in ukurs data ,&lt;/P&gt;&lt;P&gt;otherwise it add 1 to datecur and and try to find ukurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the problem is that in prod it run to long there is a way to improve this performance?&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;&lt;/P&gt;&lt;P&gt;      ukurs = ''.&lt;/P&gt;&lt;P&gt;      WHILE ukurs = ''.&lt;/P&gt;&lt;P&gt;        SELECT SINGLE ukurs&lt;/P&gt;&lt;P&gt;        FROM tcurr&lt;/P&gt;&lt;P&gt;        INTO ukurs&lt;/P&gt;&lt;P&gt;        WHERE kurst = '1002' AND&lt;/P&gt;&lt;P&gt;              fcurr = wa_dp-currency AND&lt;/P&gt;&lt;P&gt;              tcurr =  'USD0' AND&lt;/P&gt;&lt;P&gt;              gdatu = datecur.&lt;/P&gt;&lt;P&gt;        datecur = datecur + 1.&lt;/P&gt;&lt;P&gt;      ENDWHILE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 09:31:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411343#M1048211</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T09:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411344#M1048212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would probably be best to SELECT all kurst = '1002' entries into an internal table and then loop around that. This is preferable to doing many SELECT statements within a loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However how many entries are in your TCURR table? The current system I work on only has 200 so I can't equate it to a performance issue if I were to run your code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 09:37:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411344#M1048212</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T09:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411345#M1048213</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;If you write the SELECT Query inside Loop it will take time to execute. And performance will decrease.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if possible Avoid Select inside Loop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 09:39:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411345#M1048213</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T09:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411346#M1048214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also reconsider the checking of ukurs = '' since it is not a character-based field. Your loop may not actually be exiting &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 09:43:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411346#M1048214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T09:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411347#M1048215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Ricardo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if I understand right you need the exchange rate for a given date (datecur) or closest to that date in the future. You can replace the WHILE-ENDWHILE with the following SELECT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT ukurs MIN( gdatu )
INTO ...
FROM tcurr
WHERE ... gdatu GE datecur
GROUP BY ukurs gdatu.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trick is to use SELECT ... MIN( gdatu ) which will only select the possible lowest date (pls. note the comparison in the WHERE: gdatu GE datecur&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course this is not complete, you have to add the other conditions as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 09:59:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411347#M1048215</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-09-18T09:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411348#M1048216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eric,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Thanks u understand right&lt;/U&gt; ,&lt;/P&gt;&lt;P&gt; but how your select is now if it dont find value,&lt;/P&gt;&lt;P&gt; go to next  day and so on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 10:52:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411348#M1048216</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T10:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411349#M1048217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry, what i wrote aboe is not correct, it still selects all lines. I think you have to go for array select:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT gdatu ukurs
FROM tcurr
INTO TABLE ...
WHERE ... gdatu GE decdate&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will select all possible entries in one go&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT itab BY gdatu.
READ TABLE itab INTO ... INDEX 1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;internal table will be sorted with date, which means, the first line is what you'll finally need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps (finally)&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 11:15:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/4411349#M1048217</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-09-18T11:15:41Z</dc:date>
    </item>
  </channel>
</rss>

