-1

I'm trying to download some documents via SAP GUI using Python, but I get them with a wrong encoding.

When I tried UTF8 manually - i got the wrong encoding. Changed Codepage settings in connection options to ANSI encoding and was glad to see fine results working manually.

But with the same SAP connection SAP GUI Scripting proceeds getting same wrong results, as it was with UTF8. Encoding errors come only when icon "SAP GUI Scripting: Script is running" is on. As I understand, on Windows server SAP GUI always uses utf8 with Scripting, ignoring my connection settings.

In SAP GUI Scripting API I found SaveAsUnicode session property, which is True by default: session.saveAsUnicode = 0 makes it False, but it does not help. All other methods, connected with code-page are read-only.

So how can I force SAP GUI use different encoding, use my settings downloading files?

Anton Makarov
  • 562
  • 3
  • 12
  • 1
    I think the link you provide doesn't concern SAP GUI Scripting at all. Please indicate how your script downloads the documents and provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Sandra Rossi Jan 12 '21 at 07:36
  • Deleted a link. Edited. SaveAsUnicode is a property, offcourse, edited. – Anton Makarov Jan 12 '21 at 08:38

1 Answers1

0

Solved with the use of a SAP Logon Shortcut. If we connect with it, but not with a call of SAPGui.exe, the coding is perfect. We even have written a self-made decoder for windows 1251 for this problem, but did not need it, because of the use of shortcut.

Anton Makarov
  • 562
  • 3
  • 12