> 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-a-purchase-return.md).

# Save a Purchase Return

Records goods you **send back to a supplier**: Logic ERP saves a **purchase return** for the supplier, takes the items **out of stock** from lots that still hold them, and works out the value and tax of the goods returned. Use it when your warehouse or store app returns damaged, excess or wrong goods to a supplier. The request has the same shape as [Save a Purchase Voucher](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-a-purchase-voucher.md); this page lists every field the return reads and explains where a return behaves differently.

### **Endpoint**

| Name          | Detail                                       |
| ------------- | -------------------------------------------- |
| Address       | `https://your-server/api/SavePurchaseReturn` |
| 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).

This endpoint always uses Logic ERP's **purchase import engine**. Unlike Save a Purchase Voucher, no setting switches it to the screen engine.

### **How a return is linked to the original purchase**

There is **no field for the original purchase voucher** – no voucher number, GRN number or internal code. A return is tied to earlier purchases only through the **lot** (batch) the goods are taken from:

* `LotNo` – the lot number. Logic ERP looks only at lots of that item with that number.
* `Lot_Bill_No` – the **supplier bill number the lot was purchased on** (the `Bill_No` sent with the purchase). Send it to take the goods only from lots bought on that bill.
* `Production_Unit` – the lot's production unit, when your lots carry one.

Logic ERP does **not** check that the lot was bought from the supplier you are returning to, and the return is not recorded against the purchase voucher. If you need the original purchase on the return, put its number in `PU_Remarks_2` or `OrderNo`.

### **Request fields**

One return per request. Field names are not case-sensitive. Codes and names are matched without regard to upper and lower case, and spaces at the start are not trimmed – except around the item codes `LogicUser_Code` and `AddlItemCode`: there, spaces are removed before the item is looked up. Where a field works as on Save a Purchase Voucher, the meaning below is short; see that page for details.

**Return header**

| Field                                                                                                                                                                         | Type         | Required                                       | Default                                  | Meaning                                                                                                                                                                                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ---------------------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BranchCode`                                                                                                                                                                  | number       | No – but always send it (or `BranchShortName`) | `0`                                      | Logic ERP's number of the branch sending the goods back (`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)). Stock is taken from this branch.                                                              |
| `BranchShortName`                                                                                                                                                             | text         | No                                             | empty                                    | The branch's short name, used only when `BranchCode` is `0`.                                                                                                                                                                                                                                                               |
| `AccountCode`                                                                                                                                                                 | text         | Yes                                            | –                                        | The supplier account the return is made out to, by its code in Logic ERP (`User_Code` in [Get Party Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-party-master.md)). It must exist. Its tax region, payment terms and default discounts are used. |
| `SupplierCode`                                                                                                                                                                | text         | No                                             | `AccountCode`                            | A different supplier account, by its code, when the party on the return differs from the account posted to. When sent, it must exist.                                                                                                                                                                                      |
| `Bill_No`                                                                                                                                                                     | text         | No\*                                           | empty                                    | The return's reference number – usually the debit-note or gate-pass number you give the supplier. \*Required when your API site checks duplicate supplier bill numbers – see **Duplicates**.                                                                                                                               |
| `InvoiceDate`                                                                                                                                                                 | date         | No                                             | today                                    | The return date, `yyyy-MM-dd`. See **Financial year and dates**.                                                                                                                                                                                                                                                           |
| `Bill_Date`                                                                                                                                                                   | date         | No                                             | `InvoiceDate`                            | Date of the reference in `Bill_No`.                                                                                                                                                                                                                                                                                        |
| `PartyBillDate`                                                                                                                                                               | date         | No                                             | `InvoiceDate`                            | The supplier's document date.                                                                                                                                                                                                                                                                                              |
| `Godown_Name`                                                                                                                                                                 | text         | No                                             | none                                     | Take stock only from this godown, by name. It must exist. See **Stock**.                                                                                                                                                                                                                                                   |
| `GRN_Prefix`                                                                                                                                                                  | text         | No                                             | the series' first GRN prefix, else `GRN` | Prefix of the return's GRN number, for example `"PR"`. Logic ERP gives the next number of that prefix.                                                                                                                                                                                                                     |
| `Series_Code`                                                                                                                                                                 | number       | No                                             | the API site's series                    | Logic ERP's internal code of the purchase-return series. Used **only** when your API site has no default series for this endpoint; otherwise ignored.                                                                                                                                                                      |
| `GR_Number`, `GR_Date`                                                                                                                                                        | text, date   | No                                             | empty                                    | The transporter's GR (lorry receipt) number and date.                                                                                                                                                                                                                                                                      |
| `GRDate`                                                                                                                                                                      | date         | No                                             | –                                        | Also the GR date; when both are sent, `GRDate` wins.                                                                                                                                                                                                                                                                       |
| `OrderNo`, `OrderDate`                                                                                                                                                        | text, date   | No                                             | empty                                    | Your reference number and date. `OrderNo` is also kept as the request's reference in Logic ERP's API log.                                                                                                                                                                                                                  |
| `PU_Remarks_1`                                                                                                                                                                | text         | No                                             | empty                                    | Remarks.                                                                                                                                                                                                                                                                                                                   |
| `PU_Remarks_2`, `PU_Remarks_3`                                                                                                                                                | text         | No                                             | empty                                    | Remarks, for example the reason for the return.                                                                                                                                                                                                                                                                            |
| `AgentName`                                                                                                                                                                   | text         | No                                             | none                                     | Agent, by name. Must exist.                                                                                                                                                                                                                                                                                                |
| `CostCenter`                                                                                                                                                                  | text         | No                                             | none                                     | Cost centre, by name. Must exist.                                                                                                                                                                                                                                                                                          |
| `TransporterName`                                                                                                                                                             | text         | No                                             | the supplier's transporter               | Transporter, by name. Must exist.                                                                                                                                                                                                                                                                                          |
| `CurrencyName`, `ExchangeRate`                                                                                                                                                | text, number | No                                             | none, `1`                                | Foreign currency by name (must exist) and its rate. Only an `ExchangeRate` above `0` is used.                                                                                                                                                                                                                              |
| `CreditDays`                                                                                                                                                                  | number       | No                                             | the supplier's payment terms             | Only a value above `0` is used.                                                                                                                                                                                                                                                                                            |
| `CD_P`, `TD_P`, `SP_CD`                                                                                                                                                       | number       | No                                             | the supplier's defaults                  | Cash discount %, trade discount % and special CD %. Only values above `0` are used.                                                                                                                                                                                                                                        |
| `Freight`, `Adjustment_Rs`, `SpDiscountRs`, `AdjustUnit`, `SchemeRs`                                                                                                          | number       | No                                             | `0`                                      | Freight, adjustment, special discount, adjustment per unit and scheme amount in ₹. Only values above `0` are used.                                                                                                                                                                                                         |
| `ChallanNo`, `ChallanDate`, `Cases`, `Weight`, `TransportMode`, `VehicleNo`, `DeliveryAt`, `DeliveryAdd1`, `DeliveryAdd2`, `PVTMark`, `Insurance_Policy_No`, `Declaration_No` |              | No                                             | empty                                    | Kept on the return, as on Save a Purchase Voucher.                                                                                                                                                                                                                                                                         |
| `GPN_No`, `GPN_Date`                                                                                                                                                          | text, date   | No                                             | empty                                    | Gate pass number and date. `GPN_Date` must be a valid date when `GPN_No` is sent.                                                                                                                                                                                                                                          |
| `Doc_Type`                                                                                                                                                                    | text         | No                                             | `"PU"`                                   | Leave it out. Only with `"PU"` or `"PR"` does the return take the **reverse charge** mark from its tax region; any other value leaves it off. It does not change the document type.                                                                                                                                        |
| `LstItems`                                                                                                                                                                    | list         | Yes                                            | –                                        | The items going back – see below. Send at least one line, never `null`.                                                                                                                                                                                                                                                    |
| `DisplayError`                                                                                                                                                                | text         | No                                             | `"0"`                                    | `"1"` = when the request fails, `Message` holds the full technical detail. Use only while testing.                                                                                                                                                                                                                         |

**Ignored fields.** `DNO_Code`, `Challan_Code`, `PO_Code`, `EntrySource`, `Request_ID` and `Sup_Code` are accepted but not used. `GRN_Number`, shown in older examples, does not exist – the GRN number is always the next number of the prefix.

**`LstItems` – one entry per line**

| Field                                                       | Type   | Required                  | Default | Meaning                                                                                                                                                                                                         |
| ----------------------------------------------------------- | ------ | ------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LogicUser_Code`                                            | text   | Yes (or `AddlItemCode`)   | empty   | The item code shown as Item Code in Logic ERP (`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)). |
| `AddlItemCode`                                              | text   | Yes (or `LogicUser_Code`) | empty   | The item's barcode / EAN, used when `LogicUser_Code` is empty or not found. With `LogicUser_Code` empty, the item's extra barcodes are also accepted.                                                           |
| `ScannedQty`                                                | number | Yes                       | –       | Quantity returned, above `0`.                                                                                                                                                                                   |
| `LotNo`                                                     | text   | No                        | empty   | Take the goods only from lots with this number. Empty = any lot of the item. Upper and lower case and spaces at the end do not matter.                                                                          |
| `Lot_Bill_No`                                               | text   | No\*                      | empty   | Take the goods only from lots bought on this supplier bill number. \*Required when your API site filters return lots by bill number.                                                                            |
| `Production_Unit`                                           | text   | No                        | empty   | Take the goods only from lots of this production unit.                                                                                                                                                          |
| `BasicRate`                                                 | number | No                        | `0`     | Rate per unit returned. The line amount is `BasicRate` × quantity, unless the supplier's price list is applied (see **Rates and tax**).                                                                         |
| `Lot_Mrp`, `PurRate`, `SaleRate`, `SP_Rate_1` … `SP_Rate_5` | number | No                        | `0`     | Passed with the line. They do not choose the lot and are not used for the amount.                                                                                                                               |
| `ItemDescription`                                           | text   | No                        | empty   | A description kept with the line.                                                                                                                                                                               |
| `Expiry_Date`, `MFG_Date`                                   | date   | No                        | none    | Passed with the line when they are valid dates; they do not choose the lot.                                                                                                                                     |

`LotCode`, `Godown_Code` and `Org_Production_Unit` are accepted but not used for a return – Logic ERP chooses the lot and godown itself (see **Stock**).

### **Rules Logic ERP applies**

* **Branch.** The return belongs to the branch in `BranchCode` (or `BranchShortName`). A request with neither is not refused up front, so always send one of them.
* **Financial year and dates.** The return is saved in the **financial year `InvoiceDate` falls in** (today's year when it is left out), also an earlier year. A date that no financial year in Logic ERP covers is refused with `No financial year covers the date dd/MM/yyyy.` When your Logic ERP does not allow post-dated purchase returns, an `InvoiceDate` after today is refused, and lock periods set for purchase returns apply.
* **Series.** The return is saved in the default series set for this endpoint in your API site (one of the purchase-return series). With no default there, `Series_Code` is used; with neither, the request fails. Logic ERP does not check that a `Series_Code` you send is a return series.
* **What must already exist.** The account (and `SupplierCode`), every item, every lot you return from, and every name you send (godown, agent, cost centre, transporter, currency). Nothing is created – no lot, no item. The account and `SupplierCode` must be a customer, supplier or cash account; any other account is refused.
* **Stock.** The returned quantity is **taken out** of stock. For every line, Logic ERP collects the lots of the item that **have stock** in this branch in the return's financial year, oldest purchase first, keeping only:

  * lots with the number in `LotNo`, the bill number in `Lot_Bill_No` and the production unit in `Production_Unit` – each only when sent;
  * the godown in `Godown_Name`, when sent;
  * otherwise the **default godown** of this endpoint in your API site, when one is set.

  The quantity is taken from the first lot, then the next, until it is covered, so **one line can become several return lines** (one per lot and godown). All lines share what is left in each lot and godown, so together they never take more than a lot holds. If the lots do not hold enough for a line, the whole request is refused with `Insufficient Stock for Item Code : … Lot_No: …`. When the return series is limited to certain godowns, stock found in other godowns makes the request fail with *Lot not found for this item*.
* **API site lot filters.** When your API site filters return lots **by lot bill number**, `Lot_Bill_No` is required on every line. When it filters **by production unit**, the lot taken must have a production unit, otherwise the request fails with *Invalid Production Unit for Item*.
* **Rates and tax.** You do not send tax amounts. Logic ERP works out GST and other taxes on each line from the item's tax setup and the return's **tax region**, which comes **only from the supplier**: the tax region linked to the `AccountCode` account for this branch, else that account's own tax region; when you send a different `SupplierCode` and that account has a tax region linked for this branch, that one is used. An account with neither is refused with `Default Tax Region not Set.Please Check....`. When your API site applies **party-wise price lists** to returns and the account has a price list, the price-list rate replaces `BasicRate`.
* **Stock-transfer accounts.** When the account is a **stock-transfer account** (an account standing for another branch), the return is marked as a stock transfer to that account's branch.
* **Duplicates.** Logic ERP does not check whether you sent the same return before; sending it twice saves two returns and takes the stock out twice. When your API site is set to **validate duplicate supplier bills**, `Bill_No` is required and a purchase return with the same `Bill_No` in the current financial year is refused – for the same supplier and branch, or for the same supplier in any branch, depending on that setting. Only purchase returns are compared.
* **All or nothing.** The return and all its lines are saved together. If any line fails, nothing is saved.
* Codes, names, lot numbers and `Lot_Bill_No` may contain an apostrophe (`'`). Leave apostrophes out of `Bill_No` and `GRN_Prefix`: Logic ERP's own purchase routine also uses them.

**How it differs from Save a Purchase Voucher**

|                                    | Save a Purchase Voucher                      | Save a Purchase Return                          |
| ---------------------------------- | -------------------------------------------- | ----------------------------------------------- |
| Stock                              | Added; lots created or topped up             | Taken out of existing lots that have stock      |
| `LotNo`                            | Required (import engine)                     | Optional – narrows the lots searched            |
| `Lot_Bill_No`, `Production_Unit`   | Kept on new lots                             | Narrow the lots searched                        |
| `LotCode`, `Godown_Code` on a line | Line godown used                             | Ignored – Logic ERP picks lot and godown        |
| One request line                   | One voucher line                             | Can become several lines (one per lot / godown) |
| Engine                             | Import engine or screen engine (API setting) | Always the import engine                        |
| Party price list                   | Not applied                                  | Applied when switched on for the API site       |
| Duplicate supplier bill check      | Against purchase vouchers                    | Against purchase returns                        |

### **Example request**

Two shirts of lot `L2610-118` (bought on supplier bill `INV-4471`) going back to supplier `SUP014` from the main godown of branch 2:

```json
{
  "BranchCode": 2,
  "AccountCode": "SUP014",
  "Bill_No": "DN-2026-0187",
  "InvoiceDate": "2026-10-30",
  "Bill_Date": "2026-10-30",
  "GRN_Prefix": "PR",
  "Godown_Name": "MAIN",
  "OrderNo": "RET-0187",
  "PU_Remarks_2": "Stitching defect - against bill INV-4471",
  "TransporterName": "SHREE GANESH ROADWAYS",
  "LstItems": [
    {
      "LogicUser_Code": "SH1042-M",
      "AddlItemCode": "",
      "ScannedQty": 2,
      "LotNo": "L2610-118",
      "Lot_Bill_No": "INV-4471",
      "Production_Unit": "",
      "BasicRate": 640.00,
      "Lot_Mrp": 1299.00,
      "ItemDescription": "Stitching defect"
    }
  ]
}
```

### **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 returns one pair of the test item `APITEST0001`; each send creates one more test return.

## Save a Purchase Return

> Records goods you send back to a supplier: Logic ERP saves a purchase return for the supplier, takes the items out of stock from lots that still hold them, and works out the value and tax of the goods returned. Use it when your warehouse or store app returns damaged, excess or wrong goods to a supplier. The request has the same shape as Save a Purchase Voucher; this page lists every field the return reads and explains where a return behaves differently.

```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":{"/SavePurchaseReturn":{"post":{"tags":["Purchase - Push"],"operationId":"SavePurchaseReturn","summary":"Save a Purchase Return","description":"Records goods you send back to a supplier: Logic ERP saves a purchase return for the supplier, takes the items out of stock from lots that still hold them, and works out the value and tax of the goods returned. Use it when your warehouse or store app returns damaged, excess or wrong goods to a supplier. The request has the same shape as Save a Purchase Voucher; this page lists every field the return reads and explains where a return behaves differently.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BranchCode":{"type":"integer","description":"Logic ERP's number of the branch sending the goods back (`Branch_Code` in Get Branch Info). Stock is taken from this branch."},"AccountCode":{"type":"string","description":"The supplier account the return is made out to, by its code in Logic ERP (`User_Code` in Get Party Master). It must exist. Its tax region, payment terms and default discounts are used."},"Bill_No":{"type":"string","description":"The return's reference number – usually the debit-note or gate-pass number you give the supplier. *Required when your API site checks duplicate supplier bill numbers – see Duplicates."},"InvoiceDate":{"type":"string","description":"The return date, `yyyy-MM-dd`. See Financial year and dates."},"Bill_Date":{"type":"string","description":"Date of the reference in `Bill_No`."},"PartyBillDate":{"type":"string","description":"The supplier's document date."},"Godown_Name":{"type":"string","description":"Take stock only from this godown, by name. It must exist. See Stock."},"OrderNo":{"type":"string","description":"Your reference number and date. `OrderNo` is also kept as the request's reference in Logic ERP's API log."},"PU_Remarks_2":{"type":"string","description":"Remarks, for example the reason for the return."},"LstItems":{"type":"array","items":{"type":"object","properties":{"LogicUser_Code":{"type":"string","description":"The item code shown as Item Code in Logic ERP (`UserCode` in Get Item Master)."},"AddlItemCode":{"type":"string","description":"The item's barcode / EAN, used when `LogicUser_Code` is empty or not found. With `LogicUser_Code` empty, the item's extra barcodes are also accepted."},"ScannedQty":{"type":"integer","description":"Quantity returned, above `0`."},"LotNo":{"type":"string","description":"Take the goods only from lots with this number. Empty = any lot of the item. Upper and lower case and spaces at the end do not matter."},"BasicRate":{"type":"integer","description":"Rate per unit returned. The line amount is `BasicRate` × quantity, unless the supplier's price list is applied (see Rates and tax)."},"ItemDescription":{"type":"string","description":"A description kept with the line."}}},"description":"The items going back – see below. Send at least one line, never `null`."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"LastSavedDocNo":{"type":"string","description":"The return's GRN number as prefix and number, for example `PR-37`. `null` when not saved."},"Status":{"type":"boolean","description":"`true` when the return was saved."},"Message":{"type":"string","description":"Empty when saved; the reason when not saved."},"LastSavedCode":{"type":"integer","description":"Logic ERP's internal number of the return; `0` when not saved."},"request_ID":{"type":"string","description":"The ID of this request – quote it to support."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field            | Type         | Meaning                                                                                   |
| ---------------- | ------------ | ----------------------------------------------------------------------------------------- |
| `Status`         | true / false | `true` when the return was saved.                                                         |
| `Message`        | text         | Empty when saved; the reason when not saved.                                              |
| `LastSavedCode`  | number       | Logic ERP's internal number of the return; `0` when not saved.                            |
| `LastSavedDocNo` | text         | The return's GRN number as prefix and number, for example `PR-37`. `null` when not saved. |
| `request_ID`     | text         | The ID of this request – quote it to support.                                             |

### **Example response**

```json
{
  "LastSavedDocNo": "PR-37",
  "Status": true,
  "Message": "",
  "LastSavedCode": 15873,
  "request_ID": "3b9d7c21-58e4-4f0a-9c6e-1a2b7f4d8e90"
}
```

### **Messages you may see**

Messages marked *technical text* arrive wrapped in technical detail: look for the quoted reason inside `Message` (the first line starts with technical words). The others are the whole `Message`, unless you send `"DisplayError": "1"`.

| Message                                                                                                                                                                                                              | Meaning                                                                                                                                        | What to do                                                                                               |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `Default Configuration Not Defined in API Template`                                                                                                                                                                  | No series: your API site has no default series for this endpoint and no `Series_Code` was sent.                                                | Ask your Logic ERP team to set the default series.                                                       |
| `Request cannot be processed. API Template is marked as In-Active in the configuration.`                                                                                                                             | This endpoint is switched off for your API site. Nothing is saved, but `Status` is `true` and `LastSavedCode` is `0` – look for this sentence. | Ask your Logic ERP team.                                                                                 |
| `Account Code Not Defined...`                                                                                                                                                                                        | `AccountCode` is empty.                                                                                                                        | Send the supplier's code.                                                                                |
| `Invalid Account User Code...`                                                                                                                                                                                       | No account has that `AccountCode`.                                                                                                             | Check it with Get Party Master.                                                                          |
| `Invalid Supplier Code Defined...`                                                                                                                                                                                   | `SupplierCode` was sent but not found.                                                                                                         | Check it, or leave it out.                                                                               |
| `Invalid Invoice Date Defined...`, `Invalid Bill Date...`, `Invalid Party Bill Date...`                                                                                                                              | A date could not be read.                                                                                                                      | Send dates as `yyyy-MM-dd`.                                                                              |
| `Invalid Godown Name […]. Please Check...`                                                                                                                                                                           | `Godown_Name` was not found.                                                                                                                   | Send the godown name as in Logic ERP.                                                                    |
| `Bill No can't be blank...`                                                                                                                                                                                          | Your API site checks duplicate supplier bills and `Bill_No` is empty.                                                                          | Send `Bill_No`.                                                                                          |
| `Bill No:… already exists for current supplier and current Branch` / `Bill No:… already exists for current supplier..`                                                                                               | A purchase return with this `Bill_No` already exists (see **Duplicates**).                                                                     | Do not resend the same return; use a new reference.                                                      |
| `Post Dated enteries are not allowed.......`                                                                                                                                                                         | `InvoiceDate` is after today and post-dated returns are not allowed.                                                                           | Send today's date or earlier.                                                                            |
| `Entry/Modification is locked for this period....`                                                                                                                                                                   | `InvoiceDate` is in a locked period.                                                                                                           | Ask your Logic ERP team.                                                                                 |
| `Logic User Code/Additional Item Code Not Defined for Item No : …`                                                                                                                                                   | Line number … has neither `LogicUser_Code` nor `AddlItemCode`.                                                                                 | Send the item code or barcode.                                                                           |
| `LogicUserCode Or EAN Code Cannot Blank!!`                                                                                                                                                                           | A line's item codes hold only spaces.                                                                                                          | Send the item code or barcode.                                                                           |
| `Invalid LogicUserCode / EANCode : …`                                                                                                                                                                                | The item was not found; … is the barcode you sent, else the item code, in capitals.                                                            | Check the code with Get Item Master.                                                                     |
| `Quantity Not Defined For : '…' Item No : …`                                                                                                                                                                         | The item sent on line number … has a quantity of `0` or less.                                                                                  | Send a positive `ScannedQty`.                                                                            |
| `Insufficient Stock for Item Code : … Lot_No: …`                                                                                                                                                                     | The lots that match the line do not hold the quantity (see **Stock**).                                                                         | Check stock with your Logic ERP team; check `LotNo`, `Lot_Bill_No`, `Production_Unit` and `Godown_Name`. |
| `Unable to Retrive Item Details...`                                                                                                                                                                                  | The item's master record is incomplete.                                                                                                        | Ask your Logic ERP team.                                                                                 |
| `No financial year covers the date …`                                                                                                                                                                                | No financial year in Logic ERP covers `InvoiceDate`.                                                                                           | Check the date.                                                                                          |
| `Invoice Date Date not within financial year.Please Check....`                                                                                                                                                       | `InvoiceDate` falls outside the financial year the return is being saved in.                                                                   | Check the date.                                                                                          |
| `Account Code : … is not a Customer / Supplier / Cash account..Please Check...`                                                                                                                                      | `AccountCode` or `SupplierCode` is not a customer, supplier or cash account.                                                                   | Send the supplier's code.                                                                                |
| `Item Details Not Defined...`                                                                                                                                                                                        | `LstItems` was sent as `null`.                                                                                                                 | Send the item list.                                                                                      |
| `Default Tax Region not Set.Please Check....`                                                                                                                                                                        | The supplier has no tax region for this branch and none of its own.                                                                            | Set the tax region on the supplier in Logic ERP.                                                         |
| `Invalid Agent […] .Please Check`                                                                                                                                                                                    | `AgentName` was not found.                                                                                                                     | Send the agent name as in Logic ERP.                                                                     |
| Technical text containing `Lot not found for this item : …`                                                                                                                                                          | The lot found could not be used – the return series is limited to other godowns, or the production-unit setting above is on.                   | Ask your Logic ERP team.                                                                                 |
| Technical text containing `Invalid Bill No. Please Check..`                                                                                                                                                          | Your API site filters lots by bill number and `Lot_Bill_No` is empty.                                                                          | Send `Lot_Bill_No`.                                                                                      |
| Technical text containing `Invalid Production Unit for Item : …`                                                                                                                                                     | Your API site filters lots by production unit and the lot has none.                                                                            | Ask your Logic ERP team.                                                                                 |
| Technical text containing `Unable to found Cost Center […] .Please Check`, `Transporter Name [ … ] not found. Please Check...`, `Currency Name [ … ] not found. Please Check...` or `Invalid GPN_Date .Please Check` | A name was not found, or `GPN_No` was sent without a valid `GPN_Date`.                                                                         | Send names exactly as in Logic ERP; send `GPN_Date` as `yyyy-MM-dd`.                                     |
| Technical text containing `Unable to Find Items for Import...`                                                                                                                                                       | `LstItems` is empty.                                                                                                                           | Send at least one line.                                                                                  |
| Technical text containing `Purchase / Tax Details not found for all Items. Check Row No.: …` or `Please set Default Tax Type before import this document.......`                                                     | The item's tax for this tax region, or the series' default tax type, is not set up.                                                            | Ask your Logic ERP team.                                                                                 |
| Any other technical error                                                                                                                                                                                            | Saving failed inside Logic ERP; nothing was saved.                                                                                             | Retry once; if it repeats, send the `request_ID` to support.                                             |


---

# 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-a-purchase-return.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.
