TYPES: BEGIN OF ty_name,
name TYPE string,
name_lc TYPE string,
END OF ty_name.
TYPES: ty_it_name TYPE STANDARD TABLE OF ty_name WITH DEFAULT KEY.
* Tabelle mit Strings, die sortiert werden soll
DATA(it_names) = VALUE ty_it_name( ( name = 'Albert' )
( name = 'Emma' )
( name = 'Zorro' )
( name = 'Donald' )
( name = 'Lion' )
( name = 'answer' )
( name = 'type' )
( name = 'second' ) ).
* zweite Spalte mit lower-case Strings füllen
LOOP AT it_names ASSIGNING FIELD-SYMBOL(<n>).
<n>-name_lc = to_lower( <n>-name ).
ENDLOOP.
* erstmal regulär sortieren
SORT: it_names BY name.
* zweite Tabelle anlegen (kopieren)
DATA(it_names_lc) = it_names.
* Spalte lower-case sortieren
SORT: it_names_lc BY name_lc.
* Ausgabe der Ergebnisse
cl_demo_output=>write_data( value = it_names name = 'case-sensitives SORT' ).
cl_demo_output=>write_data( value = it_names_lc name = 'SORT nach lower-case' ).
cl_demo_output=>display( ).