Hi everybody.
I have the following problem: i need to create documents through DI API (2007 PL 47).
The items in document are BOM (sale type) with just one item as a child: this item child is managed with serial numbers.
When i try to create a delivery notes with DI API, i receive the following error:
"Found error:-10,You should use existing serial/batch numbers for this document type [(----) 29-51]".
The following code (VB . NET) is used for the insertion of the delivery (just one line with only one item BOM, with only one item child):
Dim nErr As Long
Dim errMsg As String = ""
Dim delivery As SAPbobsCOM.Documents
Dim deliveryLines As SAPbobsCOM.Document_Lines
Dim serialNumbers As SAPbobsCOM.SerialNumbers
delivery = oCompany.GetBusinessObject(BoObjectTypes.oDeliveryNotes)
delivery.DocObjectCode = BoObjectTypes.oDeliveryNotes
delivery.CardCode = "C0020"
delivery.DocDate = Today
delivery.DocDueDate = Today
delivery.TaxDate = Today
' CREATE A LINE WITH BOM
deliveryLines = delivery.Lines
deliveryLines.SetCurrentLine(0)
deliveryLines.ItemCode = "GARANZIA"
deliveryLines.WarehouseCode = "Mc"
deliveryLines.Quantity = 1
' ASSIGN A SERIAL NUMBER RELATED WITH CHILD ITEM IN A BOM
serialNumbers = deliveryLines.SerialNumbers
serialNumbers.SetCurrentLine(0)
serialNumbers.SystemSerialNumber = 2
delivery.Add()
oCompany.GetLastError(nErr, errMsg)
If (0 <> nErr) Then
MsgBox("Found error:" + Str(nErr) + "," + errMsg)
End If
Obviously the SystemSerialNumber used is available in a warehouse.
The process, through the BOne interface, work correctly.
The same code work correctly with the 2007 PL 42, but does not work with the 2007 PL 49.