<?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: request on Native SQL Insert statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904004#M377043</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please proivde such statements with proper syntax..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Manoj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Feb 2007 06:35:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-14T06:35:57Z</dc:date>
    <item>
      <title>request on Native SQL Insert statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904001#M377040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good morning and Happy Valentines day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By using Native SQL statement.&lt;/P&gt;&lt;P&gt;I want to insert a record into my table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the values which are to be inserted, I have to get from other table.&lt;/P&gt;&lt;P&gt;Can anyone help me on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 06:01:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904001#M377040</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T06:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: request on Native SQL Insert statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904002#M377041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: GT_T2 TYPE TABLE OF &amp;lt;TABLE2&amp;gt;,
      GT_T1 TYPE TABLE OF &amp;lt;TABLE1&amp;gt;.

SELECT * FROM &amp;lt;table2&amp;gt; INTO TABLE gt_t2.

LOOP AT GT_T2.
  MOVE-CORRESPONDING GT_T2 TO GT_T1.
  APPEND GT_T1.
ENDLOOP.

INSERT &amp;lt;table1&amp;gt; FROM TABLE gt_t1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 06:13:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904002#M377041</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T06:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: request on Native SQL Insert statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904003#M377042</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;check this example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL. &lt;/P&gt;&lt;P&gt;  INSERT INTO AVERI_CLNT (CLIENT, ARG1, ARG2, ARG3) &lt;/P&gt;&lt;P&gt;         VALUES ('000', 9, 2, 47) &lt;/P&gt;&lt;P&gt;ENDEXEC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 06:14:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904003#M377042</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T06:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: request on Native SQL Insert statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904004#M377043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please proivde such statements with proper syntax..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Manoj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 06:35:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904004#M377043</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T06:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: request on Native SQL Insert statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904005#M377044</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;Native SQL allows you to perform operations on databases over and above those in the Open SQL command set. In contrast to Open SQL, Native SQL supports not only operations on the local database active in the R/3 System, but also on any external databases. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Native SQL comprises all the static statements of the data definition language (DDL) and the data manipulation language (DML) used by the relational database system concerned. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In an ABAP/4 program, a Native SQL command must be introduced by EXEC SQL and concluded by ENDEXEC. To execute a Native SQL command, the database table does not have to be declared in the ABAP/4 Dictionary. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL. &lt;/P&gt;&lt;P&gt;  INSERT INTO &amp;lt;TABLENAME&amp;gt; (&amp;lt;FIELD1&amp;gt;, &amp;lt;FIELD2&amp;gt;, &amp;lt;FIELD3&amp;gt;) &lt;/P&gt;&lt;P&gt;         VALUES (&amp;lt;VALUE1&amp;gt;,&amp;lt;VALUE3&amp;gt;&amp;lt;VALUE3&amp;gt;) &lt;/P&gt;&lt;P&gt;ENDEXEC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sruthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 13:38:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904005#M377044</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T13:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: request on Native SQL Insert statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904006#M377045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone help me to insert records into another database using native sql&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already know about this query of using native sql to insert one record, but i need to do almost 100 records&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL. &lt;/P&gt;&lt;P&gt;INSERT INTO AVERI_CLNT (CLIENT, ARG1, ARG2, ARG3) &lt;/P&gt;&lt;P&gt;VALUES ('000', 9, 2, 47) &lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2007 02:28:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904006#M377045</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-12T02:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: request on Native SQL Insert statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904007#M377046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;"Native SQL Statements in ABAP Programs&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;EXEC SQL [PERFORMING &amp;lt;form&amp;gt;].
  &amp;lt;Native SQL statement&amp;gt;
ENDEXEC&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Native SQL statements, the data is transported between the database table and the ABAP program using host variables. These are declared in the ABAP program, and preceded in the Native SQL statement by a colon (:). You can use elementary structures as host variables. Exceptionally, structures in an INTO clause are treated as though all of their fields were listed individually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the selection in a Native SQL SELECT statement is a table, you can pass it to ABAP line by line using the PERFORMING addition. The program calls a subroutine &amp;lt;form&amp;gt; for each line read. You can process the data further within the subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As in Open SQL, after the ENDEXEC statement, SY-DBCNT contains the number of lines processed. In nearly all cases, SY-SUBRC contains the value 0 after the ENDEXEC statement. Cursor operations form an exception: After FETCH, SY-SUBRC is 4 if no more records could be read. This also applies when you read a result set using EXEC SQL PERFORMING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT Zdemo_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;The system displays the following information:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program uses the work area WA and the field C1 in the Native SQL SELECT statement. WA is the target area into which the selected data is written. The structure WA in the INTO clause is treated as though its components were all listed individually. INTO :WA-CONNID, :WA-CITYFROM, :WA-CITYTO. C1 is used in the WHERE clause. The subroutine LOOP_OUTPUT writes the data from WA to the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward  points if it is usefull ...&lt;/P&gt;&lt;P&gt;Girish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2007 06:48:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/request-on-native-sql-insert-statement/m-p/1904007#M377046</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-12T06:48:14Z</dc:date>
    </item>
  </channel>
</rss>

