Skip to Content

Unicode Handling for MS SQL Server

An old healthy interfaces recently moved to error zone due to a requirement pop-up that sender R/3 system would now be sending Greek characters to receiver MS SQL Server database. The Idoc would have some entries like below.



The problem started right from start with PI Integration Enigne unable to recognize the characters and displaying only “#” as shown.



The problem was however very well solved by editing the RFC destination at R/3 from non-unicode to unicode. After the change, the message was as below:



Quite happy with our swift resolution of problem, we monitored  the message in sxmb_moni and then in RWB for jdbc receiver. As expected, it results didn’t  turned us down. So far so good.

Then the complaint initiated from receiver systems hosting MS SQL Server database. The problem was that they seems to receive all Greek characters sent by PI replaced by a new character – “?” this time. The shy database unveils the following view:




First we thought that it should be database related setting, but they confirmed that manually inserting the characters work for them. The target of our initial suspicion and investigation was the connection URL, but unfortunately we couldn’t prove the case against him. Slowly, we were accepting that something needs to be done at PI. And then we found out what exactly has to be done.

The important point to be added in mapping is as shown below.

  1. We need to set an indicator ‘N’ in front of the actual special character string while performing the mapping. The special characters in this case should be surrounded by single quotes.



      2.   We need to edit the datatype and add the attribute “hasQuotes”



The new datatype would look like this:



And thats it. We are done. Now the database seems to be shining in full glow: 



We concluded the following:

  • MS SQL Server database does not behave as expected if we just change only the connection URL. The connection URL solution usually works for other databases.
  • There is no way PI could understand that the data is not placed in proper format (in integration engine monitoring or message monitoring) unless a specific check is made at the receiver side.
You must be Logged on to comment or reply to a post.
  • Hi Prateek,
    Can you please mention the references or any technical documents that mention this kind of mandate?
    Is this a trial and error solution or proposed by SAP?

    Thanks & Regards,

    • It started with trial and error and I included the hasQuot attribute in datatype and the single quotes in mapping. But it didnt work. The only thing missing was character ‘N’ which was suggested in JDBC FAQ on SAP Notes.

      Best Regards,

      • Hi Prateek
        My Sceanrio is Idoc to File, when we are giving greek or other laanguages, it showing ###### in Sender side in MONI of PI and in the receiver side i am getting the following hasQuotes=”no”>N’#### ###’
        hasQuotes=”no”>N’###########’ .
        I ahve followed your blog and made the required changes in the mapping.
        Could you please suggest where i am going wrong.

        Thanx in advance

  • Hi Prateek,

    Just a small doudt.

    how does adding N as prefix for the data makes significant can you please clarify more on this ?



    • Manoj, after 6 years of writing this I should have the privilege of saying I don’t remember 😉

      As mentioned in my other comment, it was a suggestion in SAP Note 831162 Q 27 and that’s what we implemented. Not sure how it worked internally.