<?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: sorting issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418267#M201030</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am retrieving data from ztable and in z table this field is declared as char type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any solution for this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 22 Jul 2006 22:33:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-07-22T22:33:03Z</dc:date>
    <item>
      <title>sorting issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418264#M201027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have values like this &lt;/P&gt;&lt;P&gt;4421&lt;/P&gt;&lt;P&gt;4413&lt;/P&gt;&lt;P&gt;2121&lt;/P&gt;&lt;P&gt;221&lt;/P&gt;&lt;P&gt;54&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;544&lt;/P&gt;&lt;P&gt;4343&lt;/P&gt;&lt;P&gt;21&lt;/P&gt;&lt;P&gt;2112&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i sort this i am getting the output as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;21&lt;/P&gt;&lt;P&gt;2112&lt;/P&gt;&lt;P&gt;2121&lt;/P&gt;&lt;P&gt;221&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;4343&lt;/P&gt;&lt;P&gt;4413&lt;/P&gt;&lt;P&gt;4421&lt;/P&gt;&lt;P&gt;54&lt;/P&gt;&lt;P&gt;544&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its sorting only based on the  first digit .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone have an idea about this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Jul 2006 21:45:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418264#M201027</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-22T21:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: sorting issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418265#M201028</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;what is the field type which stores these values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.if it is character field ,the sort works by comparing from the first character onwords . &lt;/P&gt;&lt;P&gt;2.if you are using sort with text option , it works same way like character fields.&lt;/P&gt;&lt;P&gt;3.if you are not mentioned any sort key , then 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;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Appana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Jul 2006 22:06:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418265#M201028</guid>
      <dc:creator>Laxmana_Appana_</dc:creator>
      <dc:date>2006-07-22T22:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: sorting issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418266#M201029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use: type i and sort itab by that &amp;lt;column&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT zsam.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;          my_num type i,&lt;/P&gt;&lt;P&gt;       end of itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       itab-my_num = 4421 . append itab .&lt;/P&gt;&lt;P&gt;       itab-my_num = 4413 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 2121 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 221 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 54 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 66 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 544 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 4343 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 21 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 2112 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 66 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 23 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 123 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 123 . append itab.&lt;/P&gt;&lt;P&gt;        itab-my_num = 123 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 123 . append itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab by my_num .&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  write:/ itab-my_num .&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Jul 2006 22:21:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418266#M201029</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-22T22:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: sorting issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418267#M201030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am retrieving data from ztable and in z table this field is declared as char type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any solution for this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Jul 2006 22:33:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418267#M201030</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-22T22:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: sorting issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418268#M201031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, since the data is stored as character,  you need to convert it to a numeric field in your internal table in order to sort correctly.  You could also change the data type in your "Z" table to a numeric data type, then the value will already be stored as a numeric, then the sorting will work without conversion.  A quick fix for this is to define another field in your internal table a type numeric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: begin of itab occurs 0.
      include structure ztable.
data: nfield(10) type n.  " Added numeric field
data: end of itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can get the data from your "Z" table into the ITAB.  Next loop at the iTAB and move the contents of the field to the numeric field that you have added to the structure and modify the itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at itab.
  itab-nfield = itab-cfield.
  modify itab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can sort by this numeric field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort itab ascending by nfield.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Jul 2006 22:41:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418268#M201031</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-07-22T22:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: sorting issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418269#M201032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;REPORT zsam.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;          my_num(20) type c,&lt;/P&gt;&lt;P&gt;       end of itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       itab-my_num = 4421 . append itab .&lt;/P&gt;&lt;P&gt;       itab-my_num = 4413 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 2121 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 221 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 54 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 66 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 544 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 4343 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 21 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 2112 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 66 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 23 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 123 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 123 . append itab.&lt;/P&gt;&lt;P&gt;        itab-my_num = 123 . append itab.&lt;/P&gt;&lt;P&gt;       itab-my_num = 123 . append itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab by my_num  .&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  write:/ itab-my_num .&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Jul 2006 22:51:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-issue/m-p/1418269#M201032</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-22T22:51:19Z</dc:date>
    </item>
  </channel>
</rss>

