Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
hannes_kuehnemund
Active Contributor
0 Kudos

Sorting the Roman alphabet is easy, you learn it at school. The alphabet starts with an 'a' and ends with a 'z'. If you have an unsorted list of roman letters you can imagine how it will look after you've sorted it. At the top of the list there are all 'a's, at the bottom there are the 'z's and in between there are all the other letters in a well defined sort order. But besides the 26 lower and 26 upper case letters there are several other special characters of the 7-bit ASCII which also need to be sorted in a standardized way.
 
And here the story begins. Please take into account, that the described effects only appear on Non-Unicode SAP systems, because in such systems the sort sequence from the operating system is used.
 
ABAP or ALV lists normally contain letters or numbers, e.g. family names or street names or material numbers and so on. But to a certain extend there are also some rows in such lists which do not contain alpha numeric values (which refers a-z, A-Z and 0-9 in this document) only but special characters like pound or asterisk. When you try to sort these rows you will get different results depending which operating system the SAP application server is running on. The sort happens on the application server and the results are sent to the GUI. The GUI is not performing any sort operations on lists. We now have different results on different operating systems. As already said, sorting rows which contain strings that do not start with an alpha numeric values are not very common but it may be important how the sorting of the special characters is done.  
 
Let me give you an example: If your professional end users (you may call them 'power users') know that they have to scroll down the list for three pages to get to a certain data set which they want to access it may be confusing if the sorting suddenly changes and the data set isn't there. Please keep in mind, we do not discuss list columns which are sorted by alpha numeric but by special characters.
 
What we haven't discussed so far, what system configuration you have to have in place to see this phenomenon. There are two major examples that can expose the wrong sorting to the end user. I'm not giving any operating system names here. Using OS1 and OS2 as two different ones is enough to describe the situation:
 
1) You have your database, your SAP Central Instance and several SAP Application Servers running on OS1. You figure out, that you have to add additional SAP Application Servers to your system because of a performance bottleneck. The new SAP Application Servers run on OS2. Due to mixed log on groups users may end on an SAP Application Server running on OS1 on day one but on day two they connect to an SAP Application Server running on OS2. The users have different sort orders every day! You can imagine that the end users call the IT department frequently. This may result in reduced productivity of the end users and the administrators as they could get frustrated by time.
 
2) You have a homogeneous system environment. Over the weekend you do a migration from OS1 to OS2. On Monday the users are faced with a new sorting. This also leads to phone calls from the end user to the IT department. The positive aspect compared to situation 1) is, that the changed sorting only happened once, but it is still dissatisfying.
 
I forgot to mention, the most operating systems have in common that these special characters still list before the roman characters. You normally have a list with some special characters and then you have your standard letters and numbers. When saying "most operating systems" there are some, which ignore the special characters while sorting. These operating systems simply ignore special characters (as if they don't exist) and sort only the "remaining" alpha numeric characters. This does have strange effects on such lists because with your eyes you see the special characters but the lists look completely unsorted. You wouldn't recognize them as sorted because your eyes cannot simply ignore the special characters.
 
One operating system which ignores the special characters is Linux. Novell does provide adapted locales starting with SLES10 SP2. The sap-locale package contains a modified de_DE.iso88591 (named de_DE.iso88591@SAP_HP) locale which sorts the special characters based on the HP-UX sorting. Other locales are currently not part of the package and must be requested through the standard Novell support channels. The same counts for Red Hat Enterprise Linux. With Red Hat, customers have to book this service from Red Hat consulting. The SAP note describing the procedure for both distributors is 1069443.
 
In general, the sort sequence changes when switching from any OS to another one. The following table gives you an impression how the sorting of the printable 7-bit ASCII characters is handled. Additionally, the sort sequence according to the ASCII character number is also included.

Every field contains three elements. The first element is the special character, the second element is the decimal ASCII number the third element is the Hexadecimal ASCII number.

 

command:sortsortsortsort -dsort -d
ASCIIWindowsLinuxSolarisAIXHP-UX
32 20' 39 270 48 3032 2032 2032 20
! 33 21- 45 2D{ 123 7B` 96 60{ 123 7B{ 123 7B
" 34 2232 20| 124 7C^ 94 5E| 124 7C| 124 7C
# 35 23! 33 21} 125 7D_ 95 5F} 125 7D} 125 7D
$ 36 24" 34 22~ 126 7E- 45 2D~ 126 7E~ 126 7E
% 37 25# 35 231 49 31, 44 2C! 33 21! 33 21
& 38 26$ 36 242 50 32; 59 3B" 34 22" 34 22
' 39 27% 37 2532 20: 58 3A# 35 23# 35 23
( 40 28& 38 26! 33 21! 33 21$ 36 24$ 36 24
) 41 29( 40 28" 34 22? 63 3F% 37 25% 37 25
* 42 2A) 41 293 51 33. 46 2E& 38 26& 38 26
+ 43 2B* 42 2A# 35 23' 39 27' 39 27' 39 27
, 44 2C, 44 2C$ 36 24" 34 22( 40 28( 40 28
- 45 2D. 46 2E% 37 25( 40 28) 41 29) 41 29
. 46 2E/ 47 2F& 38 26) 41 29* 42 2A* 42 2A
/ 47 2F: 58 3A' 39 27[ 91 5B+ 43 2B+ 43 2B
0 48 30; 59 3B( 40 28] 93 5D, 44 2C, 44 2C
1 49 31? 63 3F) 41 29{ 123 7B- 45 2D- 45 2D
2 50 32@ 64 40* 42 2A} 125 7D. 46 2E. 46 2E
3 51 33[ 91 5B+ 43 2B@ 64 40/ 47 2F/ 47 2F
4 52 34\ 92 5C, 44 2C* 42 2A: 58 3A: 58 3A
5 53 35] 93 5D4 52 34/ 47 2F; 59 3B; 59 3B
6 54 36^ 94 5E- 45 2D\ 92 5C< 60 3C< 60 3C
7 55 37_ 95 5F. 46 2E& 38 26= 61 3D= 61 3D
8 56 38` 96 60/ 47 2F# 35 23> 62 3E> 62 3E
9 57 39{ 123 7B5 53 35% 37 25? 63 3F? 63 3F
: 58 3A| 124 7C: 58 3A+ 43 2B@ 64 40@ 64 40
; 59 3B} 125 7D; 59 3B< 60 3C[ 91 5B[ 91 5B
< 60 3C~ 126 7E< 60 3C= 61 3D\ 92 5C\ 92 5C
= 61 3D+ 43 2B= 61 3D> 62 3E] 93 5D] 93 5D
> 62 3E< 60 3C> 62 3E| 124 7C^ 94 5E^ 94 5E
? 63 3F= 61 3D? 63 3F~ 126 7E_ 95 5F_ 95 5F
@ 64 40> 62 3E@ 64 40$ 36 24` 96 60` 96 60
A 65 410 48 306 54 360 48 300 48 300 48 30
B 66 421 49 317 55 371 49 311 49 311 49 31
C 67 432 50 328 56 382 50 322 50 322 50 32
D 68 443 51 33[ 91 5B3 51 333 51 333 51 33
E 69 454 52 34\ 92 5C4 52 344 52 344 52 34
F 70 465 53 35] 93 5D5 53 355 53 355 53 35
G 71 476 54 36^ 94 5E6 54 366 54 366 54 36
H 72 487 55 37_ 95 5F7 55 377 55 377 55 37
I 73 498 56 389 57 398 56 388 56 388 56 38
J 74 4A9 57 39` 96 609 57 399 57 399 57 39
K 75 4BA 65 41A 65 41A 65 41A 65 41A 65 41
L 76 4Ca 97 61a 97 61a 97 61B 66 42B 66 42
M 77 4DB 66 42B 66 42B 66 42C 67 43C 67 43
N 78 4Eb 98 62b 98 62b 98 62D 68 44D 6844
O 79 4FC 67 43C 67 43C 67 43E 69 45E 69 45
P 80 50c 99 63c 99 63c 99 63F 70 46F 70 46
Q 81 51d 100 64d 100 64d 100 64G 71 47G 71 47
R 82 52D 68 44D 68 44D 68 44H 72 48H 72 48
S 83 53e 101 65e 101 65e 101 65I 73 49I 73 49
T 84 54E 69 45E 69 45E 69 45J 74 4AJ 74 4A
U 85 55f 102 66f 102 66f 102 66K 75 4BK 75 4B
V 86 56F 70 46F 70 46F 70 46L 76 4CL 76 4C
W 87 57g 103 67g 103 67g 103 67M 77 4DM 77 4D
X 88 58G 71 47G 71 47G 71 47N 78 4EN 78 4E
Y 89 59h 104 68h 104 68h 104 68O 79 4FO 79 4F
Z 90 5AH 72 48H 72 48H 72 48P 80 50P 80 50
[ 91 5Bi 105 69i 105 69i 105 69Q 81 51Q 81 51
\ 92 5CI 73 49I 73 49I 73 49R 82 52R 82 52
] 93 5Dj 106 6Aj 106 6Aj 106 6AS 83 53S 83 53
^ 94 5EJ 74 4AJ 74 4AJ 74 4AT 84 54T 84 54
_ 95 5Fk 107 6Bk 107 6Bk 107 6BU 85 55U 85 55
` 96 60K 75 4BK 75 4BK 75 4BV 86 56V 86 56
a 97 61l 108 6Cl 108 6Cl 108 6CW 87 57W 87 57
b 98 62L 76 4CL 76 4CL 76 4CX 88 58X 88 58
c 99 63m 109 6Dm 109 6Dm 109 6DY 89 59Y 89 59
d 100 64M 77 4DM 77 4DM 77 4DZ 90 5AZ 90 5A
e 101 65n 110 6En 110 6En 110 6Ea 97 61a 97 61
f 102 66N 78 4EN 78 4EN 78 4Eb 98 62b 98 62
g 103 67o 111 6Fo 111 6Fo 111 6Fc 99 63c 99 63
h 104 68O 79 4FO 79 4FO 79 4Fd 100 64d 100 64
i 105 69p 112 70p 112 70p 112 70e 101 65e 101 65
j 106 6AP 80 50P 80 50P 80 50f 102 66f 102 66
k 107 6Bq 113 71q 113 71q 113 71g 103 67g 103 67
l 108 6CQ 81 51Q 81 51Q 81 51h 104 68h 104 68
m 109 6Dr 114 72r 114 72r 114 72i 105 69i 105 69
n 110 6ER 82 52R 82 52R 82 52j 106 6Aj 106 6A
o 111 6Fs 115 73s 115 73s 115 73k 107 6Bk 107 6B
p 112 70S 83 53S 83 53S 83 53l 108 6Cl 108 6C
q 113 71t 116 74t 116 74t 116 74m 109 6Dm 109 6D
r 114 72T 84 54T 84 54T 84 54n 110 6En 110 6E
s 115 73u 117 75u 117 75u 117 75o 111 6Fo 111 6F
t 116 74U 85 55U 85 55U 85 55p 112 70p 112 70
u 117 75v 118 76v 118 76v 118 76q 113 71q 113 71
v 118 76V 86 56V 86 56V 86 56r 114 72r 114 72
w 119 77w 119 77w 119 77w 119 77s 115 73s 115 73
x 120 78W 87 57W 87 57W 87 57t 116 74t 116 74
y 121 79x 120 78x 120 78x 120 78u 117 75u 117 75
z 122 7AX 88 58X 88 58X 88 58v 118 76v 118 76
{ 123 7By 121 79y 121 79y 121 79w 119 77w 119 77
| 124 7CY 89 59Y 89 59Y 89 59x 120 78x 120 78
} 125 7Dz 122 7Az 122 7Az 122 7Ay 121 79y 121 79
~ 126 7EZ 90 5AZ 90 5AZ 90 5Az 122 7Az 122 7A

The HP-UX and AIX sorting are similar, but the sort binary on these two platforms doesn't do the sort like on Linux or Solaris. I had to pass the -d option, but the result is not the same. Anyway, for the Linux sorting you can clearly see, that the Linux column is sorted after the numbers behind the special characters. They are just ignored (as already mentioned).

A solution for the different sort sequences is very simply. Switch from your Non-Unicode SAP system to an Unicode SAP system! Starting with Unicode, the sort sequences are inside the SAP kernel and they are the same for all platforms. Your end users will be gradeful.

1 Comment