on 04-04-2014 4:31 AM
Hi,
I created sorting rules for two columns, document number and date. Each different date of a certain document constitutes a line in ALV. I used the following code to set the rules. However, the ALV doesn't sort as expected.
LOOP AT LT_FIELDS INTO LS_FIELDS.
CASE LS_FIELDS-FIELDNAME.
WHEN 'AUFNR'.
LO_SORT_RULE ?= LS_FIELDS-R_FIELD->IF_SALV_WD_SORT~CREATE_SORT_RULE( SORT_POSITION = 1 ).
LS_FIELDS-R_FIELD->IF_SALV_WD_SORT~SET_GROUPING_ALLOWED( ).
WHEN 'ISSUE_DATE'.
LO_SORT_RULE ?= LS_FIELDS-R_FIELD->IF_SALV_WD_SORT~CREATE_SORT_RULE( SORT_ORDER = IF_SALV_WD_C_SORT=>SORT_ORDER_DESCENDING
SORT_POSITION = 2 ).
LS_FIELDS-R_FIELD->IF_SALV_WD_SORT~SET_GROUPING_ALLOWED( ABAP_FALSE ).
WHEN OTHERS.
ENDCASE.
ENDLOOP.
The result is
Header 1 | Header 2 |
---|---|
001 | 20140101 |
003 | 20140103 |
006 | 20140104 |
002 | |
004 | |
005 |
But I expect the ALV to be sorted as follows
Header 1 | Header 2 |
---|---|
001 | 20140101 |
002 | |
003 | 20140103 |
004 | |
005 | |
006 | 20140104 |
Hi ts,
The above code used for sorting should work as you expected.But I suspect that the sort logic of field 'AUFNR' is not executing / not reaching. Check the column name of HEADER1 column. It might be something else.
To make sure: check in debugging that the logic of AUFNR field gets reached.
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.