Skip to Content
avatar image
Former Member

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 05, 2007 at 11:21 PM

    Hello Jason,

    see the "Programming API", which is available under "SAP GUI scripting" at http://service.sap.com/sapgui .

    The GuiApplication object has a property ActiveSession, which points to the Session that the user is currently working with, which will be the topmost window.

    Best regards

    Rolf-Martin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I will definitely do that. I am having some developers I know look at it as well, so hopefully we will have something soon.

      Steve