<?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 sorting a table draw in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-a-table-draw/m-p/6793764#M1466313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need a small help on a logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table draw  which will have versions for document.The version will start from NC,A,B,C,D,E,F........J,K,L.........Q,R,S,T......X,Y,Z,AA,AB,AC,AD,AE..........AK,AL......AZ,BA,BB,BC.....BZ....so..on.&lt;/P&gt;&lt;P&gt;here the oldest version is NC and the latest version is BZ.Now, how can i write the logic such that i get the laterst version from this table.Sort descending is not working as, it is taking Z as the biggest.Kindly help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;Sakshi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Mar 2010 11:04:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-30T11:04:15Z</dc:date>
    <item>
      <title>sorting a table draw</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-a-table-draw/m-p/6793764#M1466313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need a small help on a logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table draw  which will have versions for document.The version will start from NC,A,B,C,D,E,F........J,K,L.........Q,R,S,T......X,Y,Z,AA,AB,AC,AD,AE..........AK,AL......AZ,BA,BB,BC.....BZ....so..on.&lt;/P&gt;&lt;P&gt;here the oldest version is NC and the latest version is BZ.Now, how can i write the logic such that i get the laterst version from this table.Sort descending is not working as, it is taking Z as the biggest.Kindly help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;Sakshi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Mar 2010 11:04:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-a-table-draw/m-p/6793764#M1466313</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-30T11:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: sorting a table draw</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-a-table-draw/m-p/6793765#M1466314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sakshi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use DRAW_LAST_CHANGE table and get the created time and date and sort the version based on these values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For log you can use the table DRAP and the fields DATUM &amp;amp; PZEIT fields will give the date and time the document got changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Srinath S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Mar 2010 11:37:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-a-table-draw/m-p/6793765#M1466314</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-30T11:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: sorting a table draw</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-a-table-draw/m-p/6793766#M1466315</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 have made some code to check if i can assign a rank to these versions . check if this works for you . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

TYPES: begin of TY_itab,
         f2 type i,
         f1(2) type c,
        end of TY_itab.

DATA : ITAB TYPE TABLE OF TY_ITAB WITH HEADER LINE,
       WA TYPE TY_ITAB.
field-symbols: &amp;lt;FS&amp;gt; TYPE TY_ITAB.


itab-f1 = 'NC'.  append itab. "Start
itab-f1 = 'A'.  append itab.  "First
itab-f1 = 'B'.  append itab.
itab-f1 = 'Z'.  append itab.   "End of first
itab-f1 = 'AA'.  append itab.
itab-f1 = 'AB'.  append itab.
itab-f1 = 'AZ'.  append itab.
itab-f1 = 'BA'.  append itab.
itab-f1 = 'BB'.  append itab.
itab-f1 = 'BZ'.  append itab.
itab-f1 = 'CA'.  append itab.


DELETE ITAB WHERE F1 IS INITIAL.
clear itab.
loop at itab assigning &amp;lt;FS&amp;gt; ."INTO  WA .
  IF &amp;lt;fs&amp;gt;-F1+1(1) EQ SPACE.

    CASE &amp;lt;fs&amp;gt;-f1.
      when 'A'.
        &amp;lt;FS&amp;gt;-f2 = '1'.
      when 'B'.
        &amp;lt;FS&amp;gt;-f2 = '2'.
      when 'Z'.
        &amp;lt;FS&amp;gt;-f2 = '26'. "WRITE &amp;lt;FS&amp;gt;-F1.
    endcase.
  ELSEIF &amp;lt;fs&amp;gt;-F1+1(1) NE SPACE.
* AA = Z + A = (26) + 1 = 27
    CASE &amp;lt;FS&amp;gt;-F1.
      when 'AA'.
        &amp;lt;FS&amp;gt;-f2 = '27'.
      when 'AB'.
        &amp;lt;FS&amp;gt;-f2 = '28'.

      when 'AZ'.
        &amp;lt;FS&amp;gt;-f2 = '42'.

      when 'BA'.
        &amp;lt;FS&amp;gt;-f2 = '43'.

      when 'BB'.
        &amp;lt;FS&amp;gt;-f2 = '44'.
*BZ = BB + 24
      when 'BZ'.
        &amp;lt;FS&amp;gt;-f2 = '68'.
*CA  = BZ + 1
      when 'CA'.
        &amp;lt;FS&amp;gt;-f2 = '69'.

      WHEN 'NC'.
        &amp;lt;FS&amp;gt;-f2 = '0'.
    ENDCASE.
  ENDIF.
endloop.


SORT ITAB BY F2 DESCENDING.
LOOP AT ITAB ASSIGNING &amp;lt;FS&amp;gt;.
  WRITE:/ 'Latest version is', &amp;lt;FS&amp;gt;-F2 .
  exit. "one time hit.
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can be simplified  to assign the rank by assigning ranges .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 09:01:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-a-table-draw/m-p/6793766#M1466315</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-31T09:01:28Z</dc:date>
    </item>
  </channel>
</rss>

