<?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: loop to sort internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153003#M749867</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;U dont need loop at for sorting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What exactly are u cheking FieldX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sort itab[] by fieldA ascending fieldB descending.&lt;/STRONG&gt; would be sufficient&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Awrd Points if useful&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bhupal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Dec 2007 11:16:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-24T11:16:52Z</dc:date>
    <item>
      <title>loop to sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153002#M749866</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 would like to know if this is possible.&lt;/P&gt;&lt;P&gt;i would like to sort internal table base on fieldX. if fieldX is initial then sort with condition as below else system default sort sequence.&lt;/P&gt;&lt;P&gt;i know the syntax incorrect. need advice with example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab&lt;/P&gt;&lt;P&gt;if itab-fieldX is initial.&lt;/P&gt;&lt;P&gt;sort itab[] by fieldA ascending fieldB descending.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Dec 2007 11:11:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153002#M749866</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-24T11:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: loop to sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153003#M749867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;U dont need loop at for sorting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What exactly are u cheking FieldX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sort itab[] by fieldA ascending fieldB descending.&lt;/STRONG&gt; would be sufficient&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Awrd Points if useful&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bhupal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Dec 2007 11:16:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153003#M749867</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-24T11:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: loop to sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153004#M749868</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;Declare another internal table of the same type as ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at ITAB check the field and sort the new internal table in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB_NEW like ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab&lt;/P&gt;&lt;P&gt;if itab-fieldX is initial.&lt;/P&gt;&lt;P&gt;sort itab_new[] by fieldA ascending fieldB descending.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pankaj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Dec 2007 11:17:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153004#M749868</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-24T11:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: loop to sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153005#M749869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is not a way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would you please specify about the requirement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;P&gt;ANUPAM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Dec 2007 11:21:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153005#M749869</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-24T11:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: loop to sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153006#M749870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;better you can use read command for your validations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dont use sort command inside the loop bcose evry loop count itab has altered .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;jai.m&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Dec 2007 11:30:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153006#M749870</guid>
      <dc:creator>jayakummar</dc:creator>
      <dc:date>2007-12-24T11:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: loop to sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153007#M749871</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;The reqt is quite different.&lt;/P&gt;&lt;P&gt;Because in a internal table we may have some 100 records.&lt;/P&gt;&lt;P&gt;In that 100 records for 10 records you have fieldX is initail.And for some other 10 records fieldY is initial.&lt;/P&gt;&lt;P&gt;And for some 10 records both fieldx fieldY are initial means you cant do with loop processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do in otherway ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_fieldx_count = 0. "Type I&lt;/P&gt;&lt;P&gt;v_fieldy_count = 0.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab-fieldX is initial   AND    fieldY  is initial  .    &lt;/P&gt;&lt;P&gt;       v_fieldx_count = v_fieldx_count  + 1.&lt;/P&gt;&lt;P&gt;       v_fieldy_count = v_fieldy_count +1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif itab-fieldX is initial.&lt;/P&gt;&lt;P&gt;    v_fieldx_count = v_fieldx_count  + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif itab-fieldY is initial.&lt;/P&gt;&lt;P&gt;    v_fieldY_count = v_fieldY_count  + 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endlloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If v_fieldx_count GE v_fieldY_count .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by fieldX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;sort itab by fieldY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like that you can proceed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds&lt;/P&gt;&lt;P&gt;Parvathi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward points if helpful.............&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Dec 2007 11:30:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153007#M749871</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-24T11:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: loop to sort internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153008#M749872</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 need not required to loop at internal table for sorting the table.&lt;/P&gt;&lt;P&gt;just use the sort statement followed by fields on which you want to sort the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by field1 ascending field2 descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points, if useful.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Dec 2007 11:31:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-sort-internal-table/m-p/3153008#M749872</guid>
      <dc:creator>former_member402443</dc:creator>
      <dc:date>2007-12-24T11:31:55Z</dc:date>
    </item>
  </channel>
</rss>

