02-01-2017 8:36 AM - edited 02-03-2024 7:48 PM
I have a VBA-script in Excel to download data from SAP. Everything works fine, but when it's launched it always takes an existing SAP-session to run the script (even if another transaction was open in that session). So, I'd like to first open an new SAP-session to run the script there, but haven't found a solution yet.
Here's the beginning of my current script:
Sub ExportSAP()
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApp = SapGuiAuto.GetScriptingEngine
Set SAPCon = SAPApp.Children(0)
Set session = SAPCon.Children(0)
session.StartTransaction "CADO"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[17]").press
session.findById("wnd[1]/usr/txtV-LOW").Text = "BE51_PTW/MD"
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.