Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9656

ALV doesn't sort as expected.

$
0
0

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 1Header 2
00120140101
00320140103
00620140104
002
004
005


But I expect the ALV to be sorted as follows

Header 1Header 2
00120140101
002
00320140103
004
005
00620140104



Viewing all articles
Browse latest Browse all 9656

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>