Skip to Content
0
Former Member
Sep 10, 2007 at 03:26 PM

Help! Order-line whse update NOT changing item/whse "committed" quantities

29 Views

<u><b>Help</b></u> - I've run out of ideas. It seems the order-line whse update is NOT changing item/whse "committed" quantities. (This is SBO 2005A SP01 PL29.)

The SDK program changes the warehouse code on order lines. The lines are being changed correctly, but the "committed" quantities in the affected warehouses are not being updated. I assume this would be done automatically when I update an order through the SDK, just as it is when I update the order manually through the screens. For example, if I change an order line quantity of 10 from warehouse X to warehouse Y, shouldn't the committed quantity decrease by 10 in warehouse X and increase by 10 in warehouse Y?

Below is the (simple) routine that actually does the update. The parameters are docEntry (the order to be updated) and Whse (the new warehouse for all the order lines in the order). Is there anything missing/incorrect?

--------------------------------------------------------------------------------
Private Sub UpdateOrder(ByVal docEntry As Integer, ByVal Whse As String)
   Dim pOrder As SAPbobsCOM.Documents
   Dim OrigWhse As String, WhseOk As Boolean
   Dim i As Integer, rc As Integer, errMsg As String = ""
 
   pOrder = Cmp.GetBusinessObject(oOrders)
   If pOrder.GetByKey(docEntry) = False Then
       Log(String.Format("Order not found, DocEntry={0}", docEntry))
       Return
   End If
        With pOrder.Lines
            For i = 0 To .Count - 1
                .SetCurrentLine(i)
                OrigWhse = .WarehouseCode
                Log("      " & _
                    "Line=" & .LineNum + 1 & _
                    ", Item=" & .ItemCode & " (" & .ItemDescription & ")" & _
                    ", Qty=" & String.Format(.Quantity, "###,##9") & _
                    ", Whse from=" & OrigWhse & _
                    " to=" & Whse)
                WhseOk = ItemWhse(.ItemCode, Whse) 
              ' Verify item valid in target whse
                If WhseOk = True Then
                    If Whse <> OrigWhse Then
                        .WarehouseCode = Whse                   ' Update the line WHSE 
                    End If
                Else
                    Log("         " & _
                        "*** Item <" & .ItemCode & "> not defined in whse <" & Whse & ">")
                End If
            Next i
        End With
        pOrder.DocumentsOwner = Nobody                          ' Set the OWNER to NOBODY
        pOrder.UserFields.Fields.Item("U_Whse").Value = Whse    ' Set the default whse in the order
        rc = pOrder.Update()                                    ' Update the order 
        pOrder.
        If (rc <> 0) Then
            Cmp.GetLastError(rc, errMsg)
            Log("Order update error, code=" + Str(rc) + ", msg=" + errMsg)
        End If
    End Sub

Below is the log output of the program, which suggests that everything is being processed ok.

9/10/2007 10:22:00 AM: ================================================================================

9/10/2007 10:22:00 AM: ICI-WebOrders start

9/10/2007 10:22:03 AM: Database <Live> opened

9/10/2007 10:22:38 AM: Order=52014, Owner=3, PRX_SID=15, PRX_SRVR=XXXX, Cust=60401 (Cust 60401), Lines=1, DefWhs=0T

9/10/2007 10:23:25 AM: Line=1, Item=CH408 (STP 408 Gran. LD Food Grade 50#), Qty=10, Whse from=0S to=0T

9/10/2007 10:39:34 AM: ICI-WebOrders end

After the update, the order lines have been updated properly. However, the

"committed" quantity in warehouse 0S is 10 before and after the run, and the committed quantity in warehouse 0T is 0 before and after.

Any help would be <u>greatly</u> appreciated.

Dave