Search code examples
sortingabaphanainternal-tables

When sorting of itab is done in SQL query?


I have a select like this

DATA lt_data TYPE SORTED TABLE OF T_TYPE1 WITH NON-UNIQUE KEY col1.
SELECT col1, col2 INTO CORRESPONDING FIELDS OF TABLE lt_data where...

My question is: will the sorting operation be performed on the DB or on the application server side? My DB is Hana DB (S/4 Hana).


Solution

  • The documentation states that a sorting process is executed after the result set is inserted into the table thus it takes place on the application server.

    The results set is inserted into the internal table itab row-by-row; a sorting process is executed in the case of a sorted table.