<?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: sql-command on internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824886#M352044</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;&lt;/P&gt;&lt;P&gt;no, you must do sth like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab into itab2. 
 collect itab2.
endloop.

describe table itab2 lines sy-tfill.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Jan 2007 08:31:00 GMT</pubDate>
    <dc:creator>andreas_mann3</dc:creator>
    <dc:date>2007-01-22T08:31:00Z</dc:date>
    <item>
      <title>sql-command on internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824881#M352039</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;is it possible to perform sql-command on internal table as below&lt;/P&gt;&lt;P&gt;shown. If not, which alternatives are given.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT COUNT( DISTINCT kunnr ) from itab into table itab2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following situation: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table "itab" contains many datas with various custumers. I want&lt;/P&gt;&lt;P&gt;to collect the unique customernumber in another internal table e.x itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ilhan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:25:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824881#M352039</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-22T08:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: sql-command on internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824882#M352040</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;lt;b&amp;gt;No you cannot use those statements for internal table as SQL Commands are for database tables only ..&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:26:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824882#M352040</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-22T08:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: sql-command on internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824883#M352041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No it will not work. SELECT statement will not work on internal tables. It can be used only on database tables and views.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to SUM an internal table field, you will have to loop the table and then sum it up manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Manoj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:27:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824883#M352041</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-22T08:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: sql-command on internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824884#M352042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it should work....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not write this way...&lt;/P&gt;&lt;P&gt;SELECT DISTINCT kunnr from &amp;lt;database&amp;gt; into table itab2.&lt;/P&gt;&lt;P&gt;describe table itab2 lines v_lines.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:28:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824884#M352042</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-22T08:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: sql-command on internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824885#M352043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ilhan,&lt;/P&gt;&lt;P&gt;You cannot perform SQL commands on internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get the unique customers from an internal table like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA itab2 LIKE TABLE OF itab.
DATA v_cus TYPE i.

itab2[] = itab[].

SORT itab2 BY kunnr.

DELETE ADJACENT DUPLICATES FROM itab2 COMPARING kunnr.
"itab2 will have unique customers

DESCRIBE TABLE itab2 LINES v_cus.
"v_cus will have the count of unique customers.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Wenceslaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:29:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824885#M352043</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-22T08:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: sql-command on internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824886#M352044</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;&lt;/P&gt;&lt;P&gt;no, you must do sth like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab into itab2. 
 collect itab2.
endloop.

describe table itab2 lines sy-tfill.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:31:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-on-internal-table/m-p/1824886#M352044</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2007-01-22T08:31:00Z</dc:date>
    </item>
  </channel>
</rss>

