<?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: Issue on Sorting the itab in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432142#M1052082</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;assume that your table(itab) is full of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do such a thing,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create another internal table(itab2) as of same type with your itab including one more field, a field just one char length, assume it is &lt;STRONG&gt;sortfield&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab.

" RC,PE,TM,WP,SM,RM.......
if itab-zobject eq 'RC'.
   itab2-sortfield = 'A'.
elseif itab-zobject eq 'PE'.
  itab2-sortfield = 'B'.

....go on like this.

append itab to itab2.
endif.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort itab2 by sortfield.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course your main table is now itab2, display it.&lt;/P&gt;&lt;P&gt;Afterwards sort itab2 as above, if you do not want to display sortfield, you can do it through setting fieldcat properties.&lt;/P&gt;&lt;P&gt;This will sort your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;deniz.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Sep 2008 07:49:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-03T07:49:58Z</dc:date>
    <item>
      <title>Issue on Sorting the itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432138#M1052078</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 a requirment of sorting the internal table by one field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example  zobject having the value of TE,RM,WP,RC,QM,SM,PE ........etc like that.&lt;/P&gt;&lt;P&gt;but i want to sort the object in the below order only(based on the value of the particular field),&lt;/P&gt;&lt;P&gt;   RC,PE,TM,WP,SM,RM.......etc like that.&lt;/P&gt;&lt;P&gt;  so how to sort this as per my requirment,if any one have a idea please share with me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT gt_itab BY  zobject .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;With Regards,&lt;/P&gt;&lt;P&gt;Deesanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 06:13:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432138#M1052078</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T06:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Issue on Sorting the itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432139#M1052079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what do u mean by object. An internal table can be sorted if u give the name of the fields it contains. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex: itab contains field1,field2,field3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so - sort itab by field1 field2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this means it will be sorted first by field1 and second priority by field 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Varun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 06:46:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432139#M1052079</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T06:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issue on Sorting the itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432140#M1052080</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 am expecting the output of the filed object having many values,and that values should be display based on my sorting conditions,i want to sort by the values1 of the field only and not by filed 1,field 2,field3.&lt;/P&gt;&lt;P&gt;hope you understand my requirments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Deesanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 06:55:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432140#M1052080</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T06:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issue on Sorting the itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432141#M1052081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From what i get u are trying to sort internal table using an external object which according to me is not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u can sort only through field contained in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u want only to sort it on 1 field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by field1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Varun Mathur on Sep 3, 2008 12:39 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 07:09:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432141#M1052081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T07:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Issue on Sorting the itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432142#M1052082</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;assume that your table(itab) is full of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do such a thing,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create another internal table(itab2) as of same type with your itab including one more field, a field just one char length, assume it is &lt;STRONG&gt;sortfield&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab.

" RC,PE,TM,WP,SM,RM.......
if itab-zobject eq 'RC'.
   itab2-sortfield = 'A'.
elseif itab-zobject eq 'PE'.
  itab2-sortfield = 'B'.

....go on like this.

append itab to itab2.
endif.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort itab2 by sortfield.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course your main table is now itab2, display it.&lt;/P&gt;&lt;P&gt;Afterwards sort itab2 as above, if you do not want to display sortfield, you can do it through setting fieldcat properties.&lt;/P&gt;&lt;P&gt;This will sort your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;deniz.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 07:49:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-on-sorting-the-itab/m-p/4432142#M1052082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T07:49:58Z</dc:date>
    </item>
  </channel>
</rss>

