Closed shuufi closed 5 years ago
Children is not a function, see properties and methods of var children = conn.Children; may be var child = conn.Children[0];
вт, 21 мая 2019 г. в 04:16, Shuufi Sapli notifications@github.com:
Done a number of Python-based application that automates certain processes in SAP via the SAP Scripting. Trying to do via NodeJs/Winax.
In Python
import win32com import win32com.client
app = win32com.client.Dispatch("Sapgui.ScriptingCtrl.1") conn = self.app.OpenConnection("SAP Connection String", True) session = self.conn.Children(0) # Children is a property of Connection object.
In JS
require('winax'); var app = new ActiveXObject('Sapgui.ScriptingCtrl.1'); var conn = app.OpenConnection('[SAP Connection String]', true); var session = conn.Children(0); // Trying to fetch the first Children, similar to step above.
The JS code will fail at the conn.Children(0) with error Error: DispInvoke: Children Type mismatch.. Why that's the case?
From VSCode debug [image: conn inspect] https://user-images.githubusercontent.com/3444352/58061518-09771780-7ba9-11e9-9b99-fa144e2294d4.PNG
Connection API [image: conn API] https://user-images.githubusercontent.com/3444352/58061525-14ca4300-7ba9-11e9-8cf8-be5f317e58fe.PNG
Thank you. Appreciate some help here.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/durs/node-activex/issues/49?email_source=notifications&email_token=AAEMMNONW45LJAHAS2KW6R3PWNEQXA5CNFSM4HOGR7H2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GU3D4CA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEMMNO3EYQZOOVZHQNF5GLPWNEQXANCNFSM4HOGR7HQ .
Solved by using var session = conn.Children[0];
. Great, thanks for the help, and the package!
Hi I have tried this solution.
It's currently working with and been able to open and connect to SAP.
However, since it's using class object sapgui.scriptingctrl.1 it is opening an instance with different UI (this UI, I believe is opened when you directly connect to the server) there's too many missing buttons and all.
There's a working one using VBScript which is to getObject("SAPGUI"). However, when I tried. var app = new ActiveXObject("SAPGUI");
I received this error: Error: CreateInstance: SAPGUI Invalid class string
I'm not sure if it's related to different of new activeXObject vs getObject as the latter is more of attaching to current running objects?
I was able to work it out, by enabling the missing buttons and fields in the accessibility.
Thank you :)
Have done a number of Python-based application that automates certain processes in SAP via the SAP Scripting in the past. Trying to do similar via NodeJs/Winax.
In Python
In JS
The JS code will fail at the
conn.Children(0)
with errorError: DispInvoke: Children Type mismatch.
. Why that's the case?From VSCode debug
Connection API
Thank you. Appreciate some help here.