> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-packing-slip-allowing-items-outside-the-sale-order.md).

# Save a Packing Slip Allowing Items Outside the Sale Order

Creates a **packing slip** against a **sale order**, like [Save a Packing Slip Against a Sale Order](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-packing-slip-against-a-sale-order.md), but **without refusing up front** an item that is not on the order or a quantity above what the order still has pending. Whether such goods can then be packed depends on the packing slip configuration chosen for the API: if it allows items outside the order, they are packed **without a link to the order**; if not, the request is refused when the first such unit is reached.

Despite its address, this endpoint does **not** read or work against a delivery order: it saves a packing slip (Logic ERP keeps packing slips together with its delivery orders). It always needs a sale order, exactly like the other packing slip endpoint.

### **Endpoint**

| Name          | Detail                                             |
| ------------- | -------------------------------------------------- |
| Address       | `https://your-server/api/PackingSlipDeliveryOrder` |
| Method        | `POST`                                             |
| Authorization | Basic Auth                                         |

The response envelope, branches, dates, queueing and the common messages are explained in [How Every API Call Works](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/how-every-api-call-works.md).

### **How it differs from Save a Packing Slip Against a Sale Order**

Everything – request fields, response, how the sale order and godown are found, how lots are picked, numbering, what happens to the order and the stock, and the messages – is the same as on [Save a Packing Slip Against a Sale Order](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-packing-slip-against-a-sale-order.md), with these differences:

* **An item that is not on the order** (or has nothing pending on it) is not refused with *Invalid Barcode.... Item does Not exist In Sale Order. Please check.* Logic ERP picks stock for it like any other item. Then:
  * if the packing slip configuration **allows items outside the sale order**, the units are packed on the packing slip with **no link to the order** – the order's pending quantities are not touched for them (see the known issue on billing them);
  * otherwise the request is refused with *No Pending Items found for Sale Order.......* and nothing is saved.
* **More than the order's pending quantity** of an order item is not refused with *No Pending quantity found......*. Each unit is still linked to an order line with something pending; once none is left, the rest is packed without a link to the order if the configuration allows items outside the order, and refused with *No Pending Items found for Sale Order.......* if it does not. (If the configuration allows packing more than the order's pending quantity, the extra units are linked to the item's first order line instead, as on the other endpoint.)
* It uses **the same API settings** (packing slip configuration and prefix) as Save a Packing Slip Against a Sale Order, and its requests are logged under that endpoint. Your Logic ERP licence must include this endpoint separately.

When the packing slip configuration does not allow items outside the order, the two endpoints save exactly the same packing slips; only the messages for an item that is not on the order, and for packing more than is pending, differ.

### **Request fields**

As on [Save a Packing Slip Against a Sale Order](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-packing-slip-against-a-sale-order.md): `SaleOrderVouchCode` or `PartyOrderNo`, `BranchCode` / `BranchShortName`, `GodownName`, `PS_Prefix`, `Remarks`, `Box_No_Prefix`, `DisplayError`, and `ListItems` with `ItemCode` and `ListBoxs` (`PackingBoxNo`, `Quantity`, `BoxWeight`, `BinName`, `BinCode`). `PS_Number`, `GodownCode` and the item-level `Quantity` are ignored.

### **Rules Logic ERP applies**

The rules of Save a Packing Slip Against a Sale Order apply, plus:

* Units packed without a link to the order are still taken from stock in `GodownName` and set aside on the packing slip (see the first known issue).
* A sale order is still required: without one the request is refused with *Unable to found Sale Order...*. As on the other endpoint, the order must exist, belong to the branch you send, be approved and not be cancelled as a whole, and a `PartyOrderNo` held by more than one order of the branch is refused.

> **Known issue – units packed without a link to the order cannot be billed or transferred.** When the packing slip is billed or transferred against it as a delivery order, only lines linked to an order line are picked up. Units packed outside the order stay set aside on the packing slip and are left out of the invoice or transfer without a message. Until this is fixed, do not rely on packing items outside the order; put them on the sale order first.

> **Known issue – an item outside the order in lot-and-piece or serial-number mode.** When the packing slip configuration reads `ItemCode` as a lot code with piece number, or as a serial number, an item that is not on the order makes the request fail with technical text instead of being packed. In those modes, send only items of the order.

> **Known issue – an order with nothing pending is not refused.** If the order has nothing pending and the packing slip configuration allows items outside the order, every unit is packed without a link to the order. Check the order with Get Sale Orders before you pack against it.

> **Known issue – messages from the saving step come wrapped in technical text.** Reasons found while the packing slip is being written – for example *Packing Slip number already exists....* or *Entry not allowed in back date.......* – arrive preceded and followed by technical text. Look for the reason inside `Message` rather than at its start.

> **Known issue – an apostrophe in a code or name.** `PartyOrderNo`, `GodownName`, `BinName`, `ItemCode` and `PS_Prefix` are looked up exactly as typed. An apostrophe (`'`) in any of them makes the request fail with a database error. Leave apostrophes out of codes and names you send.

### **Example request**

```json
{
  "BranchCode": 2,
  "SaleOrderVouchCode": 18342,
  "GodownName": "MAIN GODOWN",
  "PS_Prefix": "PS",
  "Remarks": "Order items plus festive gift boxes",
  "ListItems": [
    {
      "ItemCode": "SHRT-BLU-M",
      "ListBoxs": [ { "PackingBoxNo": "B01", "Quantity": 24 } ]
    },
    {
      "ItemCode": "GIFT-BOX-S",
      "ListBoxs": [ { "PackingBoxNo": "B01", "Quantity": 2 } ]
    }
  ]
}
```

### **Test it**

Send a request to the Logic ERP **sandbox** (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press **Test it**. This really saves in the sandbox and sets the packed stock aside. The example's test order may have nothing left to pack – first save a test order with Save a Sale Order and send its internal number.

## Save a Packing Slip Allowing Items Outside the Sale Order

> Creates a packing slip against a sale order, like Save a Packing Slip Against a Sale Order, but without refusing up front an item that is not on the order or a quantity above what the order still has pending. Whether such goods can then be packed depends on the packing slip configuration chosen for the API: if it allows items outside the order, they are packed without a link to the order; if not, the request is refused when the first such unit is reached.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Orders - Push"}],"servers":[{"url":"https://demo.logicerp.com/api","description":"Logic ERP sandbox (test company)"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"The user name and password of your API site."}}},"paths":{"/PackingSlipDeliveryOrder":{"post":{"tags":["Orders - Push"],"operationId":"PackingSlipDeliveryOrder","summary":"Save a Packing Slip Allowing Items Outside the Sale Order","description":"Creates a packing slip against a sale order, like Save a Packing Slip Against a Sale Order, but without refusing up front an item that is not on the order or a quantity above what the order still has pending. Whether such goods can then be packed depends on the packing slip configuration chosen for the API: if it allows items outside the order, they are packed without a link to the order; if not, the request is refused when the first such unit is reached.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BranchCode":{"type":"integer","description":"Logic ERP branch codes, separated by commas, for example `\"2\"` or `\"2,5,7\"`. Numbers only — there is no \"all branches\" value. Code `0` returns Logic ERP's placeholder branch named `(NIL)`; do not ask for it."},"SaleOrderVouchCode":{"type":"integer","description":"Logic ERP's internal number of the sale order – the `LastSavedCode` from Save a Sale Order, or the order's internal number in Get Sale Orders."},"GodownName":{"type":"string","description":"Ignored by this endpoint."},"PS_Prefix":{"type":"string","description":"Prefix of the packing slip number, for example `\"PS\"`. A prefix set in your API site's settings replaces it."},"Remarks":{"type":"string","description":"Any remarks."},"Box_No_Prefix":{"type":"string","description":"Prefix of the box numbers, saved on the packing slip."},"ListItems":{"type":"array","items":{"type":"object","properties":{"ItemCode":{"type":"string","description":"The item code, as `UserCode` in Get Item Master."},"ListBoxs":{"type":"array","items":{"type":"object","properties":{"PackingBoxNo":{"type":"string","description":"The box number, for example `\"B01\"`. Must not be empty."},"Quantity":{"type":"integer","description":"Quantity returned; more than `0`."}}}}}}}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"LastSavedDocNo":{"type":"string","description":"The packing slip's number, for example `PS-119`."},"Status":{"type":"boolean","description":"`true` = the packing slip was saved. (Also `true` when the endpoint is switched off – see the messages.)"},"Message":{"type":"string","description":"`Success` when saved; otherwise why it failed."},"LastSavedCode":{"type":"integer","description":"Logic ERP's internal number of the packing slip. Send it as `Doc_Code` to bill or transfer the packed goods. `0` when nothing was saved."},"request_ID":{"type":"string","description":"The ID of this request – quote it to support. Can be empty when the request fails at an early check."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

The same as on Save a Packing Slip Against a Sale Order:

| Field            | Type         | Meaning                                                                                                                                  |
| ---------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `Status`         | true / false | `true` = the packing slip was saved. (Also `true` when the endpoint is switched off – see the messages.)                                 |
| `Message`        | text         | `Success` when saved; otherwise why it failed.                                                                                           |
| `LastSavedCode`  | number       | Logic ERP's internal number of the packing slip. Send it as `Doc_Code` to bill or transfer the packed goods. `0` when nothing was saved. |
| `LastSavedDocNo` | text         | The packing slip's number, for example `PS-119`.                                                                                         |
| `request_ID`     | text         | The ID of this request – quote it to support. Can be empty when the request fails at an early check.                                     |

### **Example response**

```json
{
  "LastSavedDocNo": "PS-119",
  "Status": true,
  "Message": "Success",
  "LastSavedCode": 7721,
  "request_ID": "b90e3d17-5c2a-4f84-8e6b-1d7a42c0f5e8"
}
```

### **Messages you may see**

The messages of [Save a Packing Slip Against a Sale Order](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-packing-slip-against-a-sale-order.md), except that *Invalid Barcode.... Item does Not exist In Sale Order. Please check.* and *No Pending quantity found......* do not occur here:

| Message                                                                                                                                                                                                                                              | Meaning                                                                                                                                                | What to do                                                                                |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| `No Pending Items found for Sale Order.......`                                                                                                                                                                                                       | An item is not on the order, or more was packed than the order has pending, and the packing slip configuration does not allow items outside the order. | Pack only what the order has pending, or ask your Logic ERP team about the configuration. |
| `Unable to found Sale Order...`                                                                                                                                                                                                                      | No order found (see the other page).                                                                                                                   | Send `SaleOrderVouchCode`, or check `PartyOrderNo` and the branch.                        |
| `Unable to found Sale Order : …`, `Sale Order : … belongs to Branch Code : …, not to Branch Code : …..Please Check...`, `Sale Order Is marked as Un Approved. Cannot allow Packing Slip...`, `Sale Order is Cancelled. Cannot allow Packing Slip...` | The order does not exist, is of another branch, is waiting for approval or is cancelled (see the other page).                                          | Check the order with Get Sale Orders.                                                     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-packing-slip-allowing-items-outside-the-sale-order.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
