<?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: Native SQL Select data into a internal table..!! in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687976#M1450604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want the entire content of CDHDR?  Your program is going to run a while!  Seriously, use Open SQL with the appropriate WHERE clause!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Mar 2010 14:53:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-09T14:53:41Z</dc:date>
    <item>
      <title>Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687971#M1450599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hii All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use Native SQL in retrieving data from a standard table into a internal table.Here is the code which i have written.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_cdhdr TYPE STANDARD TABLE OF cdhdr.&lt;/P&gt;&lt;P&gt;DATA: wa_cdhdr LIKE LINE OF it_cdhdr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL PERFORMING append_itab.&lt;/P&gt;&lt;P&gt;  SELECT *&lt;/P&gt;&lt;P&gt;  INTO   :wa_cdhdr&lt;/P&gt;&lt;P&gt;  FROM   cdhdr&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM append_itab.&lt;/P&gt;&lt;P&gt;  APPEND wa_cdhdr TO it_cdhdr.&lt;/P&gt;&lt;P&gt;  CLEAR wa_cdhdr.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives me a wrong number of entries in my internal table during the Debug. Dont know whats the reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, i want to know is there any other better way of accessing the database tabel and pass it into a inetrnal table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 13:00:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687971#M1450599</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T13:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687972#M1450600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Also, i want to know is there any other better way of accessing the database tabel and pass it into a inetrnal table?&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Open SQL. I do not see the point of using Native SQL ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 13:23:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687972#M1450600</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-03-09T13:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687973#M1450601</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;Can you please tell us why you have used native sql.. You can very well use Open SQL....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 13:25:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687973#M1450601</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2010-03-09T13:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687974#M1450602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt; //REPORT demo_native_sql.

DATA: BEGIN OF wa,
        connid   TYPE spfli-connid,
        cityfrom TYPE spfli-cityfrom,
        cityto   TYPE spfli-cityto,
      END OF wa.

DATA c1 TYPE spfli-carrid VALUE 'LH'.

EXEC SQL PERFORMING loop_output.
  SELECT connid, cityfrom, cityto
  INTO   :wa
  FROM   spfli
  WHERE  carrid = :c1
ENDEXEC.

FORM loop_output.
  WRITE: / wa-connid, wa-cityfrom, wa-cityto.
ENDFORM. 
    &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are missing the field sequence in ur select ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this example for ur query &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.. but before that try to answer the questions that are asked &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br, &lt;/P&gt;&lt;P&gt;Vijay.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 13:31:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687974#M1450602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T13:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687975#M1450603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Native sql is used to select data from tables outside SAP like Oracle database system. In this scenario there is no use of native SQL,you are able to use Open SQL which is the correct way in this mathod.Revert back in case of any doubt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 14:23:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687975#M1450603</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T14:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687976#M1450604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want the entire content of CDHDR?  Your program is going to run a while!  Seriously, use Open SQL with the appropriate WHERE clause!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 14:53:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687976#M1450604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T14:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687977#M1450605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess there will be a memory problem before it can run too long &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 15:06:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687977#M1450605</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2010-03-09T15:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687978#M1450606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hii Everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for the answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, we were asked by our team lead to use Native SQL rather than an direct Open SQL select. &lt;/P&gt;&lt;P&gt;Also, the example which i have given is for CDHDR table, but in the real scenario it is a Control table which has very few records.(max of 20 records)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For improving the performance we are asked to use a direct SQL statement rather than the normal way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if you need any other info. Help me out in writing a sql query such that i can directly insert data into a internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 15:15:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687978#M1450606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T15:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687979#M1450607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want to improve the performance for reading a table with 20 entries? How often is it being read? Better use SAP table buffering!&lt;/P&gt;&lt;P&gt;Sorry, we must keep trying to steer you and your team lead into other territory. Avoid Native SQL in ABAP as much as you can.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 15:23:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687979#M1450607</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2010-03-09T15:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687980#M1450608</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;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; This gives me a wrong number of entries in my internal table during the Debug. Dont know whats the reason.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;client dependency? OPEN SQL is client dependent native SQL istn't (default) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 15:43:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687980#M1450608</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2010-03-09T15:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Native SQL Select data into a internal table..!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687981#M1450609</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;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; For improving the performance we are asked to use a direct SQL statement rather than the normal way. &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Please let me know if you need any other info. Help me out in writing a sql query such that i can directly insert data into a internal table.&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you should not use native SQL for performance reasons in such a case. Actually OPEN SQL could be faster because it can use the SAP table buffer or use array interfaces which is not possible with native SQL. (Native SQL should be used for tables which can't be accessed with OPEN SQL or if you want to use a database specific SQL feature which is not available in OPEN SQL but for sure not in your case).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 15:46:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/native-sql-select-data-into-a-internal-table/m-p/6687981#M1450609</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2010-03-09T15:46:47Z</dc:date>
    </item>
  </channel>
</rss>

