Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10022

Re: Visual Basic and SAP scripting GUI

$
0
0

Friends really need help here

this is the code i have

 

 

 

Sub StartTransaction(SapGuiAuto, Connection, session)

' Dim SapGuiAuto As Object

Dim i As Long

i = 1

' There may be bad entries in the ROT from previous crashes

While i < 10 And SapGuiAuto Is Nothing

   i = i + 1

   On Error Resume Next

   Set SapGuiAuto = GetObject("SAPGUI")

   On Error GoTo 0

Wend

If SapGuiAuto Is Nothing Then

   MsgBox "Could not connect to SAPlogon process. Did you start it?", vbOKOnly Or vbCritical

   End

End If

On Error Resume Next

Set SAPApplication = SapGuiAuto.GetScriptingEngine

Set SapGuiAuto = Nothing

On Error GoTo 0

If SAPApplication Is Nothing Then

   MsgBox "Could not access GuiApplication. Maybe Scripting is disabled?", vbOKOnly Or vbCritical

   End

End If

Set Connection = SAPApplication.Children(0)

Set session = Connection.Children(0)

End Sub

 

 

Even though i have multiple sap sessions open, it fails at

Set session = Connection.Children(0)


Any help is appreciated



Viewing all articles
Browse latest Browse all 10022

Trending Articles