<?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: Sort internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569912#M586727</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your statement sorts the ITAB by all the fields in the internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Aug 2007 07:24:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-01T07:24:29Z</dc:date>
    <item>
      <title>Sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569906#M586721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly help very very urgent if i give sort itab(internal table) without mentioning fields in what basis the internal table will get sorted please very urgent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Also, tell me the case when the table from which it is fetched doesn't contain any key fields)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 12:20:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569906#M586721</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T12:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569907#M586722</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;SORT itab. &lt;/P&gt;&lt;P&gt;The entries in the internal table are sorted in ascending order using the key from the table definition (DATA, TYPES). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 12:40:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569907#M586722</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T12:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569908#M586723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Madhangi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP does not appreciate sort by table without giving any field name specifically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because main purpose of sorting is reading this table later in program using binary search. if you are not giving any field name; if you are selecting with key fields then it will sort by key fields otherwise it will choose arbitarly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Krishnendu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 12:51:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569908#M586723</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T12:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569909#M586724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the help for SORT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sort order depends on the sequence of the standard key fields in the internal table. The default key is made up of the non-numeric fields of the table line in the order in which they occur. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 14:02:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569909#M586724</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T14:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569910#M586725</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;You can sort a standard or hashed table in a program. To sort a table by its key, use the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT &amp;lt;itab&amp;gt; [ASCENDING|DESCENDING] [AS TEXT] [STABLE].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement sorts the internal table &amp;lt;itab&amp;gt; in ascending order by its key. The statement always applies to the table itself, not to the header line. The sort order depends on the sequence of the standard key fields in the internal table. The default key is made up of the non-numeric fields of the table line in the order in which they occur. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can specify the direction of the sort using the additions ASCENDING and DESCENDING. &amp;lt;b&amp;gt;The default is ascending.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&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>Tue, 31 Jul 2007 14:20:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569910#M586725</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T14:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569911#M586726</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;Plz check the code below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data:  begin of itab occurs 0,
         f1(10) type c,
         f2(10) type c,
       end of itab.

itab-f1 = '3'.
itab-f2 = 'S'.
append itab.

itab-f1 = '2'.
itab-f2 = 'T'.
append itab.

itab-f1 = '4'.
itab-f2 = 'S'.
append itab.

itab-f1 = '4'.
itab-f2 = 'P'.
append itab.

itab-f1 = '2'.
itab-f2 = 'S'.
append itab.

loop at itab.
  write:/ itab-f1, itab-f2.
endloop.

sort itab.

skip.
write:/ 'Sorted'.
loop at itab.
  write:/ itab-f1, itab-f2.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get from the code that.. if u dont specify fields for sorting then SORT staement sort the itab by all the fields ranging from first field to last field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output of the above code is :&lt;/P&gt;&lt;P&gt;3          S&lt;/P&gt;&lt;P&gt;2          T&lt;/P&gt;&lt;P&gt;4          S&lt;/P&gt;&lt;P&gt;4          P&lt;/P&gt;&lt;P&gt;2          S&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorted&lt;/P&gt;&lt;P&gt;2          S&lt;/P&gt;&lt;P&gt;2          T&lt;/P&gt;&lt;P&gt;3          S&lt;/P&gt;&lt;P&gt;4          P&lt;/P&gt;&lt;P&gt;4          S&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Prax&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 14:50:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569911#M586726</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T14:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569912#M586727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your statement sorts the ITAB by all the fields in the internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2007 07:24:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569912#M586727</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-01T07:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569913#M586728</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;            Sorts the table in Ascending order. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br, &lt;/P&gt;&lt;P&gt;Laxmi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2007 07:32:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table/m-p/2569913#M586728</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-01T07:32:28Z</dc:date>
    </item>
  </channel>
</rss>

