0

I developed a .NET 4.6 Framework project (X64) with access to the running sap-instance. to connect to sap i used the exactly same way as the SAP-Script:

Script-Version:

Set SapGuiAuto  = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
...

.Net Framework 4.6.2 / .Net6 Version:

Dim SapGuiAuto  = GetObject("SAPGUI")
Dim application = SapGuiAuto.GetScriptingEngine`
Dim SAPCONN = application.connections(0)
Dim SAPSESS = SAPCONN.children(0)
SAPSESS.findById("wnd[0]").ElementVisualizationMode = False

In .NET Framework 4.6, I got access to an SAP system and the connection was working.

Now I updated to .NET 6 and the first code line (SapGuiAuto) reports this error:

Fehler beim Laden der Typbibliothek/DLL. (0x80029C4A (TYPE_E_CANTLOADLIBRARY))

Second line then crashes because object has no type GetScriptingEngine. It looks like some files are missing but if this would be the case it should not work in .NET 4.6 project.

On the same computer, same installations if I try the same again in .NET 4.6.2, it is still working ... What am I doing wrong? Can it be that GetObject behaves not the same in different framework versions? What can I do to fix this issue?

Thank you in advance for your help!

NB: I already tried to add/and remove the COM libraries (SAPFEwse) from the project but this seems to make absolutely no difference if this is included or not...

I tried also to install the outdated nuget library "SAP.GUI.Scripting.Net". which in fact is just ROT WRAPPER and the SAPFEWSE Library. Also no success with this Library.

2
  • Could this one help?
    – Uwe Keim
    Commented Jun 20, 2023 at 12:15
  • What is the target you compile for? If you are using COM objects, it should be set to a "windows" target, COM objects don't work on other platforms. Can you double check that that is the case?
    – nvoigt
    Commented Jun 22, 2023 at 5:00

1 Answer 1

-1

.NET 4.8 and .NET 6 are not compatible, there have been a lot of breaking changes. Basically .NET 5 / 6 / 7 are what has been called .NET Core in the past. The assemblies are not binary compatible. So basically you can't use a .NET 4.8 Assembly (SAP) in .NET 6. Check whether SAP offers a SDK for .NET Core / .NET 5 and above.

Not the answer you're looking for? Browse other questions tagged or ask your own question.