Postman collection
Suppliers Write

pixiUpdateSOrderline

Updates quantity, supplier price, comment, estimated delivery date or undelivered quantity of a supplier order line and recalculates the order totals.

Changes a single line of a supplier order (purchase order), identified by SorderlineKey (SupplierOrderLine.Id).

Validation (each failure returns one row with ReturnCode = 'Error' and nothing is changed):

  1. The line must exist.
  2. A non-zero QtyNotDelivered is only accepted if the supplier order has status CON (confirmed).
  3. If the supplier order has status CON or CLS, neither SupplPrice (not NULL) nor OrderQty (non-zero) may be passed.

Preparation

  • UserName NULL becomes API; the user is resolved by name for the modification stamp.
  • EstimatedDelivery NULL keeps the current estimated delivery date of the line.
  • QtyNotDelivered passed explicitly as NULL keeps the current undelivered quantity.

Update (performed by the internal procedure GOS_SOrderlinesUpdate):

  • Always: comment (Comment = Note), estimated delivery date, modification user/date and row version of the line.
  • Supplier order in an editable status (internal status id 1 or 2): Qty (an OrderQty of 0 keeps the current quantity), number of packaging units (quantity divided by packaging unit, rounded up), SupplierPrice (only if SupplPrice is non-zero), discount amount/percent and line total are recalculated.
  • Supplier order with status CON (internal status id 3): UndeliveredQty is set to QtyNotDelivered.
  • The order header (SupplierOrder) is recalculated: subtotal from all line totals, header discount, freight cost (reset to 0 if the free-of-freight limit is reached), total amount including the minimum order surcharge.
  • The location quantity record of the line (SupplierOrderLineLocQty) gets the quantity and, for status CON, the undelivered quantity.
  • If the line has an estimated delivery date after the update, the item is queued for a forced export to the shop.

On success one row with ReturnCode = 'OK' is returned.

Notes

  • Comment is always overwritten: Note defaults to an empty string, so omitting it clears the existing comment of the line. Pass the current comment to keep it.
  • Undelivered quantity in status CON: QtyNotDelivered defaults to 0. For a confirmed order, omitting it sets UndeliveredQty to 0. Send it explicitly as NULL (nil) or with the current value to keep it.
  • QtyReceived is obsolete and ignored.
  • The line update is built as dynamic SQL; Note is concatenated without escaping, so a single quote (') in the comment breaks the statement. SQL errors from the internal procedure come back as SqlMessage; the final OK row may still be returned in that case.
  • Internal status ids 1, 2 and 3 are used for the update branches; id 3 corresponds to CON according to a code comment. For other statuses (e.g. CLS) only comment and estimated delivery date are changed.
  • Discount recalculation divides by quantity × price for amount-based discounts (DiscountType = 1); a zero price or quantity with an existing discount can cause a division-by-zero error.
  • The shop export is triggered whenever the line has an estimated delivery date, even if EstimatedDelivery was not passed. The export procedure Pixi_ExportItemChangesToShop is not attached.
  • No explicit transaction; reads use NOLOCK, updates use ROWLOCK.

Tables used

SupplierOrderLine · Write SupplierOrder · Write SupplierOrderStatus · Read SupplierOrderLineLocQty · Write
SQL object:
dbo.pipiUpdateSOrderline
Updated at 2026-10-30