Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Script and Multiple Sessions.

Hi everyone. This is my first post here, and I'll admit I'm rather inexperienced with scripting, so any help you can provide is appreciated!

We are using a new document imaging program that retrieves values from SAP using scripting. There seems to be a issue when people open multiple SAP sessions, it keeps wanting to retrieve the values from the first session opened.

We would like to have it so what ever SAP session that was last used before running the script, is the values that are used.

Below is a example of one of our scripts. The field3, tab and folder values are values in my imaging system. This script works, but again it will only take the values of the first SAP session opened. We want one that can take it any active session, not just the first.

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

Set connection = application.Children(0)

Set session = connection.Children(0)

field3=session.findById("wnd[0]/usr/ctxtBKPF-BUDAT").text

tab=session.findById("wnd[0]/usr/txtBKPF-XBLNR").text

folder=session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").text

Thanks in advance for any suggestions!

Former Member
Not what you were looking for? View more on this topic or Ask a question