0

I have VBA in Excel 32 bits that can upload Sales Orders into SAP ERP software. In order to get the code to run on 64 bits Excel, I uninstalled current SAP GUI and installed SAP GUI 7.70. I now get an error:

Run-time error '-2147417848 (80010108)':

Automation error
The object invoked has disconnected from its clients

Here is a code snapshot with error at line sap_sales_order = boOrder.SalesDocument:

'Call the method
boOrder.CreateFromDat2 orderheaderin:=boHeader, _
                       ordertext:=boText, _
                       orderpartners:=boPartner, _
                       orderitemsin:=boItemin, _
                       orderschedulesin:=boSchedin, _
                       orderconditionsin:=boCondin, _
                       Return:=oReturn

sap_sales_order = boOrder.SalesDocument

'Check if a error-message was returned
bError = False

I just referenced the 4 new DLL's in VBA... No Change.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Tim
  • 1
  • 2
  • 5
    Please note that pictures of code don't work here - instead [edit] your question with the code as text. – BigBen Oct 27 '21 at 20:09
  • 1
    download latest patch. Insert wait after createfromdat2. login to gui before launching excel. – david Oct 28 '21 at 00:36
  • I edited the question to turn the code image into text – Sandra Rossi Oct 28 '21 at 03:06
  • and post always full code with declarations, not just the acting piece. It matters – Suncatcher Oct 28 '21 at 08:42
  • Thank you all, @david, I am on 770. i paused the code for 40 seconds after the above CreateFromDat2. Same error. – Tim Oct 28 '21 at 21:22
  • Please tell us which 7.70 patch level it is, which DLLs you are referring to (including the path), and as Suncatcher said, provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) like very simple example with `BAPI_BANK_CREATE` which is very simple and should work for everyone (minimal info with country, code and name) – Sandra Rossi Oct 31 '21 at 10:58
  • Thank you all for your help! I am on SAP GUI for Windows 7.70 (Patch 0) – Tim Nov 01 '21 at 13:15
  • Now on Patch 4. (Rebooted). I Added to References the 4 .ocx controls from C:\Program Files\SAP\FrontEnd\SapGui\. I initiated a :45 second pause after the boOrder.CreateFromDat2 orderheaderin:=boHeader, _ ordertext:=boText, _ orderpartners:=boPartner, _ orderitemsin:=boItemin, _ orderschedulesin:=boSchedin, _ orderconditionsin:=boCondin, _ Return:=oReturn Line – Tim Nov 01 '21 at 20:42

1 Answers1

0

I see that the SAP note 2153672 ("SAP GUI BAPI : Error Message "Automation Error -2147417848 The object invoked has disconnected from its clients" displayed") says:

It happens when a corrupt BAPI object is trying to query a member attribute or method or a key field.

and to install the latest SAP GUI patch.

So, if you have already installed the latest SAP GUI 7.70 patch, please contact the SAP support.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48