Save a Purchase Voucher Against a Purchase Order
Records the goods received against a purchase order that is already in Logic ERP and bills them as a purchase voucher (goods receipt / GRN) posted to the order's supplier. You send the order's internal number and the items, lots and quantities received; Logic ERP takes the supplier, the purchase rate and the taxes from the order, creates the lines and takes the received quantity off the order's pending quantity, so the rest can be received later.
To record a purchase without an order, use Save a Purchase Voucher. To create the order itself, use Save a Purchase Order.
Endpoint
Address
https://your-server/api/SavePurchaseAgainstPO
Method
POST
Authorization
Basic Auth
The response envelope, branches, dates, queueing and the common messages are explained in How Every API Call Works.
Request fields
The request has the same shape as Save a Purchase Voucher, but this endpoint reads only the fields below and treats several of them differently. Field names are not case-sensitive. Codes and names are matched as you send them – spaces around them are not trimmed (only TransporterName and CurrencyName are trimmed).
PO_Code
number
Yes
0
Logic ERP's internal number of the purchase order – the LastSavedCode you got from Save a Purchase Order, or Vouch_Code in Get Purchase Orders. One order per request. The supplier of the voucher is the order's supplier.
BranchCode
number
No – but always send it (or BranchShortName)
0
The branch the voucher is saved in (as explained in How Every API Call Works). Send the order's branch – see the rules.
BranchShortName
text
No
empty
The branch's short name, used only when BranchCode is 0.
InvoiceDate
date
No
today
The voucher date, yyyy-MM-dd. Must fall in the current financial year.
Bill_No
text
No
empty
The supplier's bill (invoice) number.
Bill_Date
date
No
InvoiceDate
The supplier's bill date, yyyy-MM-dd.
PartyBillDate
date
No
InvoiceDate
The party bill date, yyyy-MM-dd.
GRN_Prefix
text
No
GRN
Prefix of the goods receipt (GRN) number. The voucher gets the next GRN number for that prefix.
LstItems
list
Yes
empty list
The items, lots and quantities received – see below. ListItems is accepted as another name for the same list.
Godown_Name
text
No
the item's default godown
The godown all lines are received into, by name exactly as in Logic ERP. A godown set as Default Godown in your API site's settings for this endpoint takes priority. A name that does not exist stops the request.
SupplierCode
text
No
the order's supplier
A party code. When sent, it replaces the supplier named on the voucher (and used for its taxes), while the voucher is still posted to the order's supplier. Leave it out.
PU_Remarks_1, PU_Remarks_2, PU_Remarks_3
text
No
empty
Remarks 1 to 3 of the voucher.
OrderNo, GR_Number
text
No
empty
Order number and transport GR (lorry receipt) number.
GRDate, OrderDate, ChallanNo, ChallanDate
date, date, text, date
No
none
Used when sent. Dates yyyy-MM-dd; a date that cannot be read is ignored.
PVTMark, Insurance_Policy_No, Declaration_No, Cases, TransportMode, DeliveryAt, DeliveryAdd1, DeliveryAdd2, VehicleNo
text
No
none
Used when sent (not empty).
AgentName
text
No
none
An agent / broker, by name exactly as in Logic ERP. Checked, but not saved – see the known issue below.
CostCenter
text
No
none
A cost centre, by name exactly as in Logic ERP.
TransporterName
text
No
none
A transporter, by name as in Logic ERP.
CurrencyName, ExchangeRate
text, number
No
none, 1
A currency by name, and its exchange rate (used only when above 0).
CD_P, TD_P, SP_CD, SchemeRs, Freight, Adjustment_Rs, SpDiscountRs, AdjustUnit, CreditDays
number
No
none (credit days: from the order's payment terms)
Document-level discounts, charges and credit days. Only values above 0 are used.
DisplayError
text
No
"0"
"1" = when the request fails, Message holds the full technical detail. Use only while testing.
LstItems – one entry per item (and lot) received
LogicUser_Code
text
One of the two
empty
The item code shown in Logic ERP (UserCode in Get Item Master).
AddlItemCode
text
One of the two
empty
The additional item code / barcode. Used only when LogicUser_Code is empty.
ScannedQty
number
Yes
0
Quantity received. Must be above 0 and not more than the item's pending quantity on the order (see the rules).
LotNo
text
Only when the order line has no lot number
the order line's lot number
The lot number for the received goods. When the order line already has a lot number – for example when the purchase-order series puts the order number into the lot number – that lot is used and LotNo is ignored. Otherwise LotNo is used; when it is empty, the purchase series' default lot number. A line that ends up without a lot number is refused.
Lot_Mrp
number
Yes, in practice
the order line's MRP (none when the purchase series is set not to take the MRP from orders)
The MRP of the lot. Send it – the rates below are applied only when it equals the line's MRP (see the known issue).
PurRate, SaleRate, BasicRate
number
Depends on the purchase series
none
Purchase, sale and basic rate of the line. Used only when above 0; BasicRate replaces the basic rate taken from the order line. Unless the purchase series fills or does not require them, a missing purchase or sale rate stops the request.
SP_Rate_1 to SP_Rate_5
number
No
none
Special rates 1 to 5 for the lot, used only when above 0.
MFG_Date, Expiry_Date
date
No
none
Manufacturing and expiry date of the lot, yyyy-MM-dd.
Production_Unit
text
No
empty
Production unit of the lot.
Lot_Bill_No
text
No
empty
The lot's bill number.
Ignored fields. AccountCode (the voucher is always posted to the order's supplier), Challan_Code, DNO_Code, Series_Code (the series comes from your API site's settings), GR_Date, GPN_No, GPN_Date, Weight, EntrySource, and in LstItems: ItemDescription, LotCode, Godown_Code, Org_Production_Unit. Leave Doc_Type out (it defaults to PU; any value other than PU or PR stops the reverse-charge setting being taken from the tax region).
Rules Logic ERP applies
What is received. The order lines of the items in
LstItemsthat are not cancelled and still have a pending quantity. Lines of items you did not list stay pending.How much. For each entry,
ScannedQtymust not be more than the item's pending quantity on the order (all its pending lines together); otherwise the request is refused withGRN Quantity must be less than PO Pending Qty.... An item that is not on the order, or has nothing pending, is refused with the same message. If the purchase series allows receiving more than ordered by a percentage, that percentage is added to the pending quantity for this check.Billing in parts. The received quantity is taken off the order line's pending quantity, so the rest can be received later with another request. For an open order the pending quantity is not reduced.
Rates and amounts. Each line takes the order line's rate as it is on the order; a
BasicRateyou send replaces it, as described inLstItems. Purchase and sale rates are not taken from the order – send them. The order line's discount, and its tax set-up, are carried over. Rate formulas set on the purchase series are applied, as on Logic ERP's purchase screen.Taxes. The tax region is the supplier's: its tax region for your branch when one is linked, otherwise the supplier's own tax region, otherwise the default tax region. When the purchase series works out taxes item by item, they are worked out for that region, as on Logic ERP's purchase screen. Without a tax region the request is refused.
Lots. When the order line has a lot number (or is tied to an existing lot), that lot is used and your
LotNois ignored. Otherwise a lot is created with the lot number, MRP, rates and dates described above. If any of the order lines being received has no lot number, the request is refused withLot Number is missing in Item Details ...– even when you sendLotNo– unless Logic ERP is set up, in the purchase series or in the user's rights, to accept order lines without a lot number.Godown. The godown set as Default Godown in your API site's settings, else
Godown_Name, else each item's default godown.Series and number. The voucher is saved in the purchase series chosen as Default Configuration for Purchase voucher against PO in your API site's settings. There is no request field for the series. The voucher gets the series' next number and the next GRN number for
GRN_Prefix.Checks of the series. The purchase series' own checks apply – for example a mandatory MRP or purchase/sale rate, or refusing a supplier bill number that already exists for the supplier.
Branch and order are not cross-checked. The voucher is saved in the branch you send; Logic ERP does not check that the order belongs to that branch. Send the order's own branch.
Duplicates. There is no duplicate check on the request. A repeat receives again from what is still pending (or is refused when nothing is left). Check
Statusbefore you resend.All or nothing. The voucher and all its lines are saved together. If anything fails, nothing is saved.
Your Logic ERP licence must include the API for purchase against purchase orders.
Known issue – an item on several order lines. When the order has the same item on more than one pending line, the quantity of an entry is received on each of those lines (up to each line's pending quantity), not shared between them – so more than you sent can be received. Check the order in Logic ERP first; for such an order, receive the goods in Logic ERP.
Known issue – the same item twice in
LstItems. Each entry is checked against the item's whole pending quantity on its own, so together they can receive more than is pending, and the lines can be built wrongly. Send one entry per item with the total quantity.
Known issue – rates ignored without
Lot_Mrp.PurRate,SaleRate,BasicRateand the special rates are applied only when the line's MRP equalsLot_Mrp. When you leaveLot_Mrpout and the order line has an MRP, they are ignored and the request may then be refused for a missing purchase or sale rate. Always sendLot_Mrp.
Known issue –
AgentNameis not saved. The agent you send is checked (a name that is not found stops the request), but the voucher is saved without an agent. Set the agent on the voucher in Logic ERP if you need one.
Example request
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 adds stock. The example's test order is already fully received, so the example is refused – first save a test order with Save a Purchase Order and send its internal number, and change Bill_No each time.
Records the goods received against a purchase order that is already in Logic ERP and bills them as a purchase voucher (goods receipt / GRN) posted to the order's supplier. You send the order's internal number and the items, lots and quantities received; Logic ERP takes the supplier, the purchase rate and the taxes from the order, creates the lines and takes the received quantity off the order's pending quantity, so the rest can be received later.
The user name and password of your API site.
Logic ERP's internal number of the purchase order – the LastSavedCode you got from Save a Purchase Order, or Vouch_Code in Get Purchase Orders. One order per request. The supplier of the voucher is the order's supplier.
The branch the voucher is saved in (as explained in How Every API Call Works). Send the order's branch – see the rules.
The voucher date, yyyy-MM-dd. Must fall in the current financial year.
The supplier's bill (invoice) number.
The supplier's bill date, yyyy-MM-dd.
The party bill date, yyyy-MM-dd.
The godown all lines are received into, by name exactly as in Logic ERP. A godown set as Default Godown in your API site's settings for this endpoint takes priority. A name that does not exist stops the request.
Remarks 1 to 3 of the voucher.
Always HTTP 200. Check Status and Message.
The voucher's GRN number – prefix, a hyphen and the number with two decimals, for example GRN-14.00. Empty (null) when not saved.
true when the voucher was saved.
Empty when saved; the reason when not saved.
Logic ERP's internal number of the new purchase voucher; 0 when not saved.
The ID of this request – quote it to support.
No login was sent.
POST /api/SavePurchaseAgainstPO HTTP/1.1
Host: demo.logicerp.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 333
{
"PO_Code": 1888,
"BranchCode": 2,
"InvoiceDate": "2026-10-30",
"Bill_No": "APITEST-PU-PO-001",
"Bill_Date": "2026-10-30",
"PartyBillDate": "2026-10-30",
"Godown_Name": "MAIN",
"PU_Remarks_1": "API TEST",
"LstItems": [
{
"LogicUser_Code": "APITEST0001",
"ScannedQty": 2,
"LotNo": "APITESTLOT5",
"Lot_Mrp": 3199,
"PurRate": 100,
"SaleRate": 3099,
"BasicRate": 100
}
]
}{
"LastSavedDocNo": "text",
"Status": true,
"Message": "text",
"LastSavedCode": 1,
"request_ID": "text"
}Response
Status
true / false
true when the voucher was saved.
Message
text
Empty when saved; the reason when not saved.
LastSavedCode
number
Logic ERP's internal number of the new purchase voucher; 0 when not saved.
LastSavedDocNo
text
The voucher's GRN number – prefix, a hyphen and the number with two decimals, for example GRN-14.00. Empty (null) when not saved.
request_ID
text
The ID of this request – quote it to support.
Example response
Messages you may see
Messages from checks made while the voucher is being built and saved (marked *) come back with technical text before the reason and technical detail after it – look for the reason in the first line.
Invalid PO Code […]. Please Check...
PO_Code is missing or no purchase order has that number.
Send the order's internal number.
Default Configuration Not Defined in API Template..
No purchase series is chosen for purchase vouchers against purchase orders in your API site's settings.
Ask your Logic ERP team to choose the Default Configuration.
Invalid Supplier Code Defined...
SupplierCode was sent but not found.
Leave SupplierCode out.
Invalid Godown Name […]. Please Check...
Godown_Name does not exist.
Send the name exactly as in Logic ERP, 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.
Logic User Code/Additional Item Code Not Defined for Item No : …
An entry in LstItems has neither code.
Send LogicUser_Code or AddlItemCode.
Invalid Logic User Code : '…' Defined for Item No : … / Invalid Additional Item Code : '…' Defined for Item No : …
The item code is not found.
Send the code exactly as in Logic ERP.
Quantity Not Defined For : '…' Item No : …
ScannedQty is 0 or less.
Send a quantity above 0.
Invoice Date not Within Financial Year.Please Check....
InvoiceDate is outside the current financial year.
Send a date in the current financial year.
GRN Quantity must be less than PO Pending Qty...
The quantity is more than the item's pending quantity on the order, or the item is not on the order / has nothing pending.
Check the order's pending quantities (Get Purchase Orders).
Lot Number is missing in Item Details ... *
An order line being received has no lot number.
See the rules (Lots).
Lot No.… cannot be black. Item Code: … *
A line ended up without a lot number.
Send LotNo.
Default Tax Region not Set.Please Check.... *
No tax region could be found for the supplier.
Set the supplier's tax region in Logic ERP.
Invalid Agent […] .Please Check, Unable to found Cost Center […] .Please Check, Transporter Name [ … ] not found. Please Check..., Currency Name [ … ] not found. Please Check... *
A name was not found.
Send it exactly as in Logic ERP.
M.R.P. Entry is mandatory......Row No: … *
The purchase series needs an MRP and the line has none.
Send Lot_Mrp.
Purchase Rate entry is mandatory.... Row No:… / Sale Rate entry is mandatory.... Row No:… *
The purchase series needs a rate and the line has none.
Send PurRate / SaleRate and Lot_Mrp.
Unable to identify taxes of Item at Row No.:… *
No tax could be found for an item in the supplier's tax region.
Check the item's tax set-up in Logic ERP.
Bill No:… already exists for this supplier... Cannot Continue. *
The series refuses a supplier bill number that is already used for this supplier.
Send the correct Bill_No.
Error while saving voucher *
Saving was stopped inside Logic ERP; nothing was saved. One known cause: the supplier bill number already exists for this supplier and the purchase series is set to ask before accepting it – the API cannot answer that question.
Check Bill_No; otherwise retry once and, if it repeats, send the request_ID to support.
Another technical error *
Saving failed inside Logic ERP; nothing was saved.
Retry once; if it repeats, send the request_ID to support.
"Status": false with an empty Message
Saving stopped without a reason. Nothing was saved.
Check the order in Logic ERP; send the request_ID to support.