SAP SORT ITAB - Obsolete ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• BY SORT itab (obsolete)

SORT itab BY field_symbol

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

What does it do?
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 entire header line is assigned to the field symbol when the statement is executed, the table is sorted by the corresponding component or the entire 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, an uncatchable exception is raised.



Latest notes:

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.
ABAP_HINT_END

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

SORT itab BY <(><)>.
ABAP_EXAMPLE_END

ABAP_EXAMPLE_GOOD name = 'COL1'.

SORT itab BY (name).
ABAP_EXAMPLE_END

Return to menu