Hi,
I've been generating production orders with my Add-On without any problems until I added the oProdOrders.Series line to my code and it doesn't matter if I hard code the Series value, it always gets me the same error:
-4200 NNM1 generating this document requires numbering to be determined for the document
Can anybody help me with this?
Here's a piece of my code:
oProdOrders.ProductionOrderOrigin = SAPbobsCOM.BoProductionOrderOriginEnum.bopooSalesOrder
oProdOrders.ProductionOrderOriginEntry = .UserDataSources.Item("DocEntry").Value
oProdOrders.CustomerCode = .UserDataSources.Item("CardCode").Value
oProdOrders.ItemNo = .UserDataSources.Item("ItemCode").Value
oProdOrders.Warehouse = .UserDataSources.Item("WhsCode").Value
oProdOrders.PostingDate = DateTime.Parse(Now, Nothing)
dtDueDate = Date.Parse(.UserDataSources.Item("DocDueDate").Value, Nothing)
If dtDueDate < Now Then
oProdOrders.DueDate = DateTime.Parse(Now, Nothing)
Else
oProdOrders.DueDate = .UserDataSources.Item("DocDueDate").Value
End If
'It was working fine before this line was added
oProdOrders.Series = CInt(Me.Formulario.Items.Item("cbxSeries").Specific.Selected.Description)
oProdOrders.PlannedQuantity = .UserDataSources.Item("Quantity").Value
'Loop for the PO lines
If oProdOrders.Add() <> 0 Then
Me.Company.GetLastError(intErrorAdd, sErrMsgAdd)
If (0 <> intErrorAdd) Then
sErrorMsg = sErrorMsg & "Production Order Error: " & CStr(intErrorAdd) & "," & sErrMsgAdd & _
". DocEntry: " & oProdOrders.ProductionOrderOriginEntry & vbCrLf
End If
End If
This is kind of an urgent matter so I'll greatly appreciate any help you can give me.
Thanks in advance...
Alfredo
Add a comment