Skip to Content
Author's profile photo Sander van Willigen

Introducing an Add-on for Cleansing Character Strings

As you might know SAP BW does not allow every possible character in character strings. An upload or activation can terminate in such cases. It occurs frequently with character strings where users (or interfaces) can freely enter text.

SAP delivered various Function Modules for validation of character strings. Unfortunately cleansing of character strings is not provided by SAP. It would be very helpful to have a comprehensive ABAP Add-on for cleansing of character strings.

In this blog I would like to introduce such an ABAP Add-on which I developed. Please refer to my document Implementing an Add-on for Cleansing Character Strings for detailed implementation instructions.

Issues with Character Strings

Let’s have a look to a typical example: a source field contains “forbidden hexadecimal characters” (between HEX00 and HEX1F) which are usually not permitted in BW.


Figure 1: Example error message in log


Figure 2: Detailed error message

The error message shows that the character at position 11 (hexadecimal HEX0D) is not permitted. The error message does not show that also the character at position 12 (hexadecimal HEX0A) is not permitted.

Please note by the way that ‘HEX23’ is a documentation error in message BRAIN 315.

Other typical examples are a source field that contains lowercase but the Characteristic only accepts uppercase, or a source field that contains “special characters” which are not allowed.

Allowed and Unallowed Characters

In SAP BW the default allowed characters are:

  • !”%&”()*+,-./:;<=>?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • SPACE symbol

You can maintain permitted extra characters with t/code RSKC. You can also find it in the SAP Customizing Implementation Guide (IMG): SAP NetWeaver > Business Warehouse > General Settings > Maintain Permitted Extra Characters.


Figure 3: Maintenance of permitted extra characters

You can choose between the following three options:

  • ALL_CAPITAL (and nothing else): characters which are uppercase letters in the code page are permitted for data loading;
  • ALL_CAPITAL_PLUS_HEX (and nothing else): equal to ALL_CAPITAL pus hexadecimal HEX00 to HEX1F;
  • Specify “special characters” individually.

Option ALL_CAPITAL is mostly used and can be considered as the “best practice”. SAP does not recommend using ALL_CAPITAL_PLUS_HEX.

Validation of uppercase and lowercase are handled differently. The validation rules which were presented above are applicable for uppercase Characteristic values. The lowercase validation is less strict; only hexadecimal HEX00 to HEX1F are never allowed.

There are two additional exceptions:

  • A Characteristic values that only consists of the single character ‘#’ is not allowed;
  • A Characteristic value starting with ‘!’ is not allowed.

Cleansing Add-on

The Cleansing Add-on is an ABAP Objects Class and is intended to be used in a Transformation Rule. The logic is based on two standard SAP Function Modules in Function Group RSKC:

  • RSKC_CHAVL_CHECK – Check if characteristic value is permitted (uppercase)
  • RSKC_LOWCHAVL_CHECK – Check if characteristic value (with lowercase letters) is permitted

Those Function Modules only contain “validation” functionality. The “cleansing” functionality is added in an RSKC compliant way. The Cleansing Add-on has an easy-to-use interface and can be implemented in any Transformation Rule for a character string using a Routine.

Related Documentation

If you would like to read more about this topic, I can recommend reading the following documentation:


In this blog we discussed the possible issues with character strings. We had a look to the allowed and unallowed characters in the context of SAP BW. Furthermore, I introduced briefly the Cleansing Add-on. Please refer to my document Implementing an Add-on for Cleansing Character Strings for more information re. implementing this Cleansing Add-on and how to use it in Transformation Rules.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Sander,

      One of the not so fun to fix repetitive issue in BW. Yours will be a very useful add-on. Eagerly waiting for your updates.



      Author's profile photo Sander van Willigen
      Sander van Willigen
      Blog Post Author

      Please check out my document Implementing an Add-on for Cleansing Character Strings for detailed implementation instructions. I look forward to receiving your feedback.



      Author's profile photo E. Lokenberg
      E. Lokenberg


      Thanks for this valuable contribution. Good working with you, must repeat that once again ūüėČ

      Author's profile photo Phil Pilkington
      Phil Pilkington

      This looks great however when I implement and test in SE24 it does not work for me.  cl_rs_utilities=>is_ap_system is s private class in my system.  Working around that it dumps at with substring not allowed at   ASSIGN c_chavl(1) TO <chavl>. in both the uppper and lower case methods when an invalid string is encountered.  It doesn't seem to remove a ! in the first character of a string that causes problems but perhaps you have to add it to the list of invalid characters? 

      Author's profile photo Sander van Willigen
      Sander van Willigen
      Blog Post Author

      Hi Phil,

      Thanks for your feedback.

      Please note that I replaced the attached file of document Implementing an Add-on for Cleansing Character Strings with an updated version 2. This new version is developed in SAP BW release 7.4 SP 11 and some minor issues (e.g. with class CL_RS_UTILITIES) are solved.

      Please try the coding of the new version 2. If you still experience any problems, please inform me the release and SP level of your system. I would also like to know in which method(s) the problems occur. Thanks in advance.

      Best regards,


      Author's profile photo Edwin Ryan
      Edwin Ryan

      Hi Sander,

      What reason do SAP give for not recommending ALL_CAPITAL_PLUS_HEX? (and why, in that case, have they made it available?)



      Author's profile photo Sander van Willigen
      Sander van Willigen
      Blog Post Author

      Hi Ed,

      ALL_CAPITAL was at some point in time restricted and does not allow hexadecimal HEX00 to HEX1F for uppercase characteristic values anymore (for lowercase it was never allowed). ALL_CAPITAL_PLUS_HEX was introduced for backward compatibility reasons. However, SAP does not recommend this procedure because it can cause problems during further processing and reporting. Please refer to SAP Note 1075403 - Unallowed characters and ALL_CAPITAL for more details.

      Best regards,


      Author's profile photo Edwin Ryan
      Edwin Ryan

      Thanks Sander

      I suppose I'm asking specifically what problems might arise in further processing / reporting if I allow these characters. They would be in characteristics intended for display use rather than navigational...


      Author's profile photo Former Member
      Former Member

      Hi Sander,

      Nice Blog.
      But I need a something different.
      I need to handle special characters for Unicode system. R/3 is in Unicode. So, the standard program to handle special characters contain the constants for English alphabet. This will not work because Chinese,portugese etc languages may come.
      How can I handle the special characters for these. Is there are idea on a generic program with hard coding the characters to vaidate whether the incoming text is valid or not ?
      Thanks in advance !!

      Author's profile photo Luc Vanrobays
      Luc Vanrobays


      Hi Sander, thanks for this clean and nice approach.

      Using v2 and testing on routine input with value "E!" doesn't clean the exclamation and ends up with SID activation failure...

      Testing with leading exclamation cleans the following characters.

      Any suggestion or testing on your side is welcome, I added extra code in the meantime...

      SPAN {
      font-family: "Courier New";
      font-size: 10pt;
      color: #000000;
      background: #FFFFFF;
      .L0S32 {
      color: #3399FF;
      .L0S52 {
      color: #0000FF;
      .L0S55 {
      color: #800080;
        IF RESULT CA l_spec.
      l_length = strlen( RESULT ).
      ASSIGN result(1) TO <chavl>.
      DO l_length TIMES.
      IF <chavl> CA l_spec.
      <chavl> = i_replace_char.
      ASSIGN <chavl> INCREMENT 1 TO <chavl> RANGE RESULT.

      By the way, what are AP Systems ? Analytical Platforms vs Business Suite ?