on 07-12-2012 8:48 AM
Hi,
how can i get the syteminfo by script (VbScript / VBA) ?
Sub SAP_Info()
Set SapGuiAuto = GetObject("SAPGUI")
Set SAP = SapGuiAuto.GetScriptingEngine
' get Transaction: VA03
Debug.Print SAP.Children(0).Children(0).info.transaction
' get Windowtitle: Change Sales Order: Initial Screen
Debug.Print SAP.Children(0).Children(0).findbyid("wnd[0]").Text
End Function
Thanks, Mike
Hi Mike,
please try to use the following:
instead the command Debug.Print the command msgbox
Regards,
ScriptMan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mike,
sorry, I misunderstood it. The other commands are as follows:
msgbox "SessionNumber: " & SAP.Children(0).Children(0).info.sessionnumber
msgbox "SystemName: " & SAP.Children(0).Children(0).info.systemname
msgbox "SystemNumber: " & SAP.Children(0).Children(0).info.systemnumber
msgbox "SystemSessionID: " & SAP.Children(0).Children(0).info.systemsessionid
msgbox "Client: " & SAP.Children(0).Children(0).info.client
Regards,
ScriptMan
Hi ScriptMan,
THANK YOU VERY MUCH 🙂
It works perfect!
Thx, Mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Scriptman,
thank you very much.
I have one more question 🙂
How can i loop trough the Connections and Sessions?
The Code below doesn't wotk 🙂
Sub Get_SAP_Info()
Dim iCon As Integer
Dim iSes As Integer
Dim sText As String
On Error Resume Next
Set SapGuiAuto = GetObject("SAPGUI")
Set SAP = SapGuiAuto.GetScriptingEngine
' Systeminfo -> Works fine 🙂
' Debug.Print "SessionNumber: " & SAP.Children(0).Children(0).info.sessionnumber
' Debug.Print "SystemName: " & SAP.Children(0).Children(0).info.systemname
' Debug.Print "SystemNumber: " & SAP.Children(0).Children(0).info.systemnumber
' Debug.Print "SystemSessionID: " & SAP.Children(0).Children(0).info.systemsessionid
' Debug.Print "Client: " & SAP.Children(0).Children(0).info.client
' Loop trough Connections
For iCon = 0 To SAP.Children.Count - 1
Set Connection = SAP.Children(iCon)
' Loop trough Sessions
For iSes = 0 To Connection.Children.Count - 1
Set Session = Connection.Children(iSes)
If Session.info.transaction <> "" Then
Debug.Print Session.info.systemname
Debug.Print Session.info.transaction
Debug.Print Session.findbyid("wnd[0]").Text
End If
Next
Next
' Errors?
If Err.Number <> 0 Then
Debug.Print Err.Number & " - " & Err.Description
End If
Set SapGuiAuto = Nothing
Set SAP = Nothing
End Sub
Thx, Mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.