Hi,
I am currently developing an addon for SAP Business One. When updating a BOM record I have the following problem:
If i call the Update Method of the ProductTrees Object the SAP Business One Application Crashes with the Error:
"Runtime Error!
Programm: E:ProgrammeSAPSAP Business OneSAP Business One.exe
R6025
- pure virtual function call"
The Code i am Calling looks like this:
Protected Sub closeBundleBillOfMaterial(ByVal sCode As String)
Dim oRec As SAPbobsCOM.Recordset = cInit.getInstance.getSboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Dim sSQL As String = "SELECT OITT.Code FROM ITT1 INNER JOIN OITT ON ITT1.Father = OITT.Code WHERE ITT1.Code = '" & sCode & "'"
Dim oBOM As SAPbobsCOM.ProductTrees = cInit.getInstance.getSboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductTrees)
Dim iRetVal As Integer = 0
Dim sItemCode As String = ""
Try
oRec.DoQuery(sSQL)
oRec.MoveFirst()
While oRec.EoF = False
sItemCode = oRec.Fields.Item("Code").Value
If oBOM.GetByKey(sItemCode) Then
oBOM.UserFields.Fields.Item("U_Status").Value = "C"
iRetVal = oBOM.Update()
If iRetVal <> 0 Then
Throw New Exception("Fehler bei Methode Update in closeBundleBillOfMaterial")
End If
End If
oRec.MoveNext()
End While
Catch ex As Exception
cLog.err("Fehler beim Ermitteln der verbundenen Stücklisten. ", ex)
Finally
cUtil.deleteObject(oRec)
End Try
End Sub
My stats are:
- SAP Business One 8.8 PL 16
- SQL Server 2008 Standard Edition with SP2
- Visual Studion 2010
I hope someone has a solution for this problem. Thanks a lot.
Regards
Michael