<?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 the Internal table by 3 fields. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675646#M1668743</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;On the Selection screen i have 3 parameter fields of 1 character. And i need to sort the final output table with these 3 fields. The scenario will be like...the user will be putting the 1 to 3 numbers in these fields randomly.&amp;nbsp; For e.g, if the user puts the entry for field 1 as 1, for field 2 as 2, and for field 3 as 3 in the three fields on selection screen, then i need to sort the output table in the order as: Sort ITAB by 1 2 3.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;So now i want to know if the the user puts the values randomly on the selection screen..how to capture the values from the selection screen and sort the internal table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;Thanks &amp;amp; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;Santosh.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Apr 2012 18:29:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-04-05T18:29:26Z</dc:date>
    <item>
      <title>Sorting the Internal table by 3 fields.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675646#M1668743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;On the Selection screen i have 3 parameter fields of 1 character. And i need to sort the final output table with these 3 fields. The scenario will be like...the user will be putting the 1 to 3 numbers in these fields randomly.&amp;nbsp; For e.g, if the user puts the entry for field 1 as 1, for field 2 as 2, and for field 3 as 3 in the three fields on selection screen, then i need to sort the output table in the order as: Sort ITAB by 1 2 3.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;So now i want to know if the the user puts the values randomly on the selection screen..how to capture the values from the selection screen and sort the internal table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;Thanks &amp;amp; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: comic sans ms,sans-serif;"&gt;Santosh.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 18:29:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675646#M1668743</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-05T18:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting the Internal table by 3 fields.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675647#M1668744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;I guess you can use the table addition with your sort statement:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;DATA: otab&amp;nbsp; TYPE abap_sortorder_tab, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oline TYPE abap_sortorder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;oline-name = p1. &lt;/P&gt;&lt;P&gt;APPEND oline TO otab.&lt;/P&gt;&lt;P&gt;oline-name = p2. &lt;/P&gt;&lt;P&gt;APPEND oline TO otab.&lt;/P&gt;&lt;P&gt;oline-name = p3. &lt;/P&gt;&lt;P&gt;APPEND oline TO otab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;TRY. &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SORT itab BY (otab). &lt;BR /&gt;&amp;nbsp; CATCH cx_sy_dyn_table_ill_comp_val. &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MESSAGE 'Wrong column name!' TYPE 'I' DISPLAY LIKE 'E'. &lt;BR /&gt;ENDTRY. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I would have used a select-option field instead to hold the fields name...&lt;/P&gt;&lt;P&gt;Or maybe I did not understood properly your request?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 20:04:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675647#M1668744</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-05T20:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting the Internal table by 3 fields.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675648#M1668745</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;You can use the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab by (otab).&lt;/P&gt;&lt;P&gt;otab will have the selection screen fields according to user specification.Find the order in the program and populate otab accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Archna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 22:02:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675648#M1668745</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-05T22:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting the Internal table by 3 fields.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675649#M1668746</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;It seems you have not seen the F1 help for SORT statement. Check SORT itab. You shall get a very good example given by SAP on how to sort an internal table using &lt;STRONG&gt;BY OTAB&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Danish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2012 07:34:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-the-internal-table-by-3-fields/m-p/8675649#M1668746</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-06T07:34:02Z</dc:date>
    </item>
  </channel>
</rss>

