Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Hierarchical List Display Sorting Issue

Former Member
0 Likes
613

Hello experts,

Iu2019m using REUSE_ALV_HIERSEQ_LIST_DISPLAY to display header and item details. I need to sort header table in ascending order with respect to u2018categoryu2019 field and item table in descending order with respect to u2018failed_linesu2019 field. Iu2019m using below code for this purpose.

lv_alv_sort-spos = '1'.
    lv_alv_sort-fieldname = 'CATEGORY'.
    lv_alv_sort-tabname = 'OTABH'.
    lv_alv_sort-up = 'X'.
    APPEND lv_alv_sort TO alv_sort.
    CLEAR: lv_alv_sort.

    lv_alv_sort-spos = '2'.
    lv_alv_sort-fieldname = 'FAILED_LINES'.
    lv_alv_sort-tabname = 'OTABD'.
    lv_alv_sort-down = 'X'.
    APPEND lv_alv_sort TO alv_sort.

In the above code, header table (otabh) is working properly and displaying in ascending order. But the item table (otabd), even though descending order is mentioned( lv_alv_sort-down = 'X'.), it is displaying in ascending order. Could anyone help me with other possible ways to achieve this?

Regards,

Ramya.

Hello experts,

Iu2019m using REUSE_ALV_HIERSEQ_LIST_DISPLAY to display header and item details. I need to sort header table in ascending order with respect to u2018categoryu2019 field and item table in descending order with respect to u2018failed_linesu2019 field. Iu2019m using below code for this purpose.

lv_alv_sort-spos = '1'.
    lv_alv_sort-fieldname = 'CATEGORY'.
    lv_alv_sort-tabname = 'OTABH'.
    lv_alv_sort-up = 'X'.
    APPEND lv_alv_sort TO alv_sort.
    CLEAR: lv_alv_sort.

    lv_alv_sort-spos = '2'.
    lv_alv_sort-fieldname = 'FAILED_LINES'.
    lv_alv_sort-tabname = 'OTABD'.
    lv_alv_sort-down = 'X'.
    APPEND lv_alv_sort TO alv_sort.

In the above code, header table (otabh) is working properly and displaying in ascending order. But the item table (otabd), even though descending order is mentioned( lv_alv_sort-down = 'X'.), it is displaying in ascending order. Could anyone help me with other possible ways to achieve this?

Regards,

Ramya.

2 REPLIES 2
Read only

Former Member
0 Likes
535

Hi,

Try sort item table just before list.


SORT otabd by category ASCENDING failed_line DESCENDING.

I didn't try. Let me know the result.

Çağatay

Read only

Former Member
0 Likes
535

Hi Cagatay,

Thanks for your reply, but..

'Category' is from header table(otabh) and 'failed_lines' is from item table(otabd).

I also tried sorting item table(otabd) just before the function call, but it did not work.

Regards,

Ramya.