> 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/purchase/push/save-physical-verification-of-a-purchase-challan.md).

# Save Physical Verification of a Purchase Challan

Records the **physical verification** of goods received on a **purchase challan** (goods received before the supplier's bill). The warehouse scans or counts what is actually in the cartons, and Logic ERP keeps that count against each line of the challan – as the **Physical Stock Verification Of PUV** screen (Inventory menu) does for challans. Logic ERP compares it with the challan quantity: anything scanned that is not on the challan, or more than the challan quantity, goes into a **difference list**. This endpoint creates no new document and does not change stock.

It works exactly like [Save Physical Verification of a Purchase Voucher](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-physical-verification-of-a-purchase-voucher.md), except for how the document is found; the differences are listed here in full so this page can be used on its own.

### **Endpoint**

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

The response 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).

Field names are matched without regard to upper/lower case; fields not listed below are ignored.

### **Request fields**

| Field         | Type   | Required           | Default | Meaning                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------- | ------ | ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DocCode`     | number | One of the two     | `0`     | Logic ERP's internal number of the purchase challan: `Vouch_Code` in [Get Purchase Challans](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/pull/get-purchase-challans.md), or the `LastSavedCode` returned by [Save a Purchase Challan](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-a-purchase-challan.md). **Recommended.** When it is above `0`, `PUV_Bill_No` is not used and the branch is not checked. |
| `PUV_Bill_No` | text   | One of the two     | empty   | The supplier's bill or challan number as entered on the purchase challan (`Bill_No` in Get Purchase Challans). Used only when `DocCode` is `0`. A number found on more than one challan of the branch is refused – send `DocCode` then.                                                                                                                                                                                                                                                                                                   |
| `BranchCode`  | number | With `PUV_Bill_No` | `0`     | The branch of the challan (`Branch_Code` in [Get Branch Info](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-branch-info.md)). There is no branch short name field.                                                                                                                                                                                                                                                                                                       |
| `ListItems`   | list   | **Yes**            | –       | What was scanned or counted, one entry per scan. See the table below. An empty or missing list is refused (also when every entry is skipped as `-1`).                                                                                                                                                                                                                                                                                                                                                                                     |
| `Doc_Type`    | text   | No                 | –       | **Ignored.** This endpoint always works on purchase challans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

**`ListItems`**

| Field                                             | Type   | Required | Default | Meaning                                                                                                                                                                                     |
| ------------------------------------------------- | ------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LogicUser_Code`                                  | text   | **Yes**  | –       | The code that was scanned; what it must contain depends on the counting method below. An empty value stops the request.                                                                     |
| `Quantity`                                        | number | Depends  | `0`     | How many were counted for this code (lot code and item code counting). When the configuration counts in packs, the number is multiplied by the units per pack of the matching challan line. |
| `AddlItemCode`, `Packing_Box_No`, `Item_Det_Code` | –      | No       | –       | **Ignored.** To scan an additional item code, send it in `LogicUser_Code`.                                                                                                                  |

### **How the code is read**

The API template names a configuration of the **Physical Stock Verification Of PUV** screen, which decides how `LogicUser_Code` is read. If the challan has already been counted, the method of that earlier count is used again.

| Counting method            | `LogicUser_Code` holds                                                                                                                                                                                                                                                                                                                                          | `Quantity`                                                                                                                                 |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Lot code                   | The barcode printed on the lot label.                                                                                                                                                                                                                                                                                                                           | **Send it** – left out, nothing is counted. If the barcode also carries a piece number, that piece number is used as the quantity instead. |
| Lot code with piece number | The barcode of one piece.                                                                                                                                                                                                                                                                                                                                       | Ignored – one piece per barcode; a piece already counted is skipped.                                                                       |
| Item code                  | The item code (`UserCode` in [Get Item Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-item-master.md)), or an additional item code when your company uses them. Upper/lower case must match the item code on the challan; a code that differs only in case goes to the difference list. | The number counted; `1` or less (or left out) counts as `1`.                                                                               |
| Lot number                 | The lot number.                                                                                                                                                                                                                                                                                                                                                 | The lot found is counted, as on the Physical Stock Verification Of PUV screen.                                                             |
| Set code / set name        | The code or name of an item set.                                                                                                                                                                                                                                                                                                                                | Ignored – each item of the set is counted by its quantity in the set. A set that is not found is skipped without a message.                |

If the configuration has a **lot code prefix**, every `LogicUser_Code` must start with it.

### **Rules Logic ERP applies**

* **Which challan.** With `DocCode`, that challan is used; a number with no challan lines is refused. With `PUV_Bill_No`, the challan in `BranchCode` with that number is used – from any year (challans are not kept by financial year); purchase challan returns are not looked at. When more than one challan has it, the request is refused.
* **Challan quantity.** Each line is compared with the challan line's original quantity.
* **Configuration required.** The API template must name a default configuration for this screen.
* **Counts add up.** Each request **adds** to what has already been counted for the challan. Send each scan once.
* **Matching.** A scan is set against the challan line with the same lot (or item) that still has quantity left; anything else goes to the difference list.
* **When the count is refused.** Nothing is saved if the configuration requires a minimum percentage to be scanned and less was scanned (counting every request so far), or if the configuration requires every challan line to be scanned and a line still has nothing counted – the answer then names those items. Counting by packing box, and copying the challan quantity into the count, are refused. A refused count is answered `Status: false` with the reason.
* **All or nothing.** The counts for all lines and the difference list are saved together. If any scan is refused, nothing from the request is saved.

> **Known issue – a challan can be refused because of a purchase voucher.** Before saving, Logic ERP checks whether the document has been used in a physical-stock debit note or in the Receipt Register – but it checks the **purchase vouchers** of the current year that happen to carry the same internal number as the challan. If such a voucher was used, the challan count is refused with `This Purchase Voucher has been Retrieved in Purchase Return(Debit Note) for Physical Stock Difference.... Cannot Allow Change...` or `This Purchase Voucher has been Retrieved in Receipt Register.... Cannot Allow Change...`. Record that challan's count on the screen.

> **Known issue – missing challan answered as success.** If `DocCode` is `0` and `PUV_Bill_No` is empty, the answer is `Status: true` with the message `Invalid Bill No. Please Check...`, and nothing is saved.

### **Example request**

Counting by lot code:

```json
{
  "BranchCode": 2,
  "DocCode": 31620,
  "ListItems": [
    {
      "LogicUser_Code": "WH284517",
      "Quantity": 20
    }
  ]
}
```

### **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, so use test values like the example. The example counts the sandbox's test challan; counts add up, so each send counts again.

## Save Physical Verification of a Purchase Challan

> Records the physical verification of goods received on a purchase challan (goods received before the supplier's bill). The warehouse scans or counts what is actually in the cartons, and Logic ERP keeps that count against each line of the challan – as the Physical Stock Verification Of PUV screen (Inventory menu) does for challans. Logic ERP compares it with the challan quantity: anything scanned that is not on the challan, or more than the challan quantity, goes into a difference list. This endpoint creates no new document and does not change stock.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Purchase - 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":{"/SavePhysicalVerificationPUChallan":{"post":{"tags":["Purchase - Push"],"operationId":"SavePhysicalVerificationPUChallan","summary":"Save Physical Verification of a Purchase Challan","description":"Records the physical verification of goods received on a purchase challan (goods received before the supplier's bill). The warehouse scans or counts what is actually in the cartons, and Logic ERP keeps that count against each line of the challan – as the Physical Stock Verification Of PUV screen (Inventory menu) does for challans. Logic ERP compares it with the challan quantity: anything scanned that is not on the challan, or more than the challan quantity, goes into a difference list. This endpoint creates no new document and does not change stock.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BranchCode":{"type":"integer","description":"The branch of the challan (`Branch_Code` in Get Branch Info). There is no branch short name field."},"DocCode":{"type":"integer","description":"Logic ERP's internal number of the purchase challan: `Vouch_Code` in Get Purchase Challans, or the `LastSavedCode` returned by Save a Purchase Challan. Recommended. When it is above `0`, `PUV_Bill_No` is not used and the branch is not checked."},"ListItems":{"type":"array","items":{"type":"object","properties":{"LogicUser_Code":{"type":"string","description":"The code that was scanned; what it must contain depends on the counting method below. An empty value stops the request."},"Quantity":{"type":"integer","description":"How many were counted for this code (lot code and item code counting). When the configuration counts in packs, the number is multiplied by the units per pack of the matching challan line."}}},"description":"What was scanned or counted, one entry per scan. See the table below. An empty or missing list is refused (also when every entry is skipped as `-1`)."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"Status":{"type":"boolean","description":"`true` when the count was saved. Read this field, not `Message`."},"Message":{"type":"string","description":"`\"Physical Varification Done...\"` when saved; otherwise the reason."},"LastSavedCode":{"type":"integer","description":"Always `0`."},"request_ID":{"type":"string","description":"Always empty for this endpoint."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | Type         | Meaning                                                             |
| --------------- | ------------ | ------------------------------------------------------------------- |
| `Status`        | true / false | `true` when the count was saved. Read this field, not `Message`.    |
| `Message`       | text         | `"Physical Varification Done..."` when saved; otherwise the reason. |
| `LastSavedCode` | number       | Always `0`.                                                         |
| `request_ID`    | text         | Always empty for this endpoint.                                     |

### **Example response**

```json
{
  "Status": true,
  "Message": "Physical Varification Done...",
  "LastSavedCode": 0,
  "request_ID": ""
}
```

### **Messages you may see**

| Message                                                                                                  | Meaning                                                                                                                                                                            | What to do                                                         |
| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `No Purchase Voucher Selected`                                                                           | No challan found for `PUV_Bill_No` in the branch (not used for `DocCode`; the text says voucher for challans too).                                                                 | Check the number and `BranchCode`, or send `DocCode`.              |
| `Bill No. : … found multiple times. Please send DocCode...`                                              | More than one challan of the branch has that number.                                                                                                                               | Send `DocCode`.                                                    |
| `No items found against DocCode : … in the current financial year...`                                    | `DocCode` loads no challan lines.                                                                                                                                                  | Take `DocCode` from Get Purchase Challans.                         |
| `No items to verify (ListItems is empty)...`                                                             | `ListItems` is empty or missing, or every entry was skipped.                                                                                                                       | Send at least one scan.                                            |
| `Invalid Bill No. Please Check...` (with `Status: true`)                                                 | Neither `DocCode` nor `PUV_Bill_No` was sent. Nothing was saved.                                                                                                                   | Send one of them.                                                  |
| `Default Configuration Not Selected...`                                                                  | The API template has no configuration for this screen.                                                                                                                             | Ask your Logic ERP team to set it.                                 |
| `Cannot Allow Box No Scanning. Please check Physical Verification Of PUV Config...`                      | The configuration counts by packing box.                                                                                                                                           | Use a configuration without box scanning.                          |
| `Cannot Move Voucher Quantity to Physical Quantity. Please check Physical Verification Of PUV Config...` | The configuration copies the challan quantity into the count.                                                                                                                      | Use a configuration without that option.                           |
| `Barcode cannot be blank`                                                                                | An entry has an empty `LogicUser_Code`.                                                                                                                                            | Send a code in every entry.                                        |
| `Invalid Item Code..`                                                                                    | The code does not start with the configured lot code prefix.                                                                                                                       | Send the full code as printed.                                     |
| `Invalid Item Code.....: …`                                                                              | The item code does not exist in Logic ERP (item-code counting with invalid items not allowed).                                                                                     | Check the code.                                                    |
| `Invalid Barcode...(…)`                                                                                  | Piece counting: the barcode is not a lot-and-piece barcode.                                                                                                                        | Scan the piece label.                                              |
| `Lot Number does not exists` / `More than one Item exists against Lot`                                   | Lot-number counting: the lot number was not found, or belongs to several items.                                                                                                    | Check the lot number.                                              |
| `You must Scan minimum … (%) Physical Stock to Continue.....`                                            | Less than the configured percentage has been scanned so far. Nothing was saved.                                                                                                    | Scan the rest and send it.                                         |
| `Physical Scaning not exists against following items :- …`                                               | The configuration requires every challan line to be scanned, and some lines have nothing counted yet; the item and pack of each such line follow, one per line. Nothing was saved. | Scan those items and send them, or record the count on the screen. |


---

# 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/purchase/push/save-physical-verification-of-a-purchase-challan.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.
