I have an internal table
and i want to display it like this:
note that only a1's date is sorted descending. so im wondering if theres a method to only sort dates belong to a1 while leaving the others untouched.
I am a beginner so id appreciate if the answer is easy to understand
You can use the LOOP/GROUP approach to sort the table before sending it to the ALV (sample code only):
LOOP AT itab ASSIGNING FIELD-SYMBOL(<line>)
GROUP BY ( key1 = <line>-cust_id key2 = <line>-prod_id ) ASCENDINGdd
ASSIGNING FIELD-SYMBOL(<grp1>).
LOOP AT GROUP <grp1> ASSIGNING FIELD-SYMBOL(<member>).
members = VALUE #( BASE members ( <member> ) ).
ENDLOOP.
IF <grp1>-prod_id = 'A1'.
SORT members BY sale_date DESCENDING.
ELSE.
SORT members BY sale_date ASCENDING.
ENDIF.
APPEND LINES OF members TO it_final.
ENDLOOP.