Hello Stefan,
I have a similar issue. And I thought it's the same as Lucien has described but now I'm not so sure. Whenever I run a macro to do some stuff in a system I have to implement the system logoff as well in order to something in another system. If I already have a system open, then my macro for the next automated procedure just opens the next system and logs on. After that the procedure stops.
I've diagnosed this as the connection issue by using the sap scripting tracker tool (Scripting Tracker - Development Tool for SAP GUI Scripting).
The first open system has the ID of
/app/con[0]/ses[0]/wnd[0]
and the second one has the Id of
/app/con[1]/ses[0]/wnd[0]
Notice the con element incremented by one.
In my code I'm only calling the IDs by for example "session.findById("wnd[0]/usr/txtRSYST-MANDT")" leaving out the /app/con[0]/ part. Hence The script doesn't know which one to activate and perform the actions. Am I right?
Can this be bypassed by either explicitly calling also the connection element or by implementing some sort of connection count array to track all opened connections?
Kind regards,
Sebastjan