Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unicode conversion Issue

Former Member
0 Likes
600

Hi,

We are using excel macros to load vendors.

VB script in excel will call extenral RFC in SAP to validate and load vendors. SAP being an Unicode system and excel a non unicode system, is giving us issues while loading foreign characters other than english.

For example, if we populate name in excel as "тест для макса" and once SAP validates the data these characters on excel get converted to "?????".

Does anyone had similar issue? If yes, how did you deal with it?

1 REPLY 1
Read only

Former Member
0 Likes
408

Sounds like something might go wrong with your code pages/used encodings. I.e. if I understand you correct you start off with data in Excel, that you then validate and the data changes? So I'm assuming that you're doing more than just validating...

Anyhow, I doubt that you can label Excel as a non-Unicode application. E.g. in Excel 2007 you can clearly see that it handles Unicode, when you select some text and then paste it into Excel. However, instead of choosing the paste button, choose Paste special and you will see the option Unicode text. Also, when saving a worksheet in format xslx you can clearly see that the XML files contained in the xlsx archive (you'll see what I mean if you open the xslx file with a tool that you'd normally use for ZIP files) are encoded in UTF-8.

I've seen some really old comments saying that VBA cannot handle Unicode, but I'm pretty sure that's no longer true (and was only applicable for really old Office versions)...

I'm wondering if the issue is that your RFC call uses the OS code page, whereas Excel actually does use some Unicode encoding. Unfortunately I couldn't find quickly anything useful (apart from a description in the Office help that explained how to pick the encoding for Word and that Word in general stores data in UTF-8). So I'd personally start with some basic steps:

<ol>

<li>Check if you're using the right RFC library (see OSS note [1005832|https://service.sap.com/sap/support/notes/1005832]</li>

<li>Check if you're setting the code page before calling your RFC; if not consider/try setting it (see OSS note [991572|https://service.sap.com/sap/support/notes/991572])</li>

<li>Debug coding, possibly activating full trace for RFC and check where results go wrong</li>

</ol>

Cheers, harald