title: VBA to call SAP transaction
body: <p>I am trying to call a SAP transaction from Excel, I use many codes from the internet but still a failure.
  Doesn't matter what code I use, I always get same error message as</p>
  <blockquote>
  <p>A script is opening a connection to system SYSTEM</p>
  </blockquote>
  <p>than error saying:</p>
  <blockquote>
  <p>Runtime error 1000 Error description not avialable&quot;</p>
  </blockquote>
  <p>Than after debug it highlights below in yellow</p>
  <pre><code>Set Connection = SapGuiApp.OpenConnection(&quot;SYSTEM&quot;, True)
  </code></pre>
  <p>its been doing this with all code I tried to pull this.</p>
  <p><strong>Code</strong></p>
  <pre><code>Dim sap As Object 
  Dim conn As Object
   
  Sub T_login()
   
      Set sap = CreateObject(&quot;SAP.Functions&quot;)
      Set conn = sap.Connection
      conn.System = &quot;SYSTEM&quot;
      conn.client = &quot;603&quot;
      conn.user = &quot;LANAX001&quot;
      conn.Password = &quot;alamzeb4&quot;
      conn.Language = &quot;EN&quot;
   
  If conn.logon(0, False) Then
      
      MsgBox &quot;Logon to the SAP system is not possible&quot;, vbOKOnly, &quot;Comment&quot;
   
  Else
   
  End If
   
  If Not IsObject(SapGuiApp) Then
              
      Set SapGuiApp = CreateObject(&quot;Sapgui.ScriptingCtrl.1&quot;)
   
  End If
   
  If Not IsObject(Connection) Then
   
      Set Connection = SapGuiApp.OpenConnection(&quot;SYSTEM&quot;, True)
   
  End If
   
  If Not IsObject(session) Then
   
      Set session = Connection.Children(0)     
      'launch a transaction
      session.findById(&quot;wnd[0]&quot;).Maximize
      session.findById(&quot;wnd[0]/tbar[0]/okcd&quot;).Text = &quot;FS10N&quot;
      session.findById(&quot;wnd[0]&quot;).sendVKey 0
  
  End Sub
  </code></pre>