Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: laura love Profile
 | Femeie 23 ani Bihor cauta Barbat 24 - 52 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 795
|
|
I have 2 different SAP servers with different names.
I use the following line of code in VBS to extract the system name:
That displays something like AAA (1) 300, or BBB (1) 500 for the second system.
Actually I need only the first 3 letters from the left to compare, so I used:
If Left(Session.Info.SystemName, 3) = "AAA" Then 'DO SOMETHING Else 'DO SOMETHING ELSE End If |
Other options from SAP from down there, besides System.Info.SystemName, are:
System.Info.SessionNumber System.Info.SystemNumber System.Info.SystemSessionID System.Info.Client System.Info.Transaction System.Info.Program |
You can also use SAP.Children(0).Children(0).Info..... instead of System.Info.
|
|
pus acum 1 an |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 795
|
|
Under Excel, you would have to rename "Session" to "SAP_Session" or something different than just "Session".
Something like:
Sub NAME_OF_SUB()
Application.ScreenUpdating = False
If Not IsObject(SAP_Application) Then On Error Resume Next Set SapGuiAuto = GetObject("SAPGUI") If SapGuiAuto Is Nothing Then MsgBox "Deschide mai intai SAP" Exit Sub End If On Error Resume Next Set SAP_Application = SapGuiAuto.GetScriptingEngine If SAP_Application Is Nothing Then MsgBox "Deschide mai intai SAP" Exit Sub End If On Error GoTo 0 End If
If Not IsObject(oConnection) Then On Error Resume Next Set oConnection = SAP_Application.Children(0) If oConnection Is Nothing Then MsgBox "Deschide mai intai SAP" Exit Sub End If End If
If Not IsObject(SAP_Session) Then Set SAP_Session = oConnection.Children(0) End If
If IsObject(WScript) Then WScript.ConnectObject SAP_Session, "on" WScript.ConnectObject SAP_Application, "on" End If
If SAP_Session.Info.Transaction = "TRANSACTION_NAME" Then MsgBox "You already opened " & SAP_Session.Info.Transaction & ", this subroutine is now closing." Exit Sub End If
' DO SOMETHING
Application.ScreenUpdating = True
End Sub |
|
|
pus acum 1 an |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 795
|
|
Updated also with .Program
|
|
pus acum 1 an |
|