<?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 to execute dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628400#M1441552</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved my problem with the following link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2663181"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 07 Feb 2010 20:09:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-07T20:09:23Z</dc:date>
    <item>
      <title>Select statement to execute dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628393#M1441545</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 just want to execute the Select statement dynamically using open cursor statement and without Open cursor statment (Just Select statement).....&lt;/P&gt;&lt;P&gt;How can i do that in the program...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data s_cursor type cursor.
data:it_mara TYPE TABLE OF mara,
     v_stmt type string.

* Case 1 - Open cursor
v_stmt = 'SELECT * FROM MARA.'.
OPEN CURSOR WITH HOLD s_cursor FOR 
  v_stmt . "How can i execute the Select statement here

DO.
  FETCH NEXT CURSOR s_cursor APPENDING TABLE it_mara.
  IF sy-subrc  &amp;lt;&amp;gt; 0.
    EXIT.
  ENDIF.
ENDDO.

* Case 2- No Open Cursor
v_stmt.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Feb 2010 20:45:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628393#M1441545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-05T20:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement to execute dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628394#M1441546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried normal dynamic SELECTs here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Feb 2010 21:22:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628394#M1441546</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-05T21:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement to execute dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628395#M1441547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sorry, I don't know... what is that means....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Feb 2010 21:27:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628395#M1441547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-05T21:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement to execute dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628396#M1441548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the ABAP documentation for SELECT and look at the columns and source areas. That shows you how to do exactly (I think) what you want. Get back to the forum if you have problems after reading that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Feb 2010 21:32:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628396#M1441548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-05T21:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement to execute dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628397#M1441549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used normal Select like the below. But i want to execute dynamic open SQL statments using Open Curosr, This is my requirement.&lt;/P&gt;&lt;P&gt;Like this OPEN CURSOR WITH HOLD s_cursor FOR (Open SQL statement).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data s_cursor type cursor.&lt;/P&gt;&lt;P&gt;data:it_mara TYPE TABLE OF mara.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  v_stmt type string.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Case 1 - Open cursor&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;v_stmt = 'SELECT * FROM MARA.'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;OPEN CURSOR WITH HOLD s_cursor FOR &lt;/P&gt;&lt;P&gt;  select * from mara.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;  FETCH NEXT CURSOR s_cursor APPENDING TABLE it_mara.&lt;/P&gt;&lt;P&gt;  IF sy-subrc   0.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Case 2- No Open Cursor&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;select * from mara into table it_mara.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Feb 2010 23:14:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628397#M1441549</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-05T23:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement to execute dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628398#M1441550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi fract_get,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder why you want to use OPEN CURSOR at all because I can not imagine any requirement that makes it obligatory. You may correct me when I say that OPEN CURSOR and FETCH are from the very early times when the database interface could not really help you much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using an ECC600 system this is simply obsolete. There are better ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please convince me there are good reasons to use OPEN CURSOR WITH HOLD. What are the 'dynamics'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm always happy if I can learn something.&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;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Feb 2010 00:12:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628398#M1441550</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-02-06T00:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement to execute dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628399#M1441551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using OPEN CURSOR for downloading the table data in multiple files based on package size. I want to use Open sql statment as a input from file. Here is my requirement...How can i make it executable the Open SQL statements here OR Is there any other way.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF  IT_OPEN_SQL OCCURS 0,
        QUERY TYPE STRING,
        END OF  IT_OPEN_SQL.
DATA: V_SIZE TYPE I.

LOOP AT IT_OPEN_SQL.
  OPEN CURSOR WITH HOLD C_CURSOR FOR
      (IT_OPEN_SQL-QUERY).
  DO.
    FETCH NEXT CURSOR C_CURSOR INTO TABLE &amp;lt;F_FS&amp;gt; PACKAGE SIZE V_SIZE.
    IF SY-SUBRC NE 0.
      CLOSE CURSOR C_CURSOR.
      EXIT.
    ENDIF.
* Downloading into file.......
  ENDDO.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Feb 2010 16:34:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628399#M1441551</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-07T16:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement to execute dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628400#M1441552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved my problem with the following link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2663181"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Feb 2010 20:09:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-to-execute-dynamically/m-p/6628400#M1441552</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-07T20:09:23Z</dc:date>
    </item>
  </channel>
</rss>

