2006 Aug 14 8:55 PM
SORT it_stpo BY andat stpoz DESCENDING.
before sort
DATUV ANDAT STLKN STPOZ
1. 20020118|20020118|00000002|00000004|
2. 20060711|20060811|00000004|00000008|
3. 20060801|20060811|00000005|00000011
4. 20020515|20020515|00000003|00000006
AFTER SORT..
DATUV ANDAT STLKN STPOZ
1. 20020118|20020118|00000002|00000004
2. 20020515|20020515|00000003|00000006|
3. 20060801|20060811|00000005|00000011
4. 20060711|20060811|00000004|00000008|
what I expected was to see Record # 3 as my first record after the sort ?
Any ideas?
2006 Aug 14 9:00 PM
You either need to explicitly state "descending" after each filed in the sort statement or one time before all fields. Your statement actually translates to sort it_stpo by andat ascending stpoz descending.
SORT it_stpo BY andat stpoz DESCENDING.
before sort
DATUV ANDAT STLKN STPOZ
1. 20020118|20020118|00000002|00000004|
2. 20060711|20060811|00000004|00000008|
3. 20060801|20060811|00000005|00000011
4. 20020515|20020515|00000003|00000006
AFTER SORT..
DATUV ANDAT STLKN STPOZ
1. 20020118|20020118|00000002|00000004
2. 20020515|20020515|00000003|00000006|
3. 20060801|20060811|00000005|00000011
4. 20060711|20060811|00000004|00000008|
what I expected was to see Record # 3 as my first record after the sort ?
Any ideas?
2006 Aug 14 8:58 PM
2006 Aug 14 9:00 PM
typed as follows:
BEGIN OF it_stpo OCCURS 10,
datuv TYPE stpo-datuv,
andat TYPE stpo-andat,
stlkn TYPE stpo-stlkn,
stpoz TYPE stpo-stpoz,
ltxsp TYPE stpo-ltxsp,
potx1 TYPE stpo-potx1,
END OF it_stpo.
2006 Aug 14 9:00 PM
You either need to explicitly state "descending" after each filed in the sort statement or one time before all fields. Your statement actually translates to sort it_stpo by andat ascending stpoz descending.
2006 Aug 14 9:00 PM
2006 Aug 14 9:01 PM
2006 Aug 14 9:02 PM
Hi,
Please try this.
SORT it_stpo BY andat DESCENDING
stpoz DESCENDING.Regards,
Ferry Lianto
2006 Aug 14 9:02 PM
Hello J.J
The explicit version of your SORT statement is:
SORT it_stpo BY andat ASCENDING
stpoz DESCENDING.Because ASCENDING is the default sorting direction.
If you want to sort all fields of your itab in descending order your statement must look like:
SORT it_stpo DESCENDING BY andat
stpoz.Regards
Uwe
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |