Syslog Errors when script is executed
I have written my first SAP Script and it does exactly what I want.
I connect through Microsoft Excel (VBA) to SAP, run a transaction and with draw the information I want back into Excel. Everything on the front end seems to work correctly.
However, my SAP Admin told me he is getting a "Connection lost" error every time I connect. Please see the error log...
Holger Köhn replied
Ok. With this code it´s quite visible why you have this syslog entries.
When you call function in a Loop every new step execution of your Queue will connect to SAP and create an session. As this object is only valid as long as function is active this session got disconnected by force when script exit function..
You should create an Sub procedure which open an SAP session and then Loop over your 'getpartRev' Input and use whole time this session.
Or adopt to an open session which you have already open. This is another Approach. Sessions created by SAPGUI.ScriptingCtrl.1 have an limited Screen.