cancel
Showing results for 
Search instead for 
Did you mean: 

Error: -4200 with Production Orders in SAP 2004

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Alfredo,

What is in the series combo box? It should be the series number and not the description. Make sure you're passing the correct value.

Hope it helps,

Adele

Former Member
0 Kudos

Hello.

Use Try-Catch block to get this error. With this way You will know that You pass the correct value.

Hope it helps.

Regards

Kamil Wydra

Former Member
0 Kudos

Thanks for the responses.

Adele: The description in my combo is indeed the series number. The reason behind this: when I load value and description manually, the combo only displays the value unless the user clicks the combo (thinking in a normal scenario where the value should be the series number and the description should be the series name); so I just changed the way it was loaded so the user could see the series name.

I even tried hard coding the series number:

oProdOrders.Series = 5 '5 Is a series number that indeed exists in my DB

...But the error just keeps showing.

Also I have used this same series combo code in another Add-On that adds Credit Notes and Invoices, and this is the first time this error shows.

I'll keep looking to any anomalies in the code or the data retrieval anyway.

Thanks for the help. (Please keep it coming if you can )

Regards

Alfredo

Answers (0)