<?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 sub queries in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sub-queries/m-p/3610751#M869792</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to use netive SQL sub queries in ABAP?? Give some example.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Mar 2008 12:23:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-17T12:23:33Z</dc:date>
    <item>
      <title>sub queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sub-queries/m-p/3610751#M869792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to use netive SQL sub queries in ABAP?? Give some example.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 12:23:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sub-queries/m-p/3610751#M869792</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T12:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: sub queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sub-queries/m-p/3610752#M869793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&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;P&gt;&lt;STRONG&gt;EXEC SQL [PERFORMING &amp;lt;form&amp;gt;].&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;&amp;lt;Native SQL statement&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDEXEC.&lt;/STRONG&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;&lt;STRONG&gt;Please reward points if useful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Rose&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 12:31:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sub-queries/m-p/3610752#M869793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T12:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: sub queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sub-queries/m-p/3610753#M869794</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;Use the following example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_native_sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF wa,&lt;/P&gt;&lt;P&gt;        connid   TYPE spfli-connid,&lt;/P&gt;&lt;P&gt;        cityfrom TYPE spfli-cityfrom,&lt;/P&gt;&lt;P&gt;        cityto   TYPE spfli-cityto,&lt;/P&gt;&lt;P&gt;      END OF wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA c1 TYPE spfli-carrid VALUE 'LH'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL PERFORMING loop_output.&lt;/P&gt;&lt;P&gt;  SELECT connid, cityfrom, cityto&lt;/P&gt;&lt;P&gt;  INTO   :wa&lt;/P&gt;&lt;P&gt;  FROM   spfli&lt;/P&gt;&lt;P&gt;  WHERE  carrid = :c1&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM loop_output.&lt;/P&gt;&lt;P&gt;  WRITE: / wa-connid, wa-cityfrom, wa-cityto.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0400    FRANKFURT    NEW YORK&lt;/P&gt;&lt;P&gt;2402    FRANKFURT    BERLIN&lt;/P&gt;&lt;P&gt;0402    FRANKFURT    NEW YORK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The work area wa and the field c1 Native SQL statement SELECT are used. wa is the target area into which the selected data is written. As a structure, wa is handled in the INTO clause as if all subfields were 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 list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also look at this link,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Native SQL|http://help.sap.com/saphelp_nw04s/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&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;Dhruv Shah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 12:32:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sub-queries/m-p/3610753#M869794</guid>
      <dc:creator>dhruv_shah3</dc:creator>
      <dc:date>2008-03-17T12:32:17Z</dc:date>
    </item>
  </channel>
</rss>

