‎2007 Nov 21 3:18 PM
Hi,
I have the following scenario.
I sorted the column 'customer' and I am using CL_SALV_AGGREGATIONS to subtotal the records by 'customer'. When I sorted 'customer', 'customer' column will appearing in alphabetical order. For example,
Customer A 1 (this is the aggregation subtotal)
Customer B 4
Customer C 3
My question is, can I sort the ALV display by the subtotal from the aggregation? Meaning I want to display the 'customer' with the most record first, like this
Customer B 4
Customer C 3
Customer A 1
Thanks!
Cady
‎2007 Nov 21 3:52 PM
Hi
You can't sort on the Subtotal amount field
If needed use another non numeric field to sort
after the display anyhow using the MENU options you can sort that subtotal field and see
Regards
Anji
Message was edited by:
Anji Reddy Vangala
‎2007 Nov 21 3:31 PM
Hi,
Try this way
data: gr_sorts type ref to cl_salv_sorts.
....
....
gr_sorts = gr_table->get_sorts( ).
gr_sorts->add_sort( columnname = 'CUSTOMER' subtotal = abap_true ).
a®
‎2007 Nov 21 3:35 PM
Hi a®s,
Thanks for your suggestion but I want to show the subtotal.
Cheers,
Cady
‎2007 Nov 21 3:39 PM
Hi,
Try this way
gr_sorts->add_sort( columnname = 'CUSTOMER' subtotal = abap_true ).
aRs
‎2007 Nov 21 3:43 PM
Hi aRs ,
Yes that's what i did. In addition to that i want to sort the subtotal.
Thanks.
Cady
‎2007 Nov 21 3:32 PM
Hi,
Instead of sorting based on Customer, sort it on Aggrigation value.
Regards,
Satish
‎2007 Nov 21 3:41 PM
Hi Satish,
I am not getting you here. How do i sort it on aggregation value? Perhaps I am not being clear enough. Basically, i have 3 columns in the alv. Column 1 = customer, column 2 = documents for customer, column 3 = an integer 1. I am sorting column customer and aggregate on column 3. I hope I am not confusing you.
Thanks.
Cady
‎2007 Nov 21 3:52 PM
Hi
You can't sort on the Subtotal amount field
If needed use another non numeric field to sort
after the display anyhow using the MENU options you can sort that subtotal field and see
Regards
Anji
Message was edited by:
Anji Reddy Vangala
‎2007 Nov 21 4:01 PM
Hi Anji,
Nope, the menu option doesnt work. Subtotal disappear after sort. Is there a workaround for this?
Thanks.
Cady