Skip to Content
0
Dec 29, 2015 at 12:25 PM

Web Service SAP BO

34 Views

HI

I am creating a web service from asp.net, very simple, to create a seat ("Memo") using the Di API. But when testing sends me error "entry code ReferenceException not control Null".

The code is as follows:

<WebMethod()> _

Public Function prueba(ByVal msje As String) As String

Dim lRetCode As Long

Dim vDoc As SAPbobsCOM.JournalEntries

vDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)

' vDoc = oCompany.GetBusinessObject(oJournalEntries)

oCompany = New SAPbobsCOM.Company

oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008

oCompany.DbUserName = "XXXX"

oCompany.DbPassword = "XXXX"

oCompany.Server = "192.168.0.XX"

oCompany.CompanyDB = "SBO_INFORMATICA"

oCompany.UserName = "XXX"

oCompany.Password = "XXX"

oCompany.UseTrusted = False

'oCompany.language = "ln_Spanish_La"

lRetCode = oCompany.Connect()

vDoc.Memo = msje

vDoc.Lines.Debit = 2000

vDoc.Lines.Credit = 2000

lRetCode = vDoc.Add()

If lRetCode <> 0 Then

oCompany.GetLastError(lErrCode, sErrMsg)

MsgBox(lErrCode & " " & sErrMsg) ' Display error message

Else

MsgBox("Asiento Creado", MsgBoxStyle.Information)

End If

oCompany.Disconnect()

End Function

The idea is then to consume this web service from a web application. (ASP.NET)

thanks.