cancel
Showing results for 
Search instead for 
Did you mean: 

Issue Updating Base Sales Order From A Delivery

Former Member
0 Kudos

As a Delivery doc is added that was created from a Sales Order, I would like to be able to update certain unclosed information in the base Sales Order document. Two of the fields are user fields, which don't present an issue. I can make the updates accordingly through the SDK. The issue I'm having presents itself when I attempt to update the TransportationCode (ORDR.TranspCode) field in the base sales order, which is a field on the logistics tab. I can make the update through the SBO interface version 2005 fine, but when I make the update through the SDK version 2005 use VB.NET 1.1 I get the following error:

[ORDR.DocRate] , 'Field cannot be updated (ODBC -1029)'.

It's strange because I'm not making any updates to the DocRate field. This issue arose after an upgrade from 6.5 to 2005. Worked fine in 6.5. The DocRate (exchange rate) field is not used in documents entered in local currency as far as I know.

Any ideas?


Private Sub UpdateOrderFromDelivery(ByVal DS As DataSet)

        Dim oORDR As SAPbobsCOM.Documents
        Dim oDEL As SAPbobsCOM.Documents
        Dim RetVal As Long
        Dim DT As New DataTable
        Dim DR As DataRow
        Dim OrdrTrackNum As String
        Dim AL As New ArrayList

        DT = DS.Tables(0)
        oORDR = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
        oDEL = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes)

        Dim i As Integer
        For i = 0 To (DT.Rows.Count - 1)

            DR = DT.Rows.Item(i)
            Dim CurBaseDocEntry As String = DR.Item(0)

            'Check to see if the Sales Order update has already been processed
            If AL.Contains(CurBaseDocEntry) Then
                GoTo SkipLoop
            End If

            If oORDR.GetByKey(CurBaseDocEntry) = False Then
                Throw New Exception("Could not find Sales Order Key " & DR.ItemArray(0) & ".")
            End If

            If oDEL.GetByKey(DocEntry) = False Then
                Throw New Exception("Could not find Delivery Key " & DocEntry & ".")
            End If

            Dim DelTrackNum As String = oDEL.UserFields.Fields.Item("U_TrackNum").Value
            oORDR.UserFields.Fields.Item("U_TrackNum").Value = DelTrackNum

            Dim DelShipCost As Double = oDEL.UserFields.Fields.Item("U_ShipCost").Value
            oORDR.UserFields.Fields.Item("U_ShipCost").Value = DelShipCost


            <b>Dim DelTransCode As String = oDEL.TransportationCode
            oORDR.TransportationCode = DelTransCode</b>

            RetVal = oORDR.Update

            If RetVal <> 0 Then
                Dim Err As String, Msg As String
                oCompany.GetLastError(Err, Msg)
                Throw New Exception("Unable to update ORDR from ODLN.  " & Err & " - " & Msg)
            Else
                AL.Add(CurBaseDocEntry)
            End If
SkipLoop:
        Next


    End Sub

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

i think any of the fields in the base sales order get updated when u set the delivery 's(target's) base entry no

oDel.BaseEntry = docnum of Order

Hope this helps

Answers (0)