SAP SORT STABLE ABEXA



Get Example source ABAP code based on a different SAP table
  



Sorting Internal Tables
This example demonstrates how internal tables are sorted using SORT itab.

ABAP_SOURCE_CODE
DEMO CL_DEMO_INT_TBLS_SORT

ABAP_DESCRIPTION
The class sorts a standard table with one key field four times. First, the table is sorted twice by the key field (land) without the STABLE addition. The sort is unstable. The order of lines in which multiple keys appear can change. The same sort is then performed using the STABLE addition. The sort is stable. The lines remain in the same sequence. Then, it is sorted by a sort key defined as land and weight. The general sort order is defined as descending, but for weight it is defined as ascending.