I have to migrate a vb6 program to C# .net 3.5 the user starts SAP logon and authenticates, then he can use the tool to fetch and insert the data using the tool.
The problem: I can create a new GuiApplication
object with reflection, but I can't fetch currently opened GuiSession
object with it :/
Here is the vb6 part of the code that gets currently opened GuiApplication
object with all opened GuiSession
objects.
Dim obj As Object
Set obj = CreateObject("SAPGUI")
Set obj = obj.GetScriptingEngine
If TypeName(obj) = "GuiApplication" Then
Set SapAutomationObject = obj
SapAutomationObject.AllowSystemMessages = False
Debug.Print "SAP Automation OK"
End If
I tried it with reflection:
GuiApplication Application = (GuiApplication)System.Activator.CreateInstance(Type.GetTypeFromProgID("SapGui.ScriptingCtrl.1"));
I got an instance but no existing sessions.