‎2012 Jul 31 7:03 PM
Hi,
I'm working with an ALV grid, specifically cl_salv_hierseq_table, and I have a column that shows date values.
Sorting must be enabled for the date column. However, an empty date will sort to the top of the list with an ascending sort, and to the bottom with a descending sort.
Is there a way to make ALV (or the SORT statement for an internal table) treat an empty date as a high value?
If not, I could set all empty date values to 12/31/9999, if I could find a way to make ALV suppress their display (i.e. if the date value for that row is 12/31/9999, show it as blank to the user). Can that be done?
Thanks.
‎2012 Aug 01 6:48 AM
Hi Eric,
The SORT statement cannot move the empty dates to the end of the internal table. I will use the following approach.
Best regards
‎2012 Jul 31 9:42 PM
Hi Eric,
I don't think this will be possible for the sort/alv. The sort works on the contents of the entire column. You could change the value from blank date to something higher like 12/31/9999 but you will not be able to suppress it by rows.
- Puneet
‎2012 Aug 01 6:48 AM
Hi Eric,
The SORT statement cannot move the empty dates to the end of the internal table. I will use the following approach.
Best regards
‎2012 Aug 01 7:41 AM
Hi,
For SORT statement on internal table it can be done indirectly by creating another field & copy contents of date field to be sorted, into this field ( with date as 31/12/9999 in case it is blank aspointed out by you ), & sort the internal table on this new hidden column.
I hope this helps,
Regards
Raju Chitale
‎2012 Aug 02 8:51 PM
Michael,
Thanks for this idea. I'm sure it would work, but I'll use a simpler solution to get it done more quickly. Details in my response to Raju...
‎2012 Aug 02 8:55 PM
Raju,
I did this and it worked well.
I also called the set_technical method (with a value of true) on the column object, to make sure not only that this new column would not be visible on the report, but that it would also not be available for the user to choose in the "Change Layout" functionality.
Thanks!