<?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 a column with a different format in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048425#M1501674</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it is a complicated process i think.&lt;/P&gt;&lt;P&gt;you need to split string at - into two variables .&lt;/P&gt;&lt;P&gt;convert the second variable into number and sort them and again append them to first variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bal Duvvuri&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jul 2010 09:58:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-07-28T09:58:51Z</dc:date>
    <item>
      <title>Sort a column with a different format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048422#M1501671</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 need to sort entries of a particular format in ascending order. The entires are:&lt;/P&gt;&lt;P&gt;ABCD290710-0,  ABCD290710-1,  ABCD290710-10,  ABCD290710-11,  ABCD290710-2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the Sort command, I get&lt;/P&gt;&lt;P&gt;ABCD290710-0&lt;/P&gt;&lt;P&gt;ABCD290710-1&lt;/P&gt;&lt;P&gt;ABCD290710-10&lt;/P&gt;&lt;P&gt;ABCD290710-11&lt;/P&gt;&lt;P&gt;ABCD290710-2 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I require is &lt;/P&gt;&lt;P&gt;ABCD290710-0&lt;/P&gt;&lt;P&gt;ABCD290710-1&lt;/P&gt;&lt;P&gt;ABCD290710-2&lt;/P&gt;&lt;P&gt;ABCD290710-10&lt;/P&gt;&lt;P&gt;ABCD290710-11&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you pelase tell em a simple way to achieve this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jul 2010 09:34:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048422#M1501671</guid>
      <dc:creator>preethi_santhanam</dc:creator>
      <dc:date>2010-07-28T09:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column with a different format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048423#M1501672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is how it behaves because it considers it as a  string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bala Duvvuri&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jul 2010 09:41:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048423#M1501672</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-28T09:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column with a different format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048424#M1501673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bala,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I understand that the behaviour is correct as it considers it as a string, but is there any way, through which I can get my desired results?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jul 2010 09:52:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048424#M1501673</guid>
      <dc:creator>preethi_santhanam</dc:creator>
      <dc:date>2010-07-28T09:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column with a different format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048425#M1501674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it is a complicated process i think.&lt;/P&gt;&lt;P&gt;you need to split string at - into two variables .&lt;/P&gt;&lt;P&gt;convert the second variable into number and sort them and again append them to first variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bal Duvvuri&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jul 2010 09:58:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048425#M1501674</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-28T09:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column with a different format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048426#M1501675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bala,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for this approach. However, these numbers are a part of a column in alv. So, the process would get really too long.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 05:33:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048426#M1501675</guid>
      <dc:creator>preethi_santhanam</dc:creator>
      <dc:date>2010-07-29T05:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column with a different format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048427#M1501676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Spree,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think we can not sort list you your requirement because SAP treats your records as string. &lt;SPAN __jive_macro_name="user" id="3688082"&gt;&lt;/SPAN&gt; has provided an alternative solutions for that, maybe you can create another ALV column and mark it as &lt;STRONG&gt;hidden&lt;/STRONG&gt;. You can sort data by this column before show the result. I dont think the process would take too long performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you find another solution, post here for us to reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 05:46:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048427#M1501676</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-29T05:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column with a different format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048428#M1501677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&amp;lt;div style="text-align:left!important"&amp;gt;I understand that the behaviour is correct as it considers it as a string, but is there any way, through which I can get my desired results?&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In other programming languages we'd probably have some function/method that we can provide to the sort command to achieve our custom sort. E.g. in Java the interface [java.util.Comparator|http://java.sun.com/javase/6/docs/api/java/util/Comparator.html] could be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in ABAP we don't have that freedom. At best we could specify a locale to do a more textual type comparison (instead of the default byte code comparison done in strings, see addition [sort - as text|http://help.sap.com/abapdocu_70/en/ABAPSORT_ITAB.htm#!ABAP_ADDITION_3@3@]). Fiddling with offsets doesn't help, because we won't be able to get around the fact that you have still a string (but would like a numeric comparison).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your requirement is integration with ALV, no additional column to use for sorting and output should remain as is, I'd consider using a custom [conversion exit|http://help.sap.com/abapdocu_70/en/ABENCONVERSION_EXITS.htm] for your field (i.e. define a corresponding data element/domain and utilize it). That's exactly what SAP does with conversion exit ALPHA, where any numbers are prefixed with leading zeros to allow a numeric comparison. However, since your case is special (and tries to combine string/numeric attributes in one field), you'd have to do that yourself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should you choose to go down that path, I'd make sure though, that the data format is fixed and should never change (obviously your conversion exit would need some restrictive assumptions which part is considered string and which part is considered number).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have no requirement to retain the existing data format, then it would probably best to store the data differently (or manipulate them while filling your internal table for the ALV), by adding the required 0-prefixes. E.g.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ABCD290710-00
ABCD290710-01
ABCD290710-10
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Cheers, harald&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p.s.: Introducing another (hidden) column is in my opinion problematic, because one would need to hook into the sort requests and automatically translate the specific field to the hidden field when doing the sort. Might be possible, but I don't think that's an easy solution (and would have to be done wherever that field is used, so possibly in multiple reports).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 06:38:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048428#M1501677</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-29T06:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column with a different format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048429#M1501678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your help. The issue is now solved.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 07:29:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-a-column-with-a-different-format/m-p/7048429#M1501678</guid>
      <dc:creator>preethi_santhanam</dc:creator>
      <dc:date>2010-07-29T07:29:06Z</dc:date>
    </item>
  </channel>
</rss>

