‎2007 Apr 25 8:56 AM
I recognized that sorting an internal table "AS TEXT" sorts the table ignoring the case (upper / lower case) of the text, while sorting without "AS TEXT" sorts first upper case letters from A to Z and then lower case lettters from a to z.
In the documentation of the sort keyword, i did not find anything about this.
Does it happen on all systems?
(this is the docu:
<i><b>... AS TEXT</b>
Effect
The addition AS TEXT specifies that text-type components are sorted according to the locale of the current text environment. If AS TEXT is not specified, text-type components are sorted according to the coding in the code page of the current text environment. This specification can be overwritten for individual text-type components in the explicit sort key sort_key. The text environment is set when an internal session is opened, or using the statement SET LOCALE.
Notes
Sorting without the AS TEXT addition is considerably faster than sorting using the addition. If text-type components only contain characters of the ASCII character set, both sort options result in the same sort order and the addition AS TEXT is not necessary.
The result of lexicographic sorting depends on the operating system of the application server. While the sequence of the individual letters that belong to the activated language is the same for all operating systems, there are differences in the characters that do not belong to the alphabet of the activated language. When sorting whole words, there are also slight differences even if only using letters from the alphabet of the activated language. The order of upper and lower case letters also depends on the operating system.
For the AS TEXT addition to function correctly, the profile parameter install/collate/active must not have the value 0. )</i>
‎2007 Apr 25 10:26 AM
u can check the difference her
REPORT ychatest LINE-COUNT 30.
DATA : BEGIN OF itab OCCURS 0,
field(5),
END OF itab.
itab-field = 'Asdf'.
APPEND itab.
itab-field = 'adFR'.
APPEND itab.
SORT itab BY field AS TEXT.
WRITE : / 'Using AS TEXT'.
LOOP AT itab.
WRITE : / itab-field.
ENDLOOP.
SORT itab BY field.
WRITE : / 'without Using AS TEXT'.
LOOP AT itab.
WRITE : / itab-field.
ENDLOOP.
‎2007 Apr 25 10:20 AM
Hi,
I think it will hapen all the time because it should have been using theascci values to compare the strings when we say 'AS TEXT'.
When we dont say that it will compare the integral values and everything.
<b>Reward if useful</b>
Sudheer
‎2007 Apr 25 10:26 AM
u can check the difference her
REPORT ychatest LINE-COUNT 30.
DATA : BEGIN OF itab OCCURS 0,
field(5),
END OF itab.
itab-field = 'Asdf'.
APPEND itab.
itab-field = 'adFR'.
APPEND itab.
SORT itab BY field AS TEXT.
WRITE : / 'Using AS TEXT'.
LOOP AT itab.
WRITE : / itab-field.
ENDLOOP.
SORT itab BY field.
WRITE : / 'without Using AS TEXT'.
LOOP AT itab.
WRITE : / itab-field.
ENDLOOP.
‎2007 Apr 25 10:52 AM
Can you let us know your OS and your install/collate/active parameter? I can compare with ours.
In HP-UX / install/collate/active default space it seems to work fine.
Peter
‎2007 Apr 25 12:22 PM
The question is, if SORT....AS TEXT will sort independently of upper/lower case, and if it works like this independently on all OS and with all parameter settings.
If some rare special characters are sorted in a different way on different machines, it is OK, but sorting simple upper and lower case letters should be the same on all machines, othervise, I'd rather not use it.
So, my machine is a Windows NT and SORT...AS TEXT works fine. What about yours?
‎2007 Apr 25 12:47 PM
Hi Daniel,
Based on this part of the help I understood, that it won't be the same on different OS:
<i>The order of upper and lower case letters also depends on the operating system. </i>
I think setting this profile parameter can change the oder:
<i>For the AS TEXT addition to function correctly, the profile parameter install/collate/active must not have the value 0.</i>
I never noticed, but now I found it very strange.
Fortunately it seems to work fine on HP-UX.
Best regards,
Peter
‎2007 May 18 10:43 AM
U need to <b><u>award points for all the useful replies</u></b>, and also u nees to <b><u>mark it as Answered if ur problem is solved</u></b>.
Regards
Sudheer