Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Obsolete Language Elements →  Obsolete Processing of Internal Data →  Obsolete Internal Table Processing 

SORT itab BY field_symbol

Other versions: 7.31 | 7.40 | 7.54

Obsolete Syntax

SORT itab BY <fs1> <fs2> ...

Effect

In internal tables with header lines, field symbols can also be specified as a sort criterion for comp1 comp2 ... after SORT ... BY. If a component of the header line or the whole header line is assigned to the field symbol when the statement is executed, the table is sorted by the corresponding component or the whole line. If no data object is assigned to a field symbol, the specification is ignored. If a different data object is assigned to a field symbol, a non-handleable exception is raised.


Note

Instead of using field symbols for dynamic component specifications, it is best to specify parenthesized character-like data objects or an internal table, which contain the name of the components.

Bad Example

name = 'ITAB-COL1'.
ASSIGN (name) TO <fs>.

SORT itab BY <fs>.

Good Example

name = 'COL1'.

SORT itab BY (name).