<?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 internal table by text in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742530#M35490</link>
    <description>&lt;P&gt;You have to develop your own logic to obtain it, since there is not built-in function you can use: sorting works alphanumeric.&lt;/P&gt;&lt;P&gt;A rough approach&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;set_sort( USING it_origin = your_internal_table
i_value   = 'inhouse'
  changing out_tab = final_table ).

set_sort( USING it_origin = your_internal_table
i_value   = 'bought_out'
  changing out_tab = final_table ).
set_sort( USING it_origin = your_internal_table
i_value   = 'inter.plt'
  changing out_tab = final_table ).
set_sort( USING it_origin = your_internal_table
i_value   = 'subcount'
  changing out_tab = final_table ). 
your_internal_table = final_table. "you can avoid it if you use final_Table
.....
.....

METHOD set_sort.
LOOP AT it_origin INTO DATA(orign) WHERE bwart = i_value.
APPEND origin TO out_tab.
ENDLOOP.
ENDMETHOD.&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 Dec 2018 11:53:03 GMT</pubDate>
    <dc:creator>SimoneMilesi</dc:creator>
    <dc:date>2018-12-06T11:53:03Z</dc:date>
    <item>
      <title>sort internal table by text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742529#M35489</link>
      <description>&lt;P&gt;in my inetrnal table there is a field bwart(valuation type) in that there is four types&lt;/P&gt;
  &lt;P&gt; 1)bought_out &lt;/P&gt;
  &lt;P&gt;2)inhouse 3)inter.plt 4)subcount&lt;/P&gt;
  &lt;P&gt;i want to sort like this - &lt;/P&gt;
  &lt;P&gt;1)inhouse &lt;/P&gt;
  &lt;P&gt;2)bought_out&lt;/P&gt;
  &lt;P&gt;3)inter.plt &lt;/P&gt;
  &lt;P&gt;4)subcount&lt;/P&gt;
  &lt;P&gt;please help....&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 11:24:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742529#M35489</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-12-06T11:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: sort internal table by text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742530#M35490</link>
      <description>&lt;P&gt;You have to develop your own logic to obtain it, since there is not built-in function you can use: sorting works alphanumeric.&lt;/P&gt;&lt;P&gt;A rough approach&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;set_sort( USING it_origin = your_internal_table
i_value   = 'inhouse'
  changing out_tab = final_table ).

set_sort( USING it_origin = your_internal_table
i_value   = 'bought_out'
  changing out_tab = final_table ).
set_sort( USING it_origin = your_internal_table
i_value   = 'inter.plt'
  changing out_tab = final_table ).
set_sort( USING it_origin = your_internal_table
i_value   = 'subcount'
  changing out_tab = final_table ). 
your_internal_table = final_table. "you can avoid it if you use final_Table
.....
.....

METHOD set_sort.
LOOP AT it_origin INTO DATA(orign) WHERE bwart = i_value.
APPEND origin TO out_tab.
ENDLOOP.
ENDMETHOD.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Dec 2018 11:53:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742530#M35490</guid>
      <dc:creator>SimoneMilesi</dc:creator>
      <dc:date>2018-12-06T11:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: sort internal table by text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742531#M35491</link>
      <description>&lt;P&gt;Another option is to add an extra field to your internal table that you fill according to the bwart field and use that to sort instead.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 12:12:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742531#M35491</guid>
      <dc:creator>ArthurParisius</dc:creator>
      <dc:date>2018-12-06T12:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: sort internal table by text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742532#M35492</link>
      <description>&lt;P&gt;Arthur's is the easiest, but if you're a dedicated masochist, you could just implement the QuickSort algorithm - widely available on the internet.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 15:43:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-internal-table-by-text/m-p/742532#M35492</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2018-12-06T15:43:53Z</dc:date>
    </item>
  </channel>
</rss>

