Instead of sorting a standard table, you might consider declaring another internal table as a sorted table of the same type with a unique key corresponding to the fields you are comparing to eliminate duplicates. This is faster, allows you to keep the original table unchanged and, in my opinion, makes your code more readable, because it is easier to understand which lines are stored and which are not. Example:
LOOP AT itab ASSIGNING <itab_row>. INSERT <itab_row> INTO TABLE sorted_itab. ENDLOOP.
RenΓ© source share