<?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 ALV Object Model: Sorting issue (CL_SALV_TABLE) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642099#M1443601</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;U&gt;Scenario:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;This thread is linked to the post:&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1602751"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scenario is that I have an ALV grid on which I have added a button to perform the 'Refresh' operation. On pressing this button, the data is retrieved from the database and displayed back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Issue:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;The problem is that when I sort any field (by using the generic ALV sorting functionality) in ascending order and then press the "Refresh' button, the sort order is lost which I would like to avoid as this will be frustrating for the user to sort the result set after pressing the 'Refresh' button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To give a clear picture of the issue, if you try to execute the SAP delivered program: SALV_DEMO_TABLE_REFRESH, i found that the behavior is the same. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Inputs:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;As my scenario was similar to this I selected the option 'Output as Grid' on the selection screen and the number of records as 5. On the result screen, I select the field 'Occupied' and sort this in Ascending order. Now I press the button 'Double Data Records and Select Rows'. (This will refresh the grid).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when you get the result back, the sort order is lost and the data is displayed as it was retrieved from the database table. It does not maintain the sort order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly suggest. I fighting this issue for a long time..:(&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;s@k&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Feb 2010 08:18:38 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-16T08:18:38Z</dc:date>
    <item>
      <title>ALV Object Model: Sorting issue (CL_SALV_TABLE)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642099#M1443601</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;U&gt;Scenario:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;This thread is linked to the post:&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1602751"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scenario is that I have an ALV grid on which I have added a button to perform the 'Refresh' operation. On pressing this button, the data is retrieved from the database and displayed back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Issue:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;The problem is that when I sort any field (by using the generic ALV sorting functionality) in ascending order and then press the "Refresh' button, the sort order is lost which I would like to avoid as this will be frustrating for the user to sort the result set after pressing the 'Refresh' button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To give a clear picture of the issue, if you try to execute the SAP delivered program: SALV_DEMO_TABLE_REFRESH, i found that the behavior is the same. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Inputs:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;As my scenario was similar to this I selected the option 'Output as Grid' on the selection screen and the number of records as 5. On the result screen, I select the field 'Occupied' and sort this in Ascending order. Now I press the button 'Double Data Records and Select Rows'. (This will refresh the grid).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when you get the result back, the sort order is lost and the data is displayed as it was retrieved from the database table. It does not maintain the sort order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly suggest. I fighting this issue for a long time..:(&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;s@k&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2010 08:18:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642099#M1443601</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-16T08:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Object Model: Sorting issue (CL_SALV_TABLE)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642100#M1443602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have not reviewed this &lt;STRONG&gt;excellent&lt;/STRONG&gt; set of articles on NetWeaver SALV, read Mr. Heilman on the subject.  The article referenced below includes get_sort, set_sort methods...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de4908a6?quicklink=index&amp;amp;overridelayout=true" target="test_blank"&gt;http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de4908a6?quicklink=index&amp;amp;overridelayout=true&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I trust this will be helpful, at least, to your problem....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2010 21:40:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642100#M1443602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-16T21:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Object Model: Sorting issue (CL_SALV_TABLE)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642101#M1443603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Dave,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response...:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The approach I followed is:&lt;/P&gt;&lt;P&gt;Before executing the 'user command' method, i have set the 'Sort' criteria using the: get_lvc_sort and set_lvc_sort methods of the class cl_salv_controller_metadata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sort order is retained after the Refresh button is pressed...&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;s@k&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 07:35:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642101#M1443603</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-17T07:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Object Model: Sorting issue (CL_SALV_TABLE)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642102#M1443604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you have to clear the sort order and then refresh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lr_sorts = gr_alv-&amp;gt;get_sorts( ).&lt;/P&gt;&lt;P&gt;  lr_sorts-&amp;gt;clear( ).&lt;/P&gt;&lt;P&gt;gr_alv-&amp;gt;refresh( ).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Feb 2010 20:23:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-object-model-sorting-issue-cl-salv-table/m-p/6642102#M1443604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-18T20:23:19Z</dc:date>
    </item>
  </channel>
</rss>

