<?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: Problem with SQL Statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397613#M533824</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am confused by what you have told me as I am already using SELECT DISTINCT...ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2007 09:35:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-06T09:35:31Z</dc:date>
    <item>
      <title>Problem with SQL Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397611#M533822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I currently have the following code which returns no data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF i_test,
          vbeln LIKE vbak-vbeln,
       END OF i_test.

DATA: test TYPE STANDARD TABLE OF i_test
                WITH HEADER LINE
                WITH NON-UNIQUE KEY vbeln.

SELECT DISTINCT vbeln
  INTO CORRESPONDING FIELDS OF test
  FROM vbak
  WHERE bstnk LIKE '05.06.2007%'.
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But when I create an SQVI query with the same criteria I get 12 sale documents (I enter 05.06.2007* into the bstnk field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know what I am doing wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 09:24:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397611#M533822</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T09:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SQL Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397612#M533823</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 read a several entries from the database, use the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT [DISTINCT] &amp;lt;cols&amp;gt; ... WHERE ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do not use DISTINCT (&amp;lt;lines&amp;gt; is then empty), the system reads all of the lines that satisfy the WHERE condition. If you use DISTINCT, the system excludes duplicate entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result of the selection is a table. The target area of the INTO clause can be an internal table with a line type appropriate for &amp;lt;cols&amp;gt;. If the target area is not an internal table, but a flat structure, you must include an ENDSELECT statement after the SELECT statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT (vbeln)&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF test&lt;/P&gt;&lt;P&gt;  FROM vbak&lt;/P&gt;&lt;P&gt;  WHERE bstnk LIKE '05.06.2007%'.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 09:30:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397612#M533823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T09:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SQL Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397613#M533824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am confused by what you have told me as I am already using SELECT DISTINCT...ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 09:35:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397613#M533824</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T09:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SQL Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397614#M533825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try &lt;/P&gt;&lt;P&gt;SELECT DISTINCT vbeln&lt;/P&gt;&lt;P&gt;  INTO  &amp;lt;i&amp;gt;TABLE&amp;lt;/i&amp;gt; test&lt;/P&gt;&lt;P&gt;  FROM vbak&lt;/P&gt;&lt;P&gt;  WHERE bstnk LIKE '05.06.2007%'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As written your code is filling the internal table header, but not moving the data to the table body.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 09:42:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397614#M533825</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T09:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SQL Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397615#M533826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;In the where condition you specied  '05.06.2007%'. in the selects % means it will take all the charecters after the 05.06.2007. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lets say, if there is any entry with 05.06.2007A, then it will consider as a entry in the select statment,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and also use the () with the DESTICT statment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 09:42:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-sql-statement/m-p/2397615#M533826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T09:42:33Z</dc:date>
    </item>
  </channel>
</rss>

