Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete Extracts →  SORT - Extract 

SORT - sort_key

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Obsolete Syntax

... BY field1 [ASCENDING|DESCENDING] [AS TEXT]
       field2 [ASCENDING|DESCENDING] [AS TEXT]
       ... .

Extras

1. ... ASCENDING|DESCENDING
2. ... AS TEXT

Effect

When a sort key is specified with the BY addition, sorting is not done by field group header, but by the field1 field2 ... fields specified after it. For field1 field2 ..., only components of field group header or field groups that contain solely fields of field group header can be specified. The sort order depends on the sequence in which the components field1 field2 ... are specified. The number of fields to be used for sorting is limited to 50.

For field1 field2 ..., field symbols can also be specified. If a component of the field group header is assigned to a field symbol when the statement is executed, sorting takes place according to the respective component. 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 untreatable exception is triggered.


Note

For field1 field2 ..., no Customizing includes may be specified if they are empty.

Addition 1

... ASCENDING|DESCENDING

If, after a component field1 field2 ..., neither of the ASCENDING or DESCENDING additions is specified, the predefined sort direction is applied. If one of the additions ASCENDING or DESCENDING is specified, it overwrites the default for this component.

Addition 2

... AS TEXT

Without the addition AS TEXT after a text-like component field1 field2 ..., the default is applied. If the addition AS TEXT is specified after a text-like component, it overwrites the default for this component. In the case of non-text-like components, AS TEXT cannot be specified. If AS TEXT is specified after a field group, the addition is only applied to the text-like components of this group.