<?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: itab and sorting efficiency in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753550#M326633</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do the following steps&lt;/P&gt;&lt;P&gt;1) create a standard itab with only the date field.&lt;/P&gt;&lt;P&gt;2) select all the records for that date field into the itab.&lt;/P&gt;&lt;P&gt;3)Sort them&lt;/P&gt;&lt;P&gt;4)remove duplicates using the keyword DELETE ADJACENT DUPLICATES FROM &amp;lt;itab&amp;gt; COMPARING &amp;lt;date(field)&amp;gt; &lt;/P&gt;&lt;P&gt;5)read itab with index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Dec 2006 07:54:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-27T07:54:23Z</dc:date>
    <item>
      <title>itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753549#M326632</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;I only want the earliest date of a date field (non unique) in the database table...&lt;/P&gt;&lt;P&gt;my way of doing... &lt;/P&gt;&lt;P&gt;1) create a standard itab with only the date field.&lt;/P&gt;&lt;P&gt;2) select all the records for that date field into the itab.&lt;/P&gt;&lt;P&gt;3) collect into another standard itab with same structure to remove duplicates.&lt;/P&gt;&lt;P&gt;4) sort the itab in acsending.&lt;/P&gt;&lt;P&gt;5) read from the itab with index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any other better ways in terms of performance or code efficiency?&lt;/P&gt;&lt;P&gt;if i do the sort in the select statement (eg. order by), it would be slower right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Charles&lt;/P&gt;&lt;P&gt;abap newbie &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 07:17:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753549#M326632</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-27T07:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753550#M326633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do the following steps&lt;/P&gt;&lt;P&gt;1) create a standard itab with only the date field.&lt;/P&gt;&lt;P&gt;2) select all the records for that date field into the itab.&lt;/P&gt;&lt;P&gt;3)Sort them&lt;/P&gt;&lt;P&gt;4)remove duplicates using the keyword DELETE ADJACENT DUPLICATES FROM &amp;lt;itab&amp;gt; COMPARING &amp;lt;date(field)&amp;gt; &lt;/P&gt;&lt;P&gt;5)read itab with index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 07:54:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753550#M326633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-27T07:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753551#M326634</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;select min (dat) from db into variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 07:57:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753551#M326634</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2006-12-27T07:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753552#M326635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;wont that cause performance issues?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because that is done at db level... &amp;amp; not at program level...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 08:13:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753552#M326635</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-27T08:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753553#M326636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I thought doing a collect is better than doing a delete adjacent duplicates...?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 08:14:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753553#M326636</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-27T08:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753554#M326637</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;Just use SE30 to analyze performance for the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 08:16:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753554#M326637</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2006-12-27T08:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753555#M326638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It depends on the type of table you use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)With a COLLECT for standard tables, a hash function is created internally. Using this hash function results in good performance. The hash function for standard tables is, however, non-persistent, since it is destroyed by each INSERT, DELETE, and so on; after which performance is reduced with a COLLECT all fields that are not part of the key must have a numeric type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)With the COLLECT statement, the contents of the work area is added to an entry with the same key or added to the table as a new entry. This allows you to create aggregated internal tables, thereby reducing data volume.COLLECT searches in the internal table for a data record according to the table type and defined key. If it finds an entry in the table, it adds all numeric fields of the work area or header that are not part of the key to the corresponding fields of the entry. If no entry is found, the contents of the work area or header row are added as a new table entry.You can only use the COLLECT statement with internal tables whose non-key fields are all numeric (type I, P, or F). If not, you get a syntax error. From SAP Basis release 4.0A, the table key may contain numeric fields.&lt;/P&gt;&lt;P&gt;The COLLECT statement is internally optimized for standard tables so that the response time is constant. This optimization applies as long as the tables are not modified with DELETE, INSERT, or SORT (non-persistent hash function). Using the latter instructions loses the rapid internal access, and leads to linearly increasing access costs for the COLLECT.&lt;/P&gt;&lt;P&gt;3)With hashed and sorted tables, the cost of the COLLECT statement is constant, even if you use DELETE, INSERT or SORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the DELETE ADJACENT DUPLICATES the internal table should be sorted one before you write the statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 08:45:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753555#M326638</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-27T08:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753556#M326639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmmm... ok..&lt;/P&gt;&lt;P&gt;so in my case... i do a collect to another standard itab and do a sort after that...&lt;/P&gt;&lt;P&gt;that would destroy the performance of the intended collect...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so its better to do a sort then delete adj duplicates rather than collect..&lt;/P&gt;&lt;P&gt;am I right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Charles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 09:11:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753556#M326639</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-27T09:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: itab and sorting efficiency</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753557#M326640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Charles,&lt;/P&gt;&lt;P&gt; Actually Collect has a different usage from deleting the duplicates.&lt;/P&gt;&lt;P&gt;like if original table has&lt;/P&gt;&lt;P&gt;abc 20.0&lt;/P&gt;&lt;P&gt;abc 40.0&lt;/P&gt;&lt;P&gt;def 50.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after collect,&lt;/P&gt;&lt;P&gt;it would be&lt;/P&gt;&lt;P&gt;abc 60.0&lt;/P&gt;&lt;P&gt;def 50.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after delete adjacent duplicates, it would look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abc 20.0&lt;/P&gt;&lt;P&gt;def 50.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2006 09:15:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-and-sorting-efficiency/m-p/1753557#M326640</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-27T09:15:43Z</dc:date>
    </item>
  </channel>
</rss>

