<?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 internal table and a tricky change in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339621#M515472</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ex : If internal table for PO looks like :&lt;/P&gt;&lt;P&gt;POSNR - Plant&lt;/P&gt;&lt;P&gt;00010 - 204&lt;/P&gt;&lt;P&gt;00020 - 202&lt;/P&gt;&lt;P&gt;00030 - 204&lt;/P&gt;&lt;P&gt;00040 - 202&lt;/P&gt;&lt;P&gt;00050 - 206&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After sorting with respect to plant and then posnr,&lt;/P&gt;&lt;P&gt;the layout is :&lt;/P&gt;&lt;P&gt;00020 - 202&lt;/P&gt;&lt;P&gt;00040 - 202&lt;/P&gt;&lt;P&gt;Page-break&lt;/P&gt;&lt;P&gt;00010 - 204&lt;/P&gt;&lt;P&gt;00030 - 204&lt;/P&gt;&lt;P&gt;Page-break&lt;/P&gt;&lt;P&gt;00050 - 206&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, the 1st item displayed on the 1st page is item # 00020&lt;/P&gt;&lt;P&gt;Our key users do not like it, and wish to see the 1st item (# 00010) on the 1st page&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The desired result is to change the sequence displaying the "plant block" containing the 1st item :&lt;/P&gt;&lt;P&gt;00010 - 204&lt;/P&gt;&lt;P&gt;00030 - 204&lt;/P&gt;&lt;P&gt;Page-break&lt;/P&gt;&lt;P&gt;00020 - 202&lt;/P&gt;&lt;P&gt;00040 - 202&lt;/P&gt;&lt;P&gt;Page-break&lt;/P&gt;&lt;P&gt;00050 - 206&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The general rule is still to sort by plant (ascending) and then by item number (ascending also), but to move the block &lt;/P&gt;&lt;P&gt;of the plant containing the lowest item number on top of the sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please be careful not to generate regression in case there is only 1 item, or only 1 plant, or any other case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly provide a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Tejas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jun 2007 05:18:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-14T05:18:08Z</dc:date>
    <item>
      <title>Sorting internal table and a tricky change</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339621#M515472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ex : If internal table for PO looks like :&lt;/P&gt;&lt;P&gt;POSNR - Plant&lt;/P&gt;&lt;P&gt;00010 - 204&lt;/P&gt;&lt;P&gt;00020 - 202&lt;/P&gt;&lt;P&gt;00030 - 204&lt;/P&gt;&lt;P&gt;00040 - 202&lt;/P&gt;&lt;P&gt;00050 - 206&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After sorting with respect to plant and then posnr,&lt;/P&gt;&lt;P&gt;the layout is :&lt;/P&gt;&lt;P&gt;00020 - 202&lt;/P&gt;&lt;P&gt;00040 - 202&lt;/P&gt;&lt;P&gt;Page-break&lt;/P&gt;&lt;P&gt;00010 - 204&lt;/P&gt;&lt;P&gt;00030 - 204&lt;/P&gt;&lt;P&gt;Page-break&lt;/P&gt;&lt;P&gt;00050 - 206&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, the 1st item displayed on the 1st page is item # 00020&lt;/P&gt;&lt;P&gt;Our key users do not like it, and wish to see the 1st item (# 00010) on the 1st page&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The desired result is to change the sequence displaying the "plant block" containing the 1st item :&lt;/P&gt;&lt;P&gt;00010 - 204&lt;/P&gt;&lt;P&gt;00030 - 204&lt;/P&gt;&lt;P&gt;Page-break&lt;/P&gt;&lt;P&gt;00020 - 202&lt;/P&gt;&lt;P&gt;00040 - 202&lt;/P&gt;&lt;P&gt;Page-break&lt;/P&gt;&lt;P&gt;00050 - 206&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The general rule is still to sort by plant (ascending) and then by item number (ascending also), but to move the block &lt;/P&gt;&lt;P&gt;of the plant containing the lowest item number on top of the sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please be careful not to generate regression in case there is only 1 item, or only 1 plant, or any other case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly provide a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Tejas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 05:18:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339621#M515472</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T05:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting internal table and a tricky change</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339622#M515473</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 have to sort with posnr first and then sort with the plant..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY POSNR PLANT&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;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 05:21:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339622#M515473</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T05:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting internal table and a tricky change</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339623#M515474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this logic. Create a copy of the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab_temp[] = itab[].&lt;/P&gt;&lt;P&gt;SORT ITAB BY POSNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB_TEMP WHERE ITAB_TEMP-PLANT = ITAB-PLANT.&lt;/P&gt;&lt;P&gt;WRITE ITAB_TEMP-PLANT , ITAB_TEMP-POSNR.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE ITAB_TEMP WHERE PLANT = ITAB-PLANT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 05:22:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339623#M515474</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T05:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting internal table and a tricky change</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339624#M515475</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;&lt;/P&gt;&lt;P&gt;i suggest you create another intrnal table ( I_TAB2 ) and do it like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort I_TAB by posnr&lt;/P&gt;&lt;P&gt;move the first record of I_TAB to I_TAB2&lt;/P&gt;&lt;P&gt;delete the 1st record of I_TAB&lt;/P&gt;&lt;P&gt;transfer all remainingrecords of I_TAB into I_TAB2 where plant  = I_TAB2-plant&lt;/P&gt;&lt;P&gt;delete from I_TAB all records with plant = I_TAB2 plant&lt;/P&gt;&lt;P&gt;sort I_TAB by plant posnr&lt;/P&gt;&lt;P&gt;transfer all records of I_TAB into I_TAB2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your I_TAB2 will be the result&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 05:39:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-internal-table-and-a-tricky-change/m-p/2339624#M515475</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T05:39:35Z</dc:date>
    </item>
  </channel>
</rss>

