The selected records can be sorted using the ‘ORDER BY’ clause. The data can be sorted based on the column mentioned after the ORDER BY clause. It can be sorted in ascending / increasing order or descending / decreasing order. It can be sorted based on more than one column. The priority of the sorting sequence is based on the order in which the column names are mentioned. For every column, it can be mentioned specifically if it needs to be sorted in ascending or descending order. By default, it is sorted in ascending order.
DATA lt_contact TYPE TABLE OF ztt_db_table2.
SELECT contact_id contact_name FROM ztt_db_table2 INTO TABLE lt_contact ORDER BY contact_id ASCENDING.