Skip to end of metadata
Go to start of metadata


To give some help while troubleshooting.


The system does not sort texts in the expected way. Texts with special characters are affected. You need to know what to check on SAP and on OS level.
Note: only non-unicode system are affected.


In non-Unicode systems, the SAP kernel uses the operating system locales for sorting, among other things: Since locales are implemented differently by the individual platforms, the sort sequence is also platform-dependent and may differ in the various operating systems.

In Unicode systems, the sort sequence is defined in the SAP system and is uniformly platform-independent as a result.

What to check on SAP level?

  • Check the locale used by the affected language via RSCP0018 report. At the end of the list there is a section named Locales. Here you will find this information.
  • Example:

  • Check what locale is used by SAP via RSBDCOS0 report, command: locale
  • Example:

In this case this is the EN locale. This will be used for sorting.

What to check on OS level?

  • You can check the current language settings of <sid>adm user by 'locale' command.


  • Create a text file wich includes some of the affected special chatracters as well and some lines for control purposes. The content of file could be:

<text with spec. character desired at 3rd place>
<text with spec. character desired at 1st place>

<text with spec. character desired at 2nd place>

  • Save this file as sort.txt
  • Sort the file by 'sort sort.txt' command
  • Check if it is the same, unexpected sort order as in SAP. If it is, you may change LANG environment variable:
    • in C-Shell (csh): setenv LANG <language> 
    • in Bourne shell (sh): LANG=<language> ;  export LANG

      This is a temporary change that will be valid only for the current session. Other session or SAP won't be affected.
    • Example:

  • Check the sort sequence again, by the same command: 'sort sort.txt'
  • If the sort squence is the desired one, this change could be made permanent: 
    • add
      setenv LANG <language>
      in sapenv_<hostname>.csh
    • add  
      LANG=<language> ;  export LANG
      in sapenv_<hostname>.csh
    • restart SAP system
    • check via RSBDCOS0 by 'locale' command if the new locale is used by SAP
    • check the sort sequence on SAP level

Note: on Linux, the sort sequence may be different by default compared to other unix systems. For details see SAP Note 1069443.

Related Content

Related Documents

Setting Environment Variables

Related SAP Notes/KBAs

SAP Note 1069443: Linux: Different sort sequence

  • No labels