Skip to Content
0
Former Member
Jul 30, 2008 at 07:27 PM

Calling BAPI_COMPANYCODE_GETDETAIL from VBA (Excel)

108 Views

Hi,

I've successfully called a number of BAPIs in VBA, however am getting a problem with BAPI_COMPANYCODE_GETDETAIL

It doesn't seem to pick up the structure of the tables - the 'Tables' objects just get set to 'nothing' rather than pulling back the structure, like it should. The call itself doesn't fail but obviously no data is returned.

Much appreciate any ideas!

Set oSAPFunctions = CreateObject("SAP.Functions")

Set oSAPBapiFn = oSAPFunctions.Add("BAPI_COMPANYCODE_GETDETAIL")

Set oSAPECC = oSAPBapiFn.Exports("COMPANYCODEID")

Set oSAPICCD = oSAPBapiFn.Tables("COMPANYCODE_DETAIL")

'Set oSAPICCA = oSAPBapiFn.Tables("COMPANYCODE_ADDRESS")

Set oSAPTRet = oSAPBapiFn.Tables("RETURN")

oSAPECC.Value = "xxxx"

If oSAPBapiFn.Call = False Then

iRet = False

Else

'worked

EndIf