<?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 INTERNAL AS NUMBER in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083035#M1180437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for you attention, I solved the problem with two table internal that I used:&lt;/P&gt;&lt;P&gt;Post the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: N LIKE SY-INDEX.
  READ TABLE I_OBJECTS INDEX TC1-CURRENT_LINE.
    IF SY-SUBRC EQ 0.
      IF I_OBJECTS-NAME CP 'I*'.
         N = I_OBJECTS-NAME+1(2).
         READ TABLE OLD_SELECTIONS INDEX N.
         MOVE OLD_SELECTIONS-FIELD TO NAME.
         MOVE I_OBJECTS-OBLI TO OBLI.
         MOVE I_OBJECTS-INVISIBLE TO INVISIBLE.
      ELSE.
        EXIT FROM STEP-LOOP.
      ENDIF.
   ELSE.
        EXIT FROM STEP-LOOP.
   ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cordial greetings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jan 2009 11:07:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-28T11:07:36Z</dc:date>
    <item>
      <title>SORT TABLE INTERNAL AS NUMBER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083031#M1180433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want sort my table internal as number, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the field name with the content:+&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I1&lt;/P&gt;&lt;P&gt;I10&lt;/P&gt;&lt;P&gt;I3&lt;/P&gt;&lt;P&gt;I4&lt;/P&gt;&lt;P&gt;I5&lt;/P&gt;&lt;P&gt;I6&lt;/P&gt;&lt;P&gt;I7&lt;/P&gt;&lt;P&gt;I8&lt;/P&gt;&lt;P&gt;I9&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And when I used the next code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT I_OBJECTS BY NAME AS TEXT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is sort equal and I want obtain the next:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I1&lt;/P&gt;&lt;P&gt;I2&lt;/P&gt;&lt;P&gt;I3&lt;/P&gt;&lt;P&gt;I4&lt;/P&gt;&lt;P&gt;I5&lt;/P&gt;&lt;P&gt;I6&lt;/P&gt;&lt;P&gt;I7&lt;/P&gt;&lt;P&gt;I8&lt;/P&gt;&lt;P&gt;I9&lt;/P&gt;&lt;P&gt;I10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me, please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cordial greetings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2009 17:43:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083031#M1180433</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-27T17:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: SORT TABLE INTERNAL AS NUMBER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083032#M1180434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've never done so, but in reading the help for SORT, it mentions the following.  You might see if you can get this to work for you.  You have to be on a later version of SAP, though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Addition 5&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;... BY (otab)&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Effect:&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;With the addition BY (otab), the table is not sorted according to the table key, but instead according to the component specified dynamically in the internal table otab (as of release 7.0). Each line of the table otab defined a component of the sort key. The priority of the sort is based on the order of the lines in otab. A maximum of 250 components can be specified. If the table otab is initial, the table is not sorted.&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For otab, a standard table of the table type ABAP_SORTORDER_TAB from the ABAP Dictionary must be specified. The line type of this table is the Dictionary structure ABAP_SORTORDER with the following components:&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;*NAME of type SSTRING&lt;/EM&gt;* &lt;/P&gt;&lt;P&gt;&lt;EM&gt;for specifying a component of the sort key. The component is entered in the form "comp_name[&lt;/EM&gt;off(len)]", whereby "comp_name" must be the name of a component contained in itab in upper case to which an offset/length specification "&lt;EM&gt;off(len)" can be appended. "off" and "len" must be suitable numeric values.&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DESCENDING of type CHAR of length 1 for specifying the&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;sort direction for the current component. If DESCENDING is initial, the sort is performed in ascending order. If DESCENDING has the value "X", the table is sorted in descending order.&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ASTEXT of type CHAR of length 1&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;for textual sorting of the current component. If ASTEXT has the value "X", the sort is performed as with the AS TEXT addition. This is only possible for character-type components. If ASTEXT is initial, character-type components are sorted according to their binary representation.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2009 17:53:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083032#M1180434</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-27T17:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: SORT TABLE INTERNAL AS NUMBER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083033#M1180435</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 think u need to insert a new field (a numeric field) in order to sort the table, the problem is NAME is char field so it'll be sorted as char and not as numeric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I think u need to create a numeric field where u insert the numeric part of field name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: max bianchi on Jan 27, 2009 6:58 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2009 17:58:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083033#M1180435</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-27T17:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: SORT TABLE INTERNAL AS NUMBER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083034#M1180436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;tried to implement bubble sort. not sure if it will work but after some refinement it will work so just give it a try.&lt;/P&gt;&lt;P&gt;describe I_OBJECTS into v_lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at I_OBJECTS  into wa.&lt;/P&gt;&lt;P&gt;v_idx = sy-tabix - 1.&lt;/P&gt;&lt;P&gt;small = wa-name+1(1).&lt;/P&gt;&lt;P&gt;do v_idx times.&lt;/P&gt;&lt;P&gt;read table i_objects into wa1 index v_idx.&lt;/P&gt;&lt;P&gt;var = wa1-name1+1(1).&lt;/P&gt;&lt;P&gt;if var &amp;lt; small.&lt;/P&gt;&lt;P&gt;small = wa1-name+1(1).&lt;/P&gt;&lt;P&gt;temp = wa1.&lt;/P&gt;&lt;P&gt;wa1 = wa.&lt;/P&gt;&lt;P&gt;wa = temp.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;v_idx = v_idx + 1.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="16" __jive_macro_name="size"&gt;кu03B1ятu03B9к&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2009 18:08:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083034#M1180436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-27T18:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: SORT TABLE INTERNAL AS NUMBER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083035#M1180437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for you attention, I solved the problem with two table internal that I used:&lt;/P&gt;&lt;P&gt;Post the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: N LIKE SY-INDEX.
  READ TABLE I_OBJECTS INDEX TC1-CURRENT_LINE.
    IF SY-SUBRC EQ 0.
      IF I_OBJECTS-NAME CP 'I*'.
         N = I_OBJECTS-NAME+1(2).
         READ TABLE OLD_SELECTIONS INDEX N.
         MOVE OLD_SELECTIONS-FIELD TO NAME.
         MOVE I_OBJECTS-OBLI TO OBLI.
         MOVE I_OBJECTS-INVISIBLE TO INVISIBLE.
      ELSE.
        EXIT FROM STEP-LOOP.
      ENDIF.
   ELSE.
        EXIT FROM STEP-LOOP.
   ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cordial greetings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2009 11:07:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-table-internal-as-number/m-p/5083035#M1180437</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-28T11:07:36Z</dc:date>
    </item>
  </channel>
</rss>

