Postman collection
Suppliers Write

pixiDeleteDelivery

Deletes a supplier delivery (delivery header and lines) with status NEW, identified by delivery reference or delivery number.

Deletes a supplier delivery from SDelHeader together with its lines in SDelDetail.

  1. At least one of SDelHkey or DeliveryNumber must be given; otherwise an error is raised and the procedure returns -1.
  2. If only DeliveryNumber is given, the delivery key is looked up in SDelHeader by SDelHNr (first match, no defined order). If SDelHkey is given, it is used and DeliveryNumber is ignored; the two values are not checked against each other.
  3. The delivery is only deleted if it
    • is not locked by Picco (LockedByPicco is not Y), or is locked by Picco for the same user passed in PiccoUser, and
    • has status NULL or NEW.
  4. If these conditions are met, the internal delete routine runs:
    • all delivery lines (SDelDetail) of the delivery are deleted,
    • entries in InvBinItemLog_In_Price that reference the delivery (via DeliveryId or DeliveryId_Assigned) are unlinked: delivery references and SupplierId are set to NULL, Price to 0, QuerySource to 7 and RecordModifiedOn to the current time,
    • the delivery header (SDelHeader) is deleted. The call then returns the row ReturnMSG = Deleting was successfull.
  5. Otherwise the row ReturnMSG = Delivery Header does not exists is returned.

Notes

  • The check for missing values uses ISNULL(..., ''); for int parameters the value 0 is treated the same as "not provided".
  • The message Delivery Header does not exists is also returned when the delivery exists but is locked by Picco for another user or has a status other than NULL/NEW.
  • The pre-check accepts status NULL, but the internal delete routine only deletes deliveries with status exactly NEW. For a delivery with status NULL nothing is deleted, yet Deleting was successfull is returned.
  • The internal delete runs in its own transaction (or a savepoint if a transaction is already open). Errors are caught, rolled back and written to the error log via log.InsertError; they are not passed to the caller, and the success message is returned anyway. Verify the result if needed.
  • The delivery and its lines are read with NOLOCK before deletion; the deletes and updates use ROWLOCK.
  • When looking up by DeliveryNumber, duplicate numbers lead to an arbitrary delivery being chosen.

Tables used

SDelHeader · Write SDelDetail · Write InvBinItemLog_In_Price · Write
SQL object:
dbo.pipiDeleteDelivery
Updated at 2026-10-30