Sorting Internal Tables in ABAP - Sorting by Another Sort Key



Αξιολόγηση Χρήστη:  / 0
ΧειρότεροΚαλύτερο 
Λεπτομέρειες

Sorting by Another Sort key

If you have an internal table with a structured line type that you want sort by a different key, you can specify the key in the SORT statement:

SORT <itab> [ASCENDING|DESCENDING] [AS TEXT] [STABLE]
BY <f1> [ASCENDING|DESCENDING] [AS TEXT]
...
<fn> [ASCENDING|DESCENDING] [AS TEXT].

The table is now sorted by the specified components <f 1 > ... <f n > instead of by the table key. The number of sort fields is limited to 250. The sort order depends on the sequence of the fields <f i >. The sort sequence specified before BY applies to all fields. The sort sequence after a field applies only to that column of the table.

You can specify a sort field dynamically by specifying (<f>) instead of <f i >. The contents of the field <f> determines the name of the sort field. If <f> is empty when the statement is executed, the field is ignored in the sort. If it contains an invalid component name, a runtime error occurs.

You have no rights to post comments

   
   

     

© Developerpages