Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Calling custom BAPI from VB/VBA

Hello, all,

I have written a custom business object and its associated function module. I can single-test the business object inside native SAP, and it works successfully. I can also establish a handle to the business object from VBA (using the .GetSAPObject method of the BAPI control object.) I can't call the method of the custom BAPI, though--I get error message "UploadResults is not a BAPI method." (UploadResults is the name of both my business object and the method of the business object.) Here's my source code:

Sub UploadChemToSAP()

Dim gConnection As Object 'global connection object

Dim oBAPICtrl As New SAPBAPIControl

Dim oBAPIService As Object

Dim boFunction As Object, boResults As Object, boReturn As Object

'Set up connection object for SAP. Note that the SAP BAPI ActiveX object must be available on the form or otherwise.

Set gConnection = oBAPICtrl.Connection

'Log in to SAP. Seems like passwords must be in uppercase. There are examples of people defaulting some (or all)

'of the login values

gConnection.logon

Set boFunction = Nothing

Set boResults = Nothing

Set boReturn = Nothing

Set oBAPIService = oBAPICtrl.GetSAPObject("UploadResults")

Set boReturn = oBAPICtrl.DimAs(oBAPIService, "UploadResults", "Return")

'Log out of SAP.

gConnection.logoff

End Sub

To my knowledge, I have released both the business object and its associated method. The function module has been released, too. Any suggestions on where to go from here?

Thanks in advance,

Eric

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question