Private Sub UpdateSalesLine() Dim _SalesOrder As New wsNAV_SalesHeaderAndLines.wsNAV_SalesHeaderAndLines_Service ' this is the Sales Header Service Dim salesOrder As New wsNAV_SalesHeaderAndLines.wsNAV_SalesHeaderAndLines ' this is the Sales Header card _SalesOrder.UseDefaultCredentials = False _SalesOrder.Credentials = New System.Net.NetworkCredential("username", "password") Try salesOrder = _SalesOrder.Read("1", "P-20-B") ' get the Sales Header Card Dim salesLines(0) As wsNAV_SalesHeaderAndLines.WS_SalesLine ' Create an empty array If Not salesOrder.WS_SalesLine Is Nothing Then salesLines = salesOrder.WS_SalesLine End If If Not _SalesOrder.IsUpdated(salesOrder.Key) Then ' check if object is still the same Dim idx As Integer = 0 Dim blnLineFound As Boolean = False While idx < salesLines.Length Dim oLine As wsNAV_SalesHeaderAndLines.WS_SalesLine oLine = DirectCast(salesLines(idx), wsNAV_SalesHeaderAndLines.WS_SalesLine) If oLine.Line_No = 10000 Then blnLineFound = True Exit While End If idx = idx + 1 End While If blnLineFound Then With DirectCast(salesLines(idx), wsNAV_SalesHeaderAndLines.WS_SalesLine) ' set values .Bin_Code = Nothing .Description = "1 - W 24 X 32 x 17 *2" .Description_2 = Nothing .Document_No = "P-20-B" '.Document_Type = wsNAV_SalesHeaderAndLines.Document_Type_1.Order '.Document_TypeSpecified = True .Item_Category_Code = "PF" .Key = Nothing '.Line_No = 10000 '.Line_NoSpecified = True .Location_Code = "COATICOOK" .Type = wsNAV_SalesHeaderAndLines.Type.Item .TypeSpecified = True .No = "GCAISSON" .Product_Group_Code = "CABINETS" .Quantity = 1 .QuantitySpecified = True .Unit_Price = 10000 .Unit_PriceSpecified = True .Variant_Code = Nothing End With End If _SalesOrder.Update(salesOrder) ' update Sales Header Card End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub
Answers
programmeur-analyste
Cabico Custom Cabinetry
For now I suggest you to see if writing new lines with a lineno=1000000, +10) works..
programmeur-analyste
Cabico Custom Cabinetry
programmeur-analyste
Cabico Custom Cabinetry
programmeur-analyste
Cabico Custom Cabinetry