<?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 TOP with parameter by using native SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340834#M1920585</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Abap native SQL, you may use OPEN cursor/FETCH/CLOSE cursor to manage the number of records to return. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Hint: Also you won't get into trouble if change of database, as many (most) don't support TOP but use some LIMIT option or ROWNUM virtual field.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Oct 2015 10:50:13 GMT</pubDate>
    <dc:creator>RaymondGiuseppi</dc:creator>
    <dc:date>2015-10-28T10:50:13Z</dc:date>
    <item>
      <title>SELECT TOP with parameter by using native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340831#M1920582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'um using native sql to select data from external database. I need use SELECT TOP statement with parameter. I used below code for this purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;EXEC &lt;SPAN class="L0S52"&gt;SQL &lt;/SPAN&gt;PERFORMING do_work&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;SELECT &lt;/SPAN&gt;TOP &lt;SPAN class="L0S55"&gt;:&lt;/SPAN&gt;gs_row INVOICE_DETAIL_ID&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;:&lt;/SPAN&gt;gs_ids&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;FROM &lt;/SPAN&gt;CUSTOMER_PRODUCTS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;WHERE &lt;/SPAN&gt;CREATED_AT &lt;SPAN class="L0S52"&gt;IS &lt;/SPAN&gt;NULL &lt;SPAN class="L0S52"&gt;OR &lt;/SPAN&gt;CREATED_AT=&lt;SPAN class="L0S33"&gt;'1900-01-01 00:00:00.000'&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN class="L0S52"&gt;ENDEXEC&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;But ABAP gives me error and show :gs_row as ? in Query. I can run same query like SELECT TOP 1000.... and it runs with no errors.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;isnt it possible with ABAP?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 08:55:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340831#M1920582</guid>
      <dc:creator>kahyaogluvolkan</dc:creator>
      <dc:date>2015-10-28T08:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT TOP with parameter by using native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340832#M1920583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Volkan,&lt;/P&gt;&lt;P&gt;In Open SQL whenever we need a single row we use Select Single / Select ..EndSelect statements. Drawing an analogy here what I suggest is try below two things -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Use something like Select Single Top.....&lt;/P&gt;&lt;P&gt;2. Use something like Select Top 1..(This you would have already figured out &lt;SPAN __jive_emoticon_name="silly" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1348/images/emoticons/silly.gif"&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 10:34:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340832#M1920583</guid>
      <dc:creator>Ankit_Maskara</dc:creator>
      <dc:date>2015-10-28T10:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT TOP with parameter by using native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340833#M1920584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Volkan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the type definition that you've given to "gs_row"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 10:41:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340833#M1920584</guid>
      <dc:creator>former_member185587</dc:creator>
      <dc:date>2015-10-28T10:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT TOP with parameter by using native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340834#M1920585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Abap native SQL, you may use OPEN cursor/FETCH/CLOSE cursor to manage the number of records to return. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Hint: Also you won't get into trouble if change of database, as many (most) don't support TOP but use some LIMIT option or ROWNUM virtual field.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 10:50:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-top-with-parameter-by-using-native-sql/m-p/11340834#M1920585</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2015-10-28T10:50:13Z</dc:date>
    </item>
  </channel>
</rss>

