title: SAP GUI Scripting pop up message
body: <p>I am seeing this error pop up message which i do not know about it's <code>findbyId</code>, may i know how can i get its <code>findById</code>? Also im using VBA to do scripting for SAP, how can i <code>catch</code> the <code>findById</code> and do some actions if i found it? I know that there are <code>sbar</code> error messages but it is not the one that im having problem with. Below is a picture of the pop up error message.<a href="https://i.stack.imgur.com/Lfatt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lfatt.png" alt="enter image description here"></a></p>
  
  <p>Edit:</p>
  
  <pre><code>Sub Migo()
  
  Dim i As Integer
  
  If Not IsObject(Aplication) Then
      Set SapGuiAuto = GetObject("SAPGUI")
      Set Aplication = SapGuiAuto.GetScriptingEngine
  End If
  If Not IsObject(Connection) Then
      Set Connection = Aplication.Children(0)
  End If
  If Not IsObject(session) Then
      Set session = Connection.Children(0)
  End If
  If IsObject(WScript) Then
      WScript.ConnectionObject session, "on"
      WScript.ConnectionObject Aplication, "on"
  End If
  
  i = 0
  j = 1
  With session
      .findById("wnd[0]").maximize
      .findById("wnd[0]/tbar[0]/okcd").Text = "MIGO"
      .findById("wnd[0]").sendVKey 0
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_HEADER:SAPLMIGO:0101/subSUB_HEADER:SAPLMIGO:0100/tabsTS_GOHEAD/tabpOK_GOHEAD_GENERAL/ssubSUB_TS_GOHEAD_GENERAL:SAPLMIGO:0112/txtGOHEAD-BKTXT").Text = Cells(1, 8)
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-MAKTX[1,0]").Text = Cells(7, 2)
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/txtGOITEM-ERFMG[4,0]").Text = Cells(7, 4)
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-LGOBE[6,0]").Text = "BORD"
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-NAME1[12,0]").Text = "2S98"
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-UMLGOBE[27,0]").Text = "DMDV"
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-UMBAR[32,0]").Text = "CATNEW"
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-UMBAR[32,0]").SetFocus
      .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-UMBAR[32,0]").caretPosition = 6
      .findById("wnd[0]").sendVKey 0
      While Cells(8 + i, 1).Value &lt;&gt; ""
          .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-MAKTX[1,1]").Text = Cells(8 + i, 2)
          .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/txtGOITEM-ERFMG[4,1]").Text = Cells(8 + i, 4)
          .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-LGOBE[6,1]").Text = "BORD"
          .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-NAME1[12,1]").Text = "2S98"
          .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-UMLGOBE[27,1]").Text = "DMDV"
          .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM/ctxtGOITEM-UMBAR[32,1]").Text = "CATNEW"
          .findById("wnd[0]").sendVKey 0
          .findById("wnd[0]/usr/ssubSUB_MAIN_CARRIER:SAPLMIGO:0006/subSUB_ITEMLIST:SAPLMIGO:0200/tblSAPLMIGOTV_GOITEM").verticalScrollbar.Position = j
          .findById("wnd[0]").sendVKey 0
          i = i + 1
          j = j + 1
      Wend
  End With
  End Sub
  </code></pre>
  
  <p>So the error happens inside the <code>while</code> loop sometimes</p>