SORT - sort_key
... BY field1 [ASCENDING|DESCENDING] [AS TEXT]
field2 [ASCENDING|DESCENDING] [AS TEXT]
When a sort key is specified with the
BY addition, sorting is not done by
header, but by the
field1 field2 ...
fields specified after it. For
field1 field2 ..., only components of field
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.
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.
field1 field2 ..., no Customizing includes may be specified if they are empty.
If, after a component
field1 field2 ..., neither of the
DESCENDING additions is specified, the predefined sort direction is applied.
If one of the additions
DESCENDING is specified, it overwrites the default for this component.
... 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
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.