<?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: Sorting in ALV with multiple fields in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353580#M1036637</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use sort table.&lt;/P&gt;&lt;P&gt;  data: ls_sort type slis_sortinfo_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use as the following for which you want the sum for the key fields and append to sort internal table.Here in your case, use for first three fields you mentioned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ls_sort-fieldname = 'fieldname'.&lt;/P&gt;&lt;P&gt;  ls_sort-up        = 'X'.&lt;/P&gt;&lt;P&gt;  ls_sort-subtot    = 'X'.&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;S Raju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Aug 2008 09:52:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-18T09:52:19Z</dc:date>
    <item>
      <title>Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353574#M1036631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement to sort an ALV grid and get the subtotal according to an unique combination of keys.&lt;/P&gt;&lt;P&gt;The subtotal should be based on an unique combination of &lt;/P&gt;&lt;P&gt;cost center, internal order and product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example: &lt;/P&gt;&lt;P&gt; cost center, internal order, product, amount&lt;/P&gt;&lt;P&gt;        25110   550145           100       50000&lt;/P&gt;&lt;P&gt;        25110   550145           100       75000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 25110               125000&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;        25110   550145            200      5000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 25110               5000&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;        25110   650021            300       30000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 25110               30000&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;        35100   550145            150       50000&lt;/P&gt;&lt;P&gt;        35100   550145            200       6000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 35100                56000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: The Iceman on Aug 18, 2008 11:38 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 09:35:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353574#M1036631</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T09:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353575#M1036632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt; Check this link&lt;/P&gt;&lt;P&gt;&lt;A href="http://saptechnical.com/Tutorials/ALV/Subtotals/text.htm" target="test_blank"&gt;http://saptechnical.com/Tutorials/ALV/Subtotals/text.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Syf&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 09:39:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353575#M1036632</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T09:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353576#M1036633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt;The subtotal should be based on an unique combination of &lt;/P&gt;&lt;P&gt;&amp;gt;cost center, internal order and product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in that case you populate the sort table based on the fields cost center, internal order and product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort-fieldname = 'KOSTL'.
sort-up = 'X'.
append sort to it_sort.
sort-fieldname = 'AUFNR'.
sort-up = 'X'.
append sort to it_sort.
sort-fieldname = 'MATNR'.
sort-up = 'X'.
sort-subtot = 'X'.
append sort to it_sort.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;this will take care.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pass this sort table to ALV .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 09:39:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353576#M1036633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T09:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353577#M1036634</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;Just go through the below link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdev.co.uk/reporting/alv/alvgrid_sort.htm" target="test_blank"&gt;http://www.sapdev.co.uk/reporting/alv/alvgrid_sort.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ruthra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 09:41:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353577#M1036634</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T09:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353578#M1036635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brian "The Iceman"??&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;pk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 09:41:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353578#M1036635</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T09:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353579#M1036636</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;try to fill sort catelogue in the following manner&lt;/P&gt;&lt;P&gt;  DATA:&lt;/P&gt;&lt;P&gt;    fs_sort_data TYPE slis_sortinfo_alv.&lt;/P&gt;&lt;P&gt;  DATA:&lt;/P&gt;&lt;P&gt;    t_sort_data TYPE slis_t_sortinfo_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fs_sort_data-fieldname = 'COSTCENTRE'.&lt;/P&gt;&lt;P&gt;  fs_sort_data-spos     =  '01'.&lt;/P&gt;&lt;P&gt;  fs_sort_data-up        = c_flag_x.&lt;/P&gt;&lt;P&gt;  APPEND fs_sort_data TO t_sort_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fs_sort_data-fieldname = 'IORDER'.&lt;/P&gt;&lt;P&gt;  fs_sort_data-spos     =  '02'.&lt;/P&gt;&lt;P&gt;  fs_sort_data-up        = c_flag_x.&lt;/P&gt;&lt;P&gt;  APPEND fs_sort_data TO t_sort_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fs_sort_data-fieldname = 'PRODUCT'.&lt;/P&gt;&lt;P&gt;  fs_sort_data-spos     =  '03'.&lt;/P&gt;&lt;P&gt;  fs_sort_data-up        = c_flag_x.&lt;/P&gt;&lt;P&gt;  APPEND fs_sort_data TO t_sort_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then supply   table t_sort_data to it_sort in &lt;STRONG&gt;REUSE_ALV_GRID_DISPALY&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Eshwar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 09:43:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353579#M1036636</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T09:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353580#M1036637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use sort table.&lt;/P&gt;&lt;P&gt;  data: ls_sort type slis_sortinfo_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use as the following for which you want the sum for the key fields and append to sort internal table.Here in your case, use for first three fields you mentioned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ls_sort-fieldname = 'fieldname'.&lt;/P&gt;&lt;P&gt;  ls_sort-up        = 'X'.&lt;/P&gt;&lt;P&gt;  ls_sort-subtot    = 'X'.&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;S Raju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 09:52:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353580#M1036637</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T09:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353581#M1036638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all, i have done the same way that you people have pointed out but it still doesnt work &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it gives the subtotal only for a single field like cost center and not for a unique combination for all three &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is wat it gives &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cost center, internal order, product, amount&lt;/P&gt;&lt;P&gt;25110 550145 100 50000&lt;/P&gt;&lt;P&gt;25110 550145 100 75000&lt;/P&gt;&lt;P&gt;25110 550145 200 5000&lt;/P&gt;&lt;P&gt;25110 650021 300 30000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 25110 160000&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;35100 550145 150 50000&lt;/P&gt;&lt;P&gt;35100 550145 200 6000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 35100 56000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what i want&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cost center, internal order, product, amount&lt;/P&gt;&lt;P&gt;25110 550145 100 50000&lt;/P&gt;&lt;P&gt;25110 550145 100 75000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 25110 125000&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;25110 550145 200 5000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 25110 5000&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;25110 650021 300 30000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 25110 30000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;35100 550145 150 50000&lt;/P&gt;&lt;P&gt;35100 550145 200 6000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cost center 35100 56000&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 09:57:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353581#M1036638</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T09:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353582#M1036639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have you tried the Collect statement??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:00:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353582#M1036639</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353583#M1036640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the collect statement would work but then i would have to change the processing in the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;isnt there a way to do it through ALV directly?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:03:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353583#M1036640</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353584#M1036641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to check the Sub-total field for the LAST field in sort order only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: just as Vijay Babu Dudla wrote.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Raymond Giuseppi on Aug 18, 2008 12:08 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:07:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353584#M1036641</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2008-08-18T10:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353585#M1036642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure if this is what you want...but try it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once your ALV is displayed, select the columns cost center, internal order, product using the CNTRL key and press the button "Ascending Sort". The once again select all the three columns and then click the button Subtotals(sigma/sigma). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:09:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353585#M1036642</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353586#M1036643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;lol! that is totally possible but i would like to do it programatically    &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:16:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353586#M1036643</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353587#M1036644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry for stating the obvious... but you never know with people with the kind of posts you get here &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:20:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353587#M1036644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353588#M1036645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is what i am doing currently; it wont sort properly, am i doing something wrong here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_sort-fieldname = 'RZZFPROD1'.&lt;/P&gt;&lt;P&gt;  wa_sort-tabname = 'INT_OUTPUT'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; wa_sort-spos = '01'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  wa_sort-up = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; wa_sort-subtot = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  APPEND wa_sort TO int_sort.&lt;/P&gt;&lt;P&gt;  CLEAR wa_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_sort-fieldname = 'USER0'.&lt;/P&gt;&lt;P&gt;  wa_sort-tabname = 'INT_OUTPUT'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; wa_sort-spos = '02'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  wa_sort-up = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; wa_sort-subtot = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  APPEND wa_sort TO int_sort.&lt;/P&gt;&lt;P&gt;  CLEAR wa_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_sort-fieldname = 'RCNTR1'.&lt;/P&gt;&lt;P&gt;  wa_sort-tabname = 'INT_OUTPUT'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; wa_sort-spos = '03'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  wa_sort-up = 'X'.&lt;/P&gt;&lt;P&gt;  wa_sort-subtot = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND wa_sort TO int_sort.&lt;/P&gt;&lt;P&gt;  CLEAR wa_sort.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:24:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353588#M1036645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353589#M1036646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried from my side with a small code,. check it once..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ztest_alv_sort.

TYPE-POOLS: slis.
DATA: BEGIN OF it_data OCCURS 0,
       kostl LIKE csks-kostl,
       aufnr LIKE aufk-aufnr,
       matnr LIKE vbap-matnr,
       qty   LIKE vbap-kwmeng,
     END OF it_data.

DATA:
it_fieldcat TYPE  slis_t_fieldcat_alv,
wa_fcat LIKE LINE OF it_fieldcat,
it_sort TYPE  slis_t_sortinfo_alv,
sort LIKE LINE OF it_sort.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name         = sy-repid
    i_internal_tabname     = 'IT_DATA'
    i_inclname             = sy-repid
  CHANGING
    ct_fieldcat            = it_fieldcat
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2.
wa_fcat-do_sum = 'X'.
MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
WHERE fieldname = 'QTY'.



it_data-kostl = '25110'.
it_data-aufnr = '550145'.
it_data-matnr = '50000'.
it_data-qty = '100.00'.
APPEND it_data.

it_data-kostl = '25110'.
it_data-aufnr = '550145'.
it_data-matnr = '75000'.
it_data-qty = '100.00'.
APPEND it_data.

it_data-kostl = '25110'.
it_data-aufnr = '650021'.
it_data-matnr = '30000'.
it_data-qty = '300.00'.
APPEND it_data.


it_data-kostl = '35100'.
it_data-aufnr = '550145'.
it_data-matnr = '50000'.
it_data-qty = '100.00'.
APPEND it_data.
it_data-kostl = '35100'.
it_data-aufnr = '550145'.
it_data-matnr = '60000'.
it_data-qty = '100.00'.
APPEND it_data.

sort-fieldname = 'KOSTL'.
sort-up = 'X'.

APPEND sort TO it_sort.
CLEAR sort.
sort-fieldname = 'AUFNR'.
sort-up = 'X'.
APPEND sort TO it_sort.
sort-fieldname = 'MATNR'.
sort-up = 'X'.
sort-subtot = 'X'.
APPEND sort TO it_sort.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program = sy-repid
    it_fieldcat        = it_fieldcat
    it_sort            = it_sort
  TABLES
    t_outtab           = it_data
  EXCEPTIONS
    program_error      = 1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:25:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353589#M1036646</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353590#M1036647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;use SLIS_SORTINFO_ALV for creating one internal table.&lt;/P&gt;&lt;P&gt;then fill this table with waht ever the fields you want to sort.&lt;/P&gt;&lt;P&gt;then add this table to final alv function module(reuse_alv_list_display)&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;venkat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:33:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353590#M1036647</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353591#M1036648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wouldnt do something revolutionary-ily different from what you,ve done. Sadly, dont have the luxury of debugging your code to check whts amiss.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 10:34:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353591#M1036648</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T10:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353592#M1036649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Do it in this way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS: slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF x_marc,&lt;/P&gt;&lt;P&gt;        matnr TYPE matnr,&lt;/P&gt;&lt;P&gt;        werks TYPE werks_d,&lt;/P&gt;&lt;P&gt;        abc   TYPE char10,&lt;/P&gt;&lt;P&gt;        losfx TYPE losfx,&lt;/P&gt;&lt;P&gt;      END OF x_marc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: i_marc TYPE STANDARD TABLE OF x_marc INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;      i_marc1 TYPE STANDARD TABLE OF x_marc INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;      wa_marc TYPE x_marc,&lt;/P&gt;&lt;P&gt;      i_fieldcat     TYPE slis_t_fieldcat_alv,        "Field Catalog&lt;/P&gt;&lt;P&gt;      wa_layout         TYPE slis_layout_alv,   "Field Layout&lt;/P&gt;&lt;P&gt;      wa_fieldcat      TYPE slis_fieldcat_alv, "Field Catalog&lt;/P&gt;&lt;P&gt;      l_losfx TYPE losfx,&lt;/P&gt;&lt;P&gt;      l_tabix TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_marc-matnr = '01'.&lt;/P&gt;&lt;P&gt;wa_marc-werks = '11'.&lt;/P&gt;&lt;P&gt;wa_marc-abc   = 'AAA'.&lt;/P&gt;&lt;P&gt;wa_marc-losfx = '1000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND wa_marc TO i_marc.&lt;/P&gt;&lt;P&gt;CLEAR: wa_marc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_marc-matnr = '01'.&lt;/P&gt;&lt;P&gt;wa_marc-werks = '11'.&lt;/P&gt;&lt;P&gt;wa_marc-abc   = 'AAA'.&lt;/P&gt;&lt;P&gt;wa_marc-losfx = '2000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND wa_marc TO i_marc.&lt;/P&gt;&lt;P&gt;CLEAR: wa_marc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_marc-matnr = '01'.&lt;/P&gt;&lt;P&gt;wa_marc-werks = '11'.&lt;/P&gt;&lt;P&gt;wa_marc-abc   = 'BBB'.&lt;/P&gt;&lt;P&gt;wa_marc-losfx = '1000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND wa_marc TO i_marc.&lt;/P&gt;&lt;P&gt;CLEAR: wa_marc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_marc-matnr = '01'.&lt;/P&gt;&lt;P&gt;wa_marc-werks = '11'.&lt;/P&gt;&lt;P&gt;wa_marc-abc   = 'CCC'.&lt;/P&gt;&lt;P&gt;wa_marc-losfx = '1000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND wa_marc TO i_marc.&lt;/P&gt;&lt;P&gt;CLEAR: wa_marc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT i_marc BY matnr werks abc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_marc INTO wa_marc.&lt;/P&gt;&lt;P&gt;  l_losfx = l_losfx + wa_marc-losfx.&lt;/P&gt;&lt;P&gt;  APPEND wa_marc TO i_marc1.&lt;/P&gt;&lt;P&gt;  AT END OF abc.&lt;/P&gt;&lt;P&gt;    CLEAR: wa_marc.&lt;/P&gt;&lt;P&gt;    wa_marc-matnr = 'Total'.&lt;/P&gt;&lt;P&gt;    wa_marc-losfx = l_losfx.&lt;/P&gt;&lt;P&gt;    APPEND wa_marc TO i_marc1.&lt;/P&gt;&lt;P&gt;    CLEAR l_losfx.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Prepare ALV field catalog&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;PERFORM sub_populate_fieldcat USING :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'MATNR'     '18'   'Material Number'(008),&lt;/P&gt;&lt;P&gt;'WERKS'     '4'    'plant'(009),&lt;/P&gt;&lt;P&gt;'ABC'       '10'   'type'(010),&lt;/P&gt;&lt;P&gt;'LOSFX'     '20'   'Amount'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Layout&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;wa_layout-zebra             = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Optimize the column width&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;wa_layout-colwidth_optimize = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    i_callback_program = sy-repid&lt;/P&gt;&lt;P&gt;    is_layout          = wa_layout&lt;/P&gt;&lt;P&gt;    it_fieldcat        = i_fieldcat[]&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    t_outtab           = i_marc1[]&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    program_error      = 1&lt;/P&gt;&lt;P&gt;    OTHERS             = 2.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&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;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  sub_populate_fieldcat&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_FIELDNAME  text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_LENGTH     text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_TEXT       text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM sub_populate_fieldcat  USING  p_fieldname TYPE slis_fieldname&lt;/P&gt;&lt;P&gt;                                   p_length    TYPE dd03p-leng&lt;/P&gt;&lt;P&gt;                                   p_text      TYPE dd03p-scrtext_l.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-tabname      = 'I_MARC'.        " Internal Table name&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname    = p_fieldname.    " Field name&lt;/P&gt;&lt;P&gt;  wa_fieldcat-outputlen    = p_length.       " Field length&lt;/P&gt;&lt;P&gt;  wa_fieldcat-just         = 'L'.            " Position&lt;/P&gt;&lt;P&gt;  wa_fieldcat-seltext_l    = p_text.         " Field text&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Append word area to Internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  APPEND  wa_fieldcat TO i_fieldcat .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " sub_populate_fieldcat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Subhankar Garani on Aug 18, 2008 1:06 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Subhankar Garani on Aug 18, 2008 1:07 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 11:05:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353592#M1036649</guid>
      <dc:creator>Subhankar</dc:creator>
      <dc:date>2008-08-18T11:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting in ALV with multiple fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353593#M1036650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! thanks a lot! it worked!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2008 11:28:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorting-in-alv-with-multiple-fields/m-p/4353593#M1036650</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-18T11:28:44Z</dc:date>
    </item>
  </channel>
</rss>

