<?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 table field from type character in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219736#M1378886</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it's a custom table, consider changing the field into a numeric field. Or... read the contents into an internal table, move the field into a numeric field and look for the max value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Oct 2009 11:41:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-10-06T11:41:10Z</dc:date>
    <item>
      <title>Sort table field from type character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219734#M1378884</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 a database table where a specific field (e. g. ID) is specified as character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This field contains a number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to get the highest ID which is available in the database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement does not work, because the max value is only determined by the first character.&lt;/P&gt;&lt;P&gt;SELECT single * FROM &amp;lt;table&amp;gt;&lt;/P&gt;&lt;P&gt;  INTO &amp;lt;workarea&amp;gt;&lt;/P&gt;&lt;P&gt;  WHERE id = (&lt;/P&gt;&lt;P&gt;    SELECT MAX( id ) FROM &amp;lt;table&amp;gt;&lt;/P&gt;&lt;P&gt;  ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: Entries in database table&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The max value is here then 3 and not 10. -&amp;gt; only the first character will be checked&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2009 11:22:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219734#M1378884</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-06T11:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sort table field from type character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219735#M1378885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.. &lt;/P&gt;&lt;P&gt;just try this code once and let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single *&lt;/P&gt;&lt;P&gt;  from table&lt;/P&gt;&lt;P&gt;  into wa_area&lt;/P&gt;&lt;P&gt; where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt; ORDER BY MAX DESCENDING ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the best..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UR's&lt;/P&gt;&lt;P&gt;GSANA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2009 11:40:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219735#M1378885</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-06T11:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sort table field from type character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219736#M1378886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it's a custom table, consider changing the field into a numeric field. Or... read the contents into an internal table, move the field into a numeric field and look for the max value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2009 11:41:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219736#M1378886</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-06T11:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sort table field from type character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219737#M1378887</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;thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The coding does not work. Only the first character will be considered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We cannot change the type of the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2009 11:48:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219737#M1378887</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-06T11:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sort table field from type character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219738#M1378888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or... read the contents into an internal table, move the field into a numeric field and look for the max value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2009 11:51:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219738#M1378888</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-06T11:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sort table field from type character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219739#M1378889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the way I have realized it. But I thought there would be a better one!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2009 11:52:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219739#M1378889</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-06T11:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sort table field from type character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219740#M1378890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here matnr is a character data type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data matnr type matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select max( matnr ) from mara into matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: matnr.&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;Venkat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2009 11:59:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219740#M1378890</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-06T11:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sort table field from type character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219741#M1378891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hai,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Here matnr is a character data type.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; data matnr type matnr.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; select max( matnr ) from mara into matnr.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; write: matnr.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards,&lt;/P&gt;&lt;P&gt;&amp;gt; Venkat&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Never forget: if a materialno. consist of digits only, the database value will have leading zeroes. And then it will work. In this case there are no leading zeroes, so character 3 is bigger than 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there were leading zeroes, then 10 would be bigger then 03.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2009 12:02:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-field-from-type-character/m-p/6219741#M1378891</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-06T12:02:06Z</dc:date>
    </item>
  </channel>
</rss>

