Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Switch between two open windows simple

Former Member
0 Likes
635
  • SAP Managed Tags

Hey team! I need help switching between two windows in SAP using only SAP. My code is below but it keeps returning errors. I've done quite a bit of research and just can't figure it out.. If possible please modify this code to show me the correct version with an explanation. That would literally help so much.

'MsgBox ("STO made.. will now attempt to post")

'Set session = application.ActiveSession(1) - TRIED THIS IT DIDN'T WORK

'sapcon.children(1).select - TRIED THIS IT DIDN'T WORK

Set SapGuiAuto = GetObject("SAPGUI")

Set SapApp = SapGuiAuto.GetScriptingEngine

With SapApp.Connections(0).sessions(0)

.createsession

End With

k = SapApp.Connections.Item(0).sessions.Count

Set Session = SapApp.Connections.Item(0).sessions.Item(CLng(k - 1))

0 REPLIES 0