+ Reply to Thread
Results 1 to 4 of 4

CreateObject("SAP.BAPI.1") is not working with office365

  1. #1
    Registered User
    Join Date
    10-29-2020
    Location
    Saudi Arabia
    MS-Off Ver
    office365
    Posts
    2

    Question CreateObject("SAP.BAPI.1") is not working with office365

    I am using the below code for one of my macro which is connected with SAP , it post different transactions in SAP using a BAPI control.

    The issue is that same code is working for all previous versions of excel and windows. but when we updated office to office365 and windows to windows10, it stops working and shows "429 ActiveX component can't create object" whereas when we use the same code in older version it is still working.

    can anybody help me out in this regard.


    *******VBA CODE*************
    ' create the BAPI ActiveX control and connect to SAP
    Set oBAPICtrl = CreateObject("SAP.BAPI.1")


    If oBAPICtrl.Connection.Logon(0, False) Then

    ' Goods movement object
    Set oGoodsMovement = oBAPICtrl.getsapobject("GoodsMovement")

    ' commit work object
    Set oBapiService = oBAPICtrl.getsapobject("BapiService")
    Set oReturnCommit = oBAPICtrl.dimas(oBapiService, "TransactionCommit", "Return")
    Set oGoodsmvtHeadret = oBAPICtrl.dimas(oGoodsMovement, "CreateFromData", "GoodsmvtHeadret")
    Set oGoodsmvtItem = oBAPICtrl.dimas(oGoodsMovement, "CreateFromData", "GoodsmvtItem")
    Set oGoodsmvtHeader = oBAPICtrl.dimas(oGoodsMovement, "CreateFromData", "GoodsmvtHeader")
    Set oGoodsmvtCode = oBAPICtrl.dimas(oGoodsMovement, "CreateFromData", "GoodsmvtCode")


    *******************************************

    Thanks
    Mustafa

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: CreateObject("SAP.BAPI.1") is not working with office365

    When you updated to Windows 10, did you reinstall your SAP client software?

    Have you used REGEDIT to ensure there's a HKCR\SAP.BAPI.1 key? If you have, have you ensured that your version of the SAP client software works under Windows 10?

    In any case, this is very likely more of a computer configuration problem than an Excel VBA problem. That being the case, SAP help forums may be better sources of information and advice than this forum.

  3. #3
    Registered User
    Join Date
    10-29-2020
    Location
    Saudi Arabia
    MS-Off Ver
    office365
    Posts
    2

    Re: CreateObject("SAP.BAPI.1") is not working with office365

    Hi,

    No! this is for sure Excel problem because it is happening not only on my system, it is happening on whatever system has windows10 and office365 irrespective of any SAP front end GUI.
    whereas if I use the same excel file on any of older version of office , it is working fine there. Any Idea???

    thanks
    Mustafa

  4. #4
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: CreateObject("SAP.BAPI.1") is not working with office365

    The FIRST thing to check is whether the Windows 10 PCs with Office 365 have the registry key HKCR\SAP.BAPI.1. Whether you accept it or not, the most likely reason CreateObject fails is that there are problems in the registry key for [D]COM object you're trying to create. Thus best to eliminate that possibility first.

    From a different perspective, your Windows 10 machines also have Windows Script Host/VBScript. You could confirm that this SAP object is working by using this VBScript file

    test.vbs
    Please Login or Register  to view this content.
    Run this from a console command prompt as cscript test.vbs. If there's a systemic problem with that [D]COM object, you should see an error message like

    E:\me\battest\test.vbs(3, 1) WScript.CreateObject: Could not locate automation class named "SAP.BAPI.1".

    If you see something like that, the problem would be that the SAP BAPI control isn't properly installed.

    This would be a configuration issue, and it's a dead certainty there are configuration differences between PCs running Windows 10 and Office 365 and other PCs running older versions of either Windows or Office.

    If the VBScript file above doesn't display an error, then VBScript could create a SAP BAPI object, but Excel couldn't. At that point you would need to confirm that your version of that SAP control is compatible with Excel in Office 365.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Set WordApp = CreateObject("Word.Application") run-time error
    By Joost87 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-14-2017, 12:20 AM
  2. Web Query Faulty Data Return on CreateObject("X") AND .Send
    By dogman6126 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-15-2015, 04:26 AM
  3. [SOLVED] CreateObject("scripting.dictionary") Add Item Problem---->Empty Cells
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2014, 05:04 PM
  4. User Specific - CreateObject("Word.Application") Fails
    By Thanley in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2013, 06:04 PM
  5. Replies: 2
    Last Post: 01-03-2013, 04:32 PM
  6. [SOLVED] Set OutApp = CreateObject("Outlook.Application") - Runtime error 429
    By Buffyslay in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-29-2012, 09:44 AM
  7. Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" not working
    By redders in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2011, 03:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1