Get Purchase Challans
Returns your purchase challans (goods received from suppliers on a delivery challan, before the purchase bill) from Logic ERP, each with its header and item lines. Use it to copy new and changed challans into your own system — normally by asking only for challans added or changed since your last call — or to fetch particular challans by their internal number. Deleted challans are reported too.
The response has the same layout as Get Purchase Vouchers; this page lists only what is different for challans. Challan returns have their own endpoint, Get Purchase Challan Returns.
Endpoint
Address
https://your-server/api/GetPurchaseChallan
Method
POST
Authorization
Basic Auth
The response and the common request fields are explained in How Every API Call Works.
Request fields
GlobalModifyCode
number
No
0
Your bookmark in the change log, as described in How Every API Call Works: 0 = from the start (or a period, with DateFrom/DateTo), a number = only changes after it, -1 = Logic ERP keeps the bookmark for you.
DateFrom, DateTo
date
No
empty
With GlobalModifyCode 0: a period of changes (the date a challan was saved, edited or deleted). Send both as null when you are not asking for a period. Write them as yyyy-MM-dd.
Doc_Codes
text
No
empty
Logic ERP's internal challan numbers (Vouch_Code), separated by commas, for example "140,143". Returns exactly these challans (and a short record for each one that was deleted); the bookmark and period are ignored. Numbers and commas only.
Branch_Codes_From
text
No
empty
Branch codes separated by commas, for example "2,5". Only challans of these branches are returned. Numbers and commas only.
Doc_Num_Like
text
No
empty
Only challans whose internal number starts with this text: CH followed by the challan date as yyyyMMdd, for example "CH202604". Challan returns use the same CH start. Used with the bookmark or a period.
Field names are matched without regard to upper or lower case. Other fields in the request (for example PartyUserCode, Branch_Codes_To) are ignored.
Rules Logic ERP applies
The rules of Get Purchase Vouchers apply, with these differences:
Only purchase challans are returned; challan returns never are (but see the known issue on deleted records).
Challans are not split by financial year. Challans of every year are kept together, so
Vouch_Codeis unique on its own and is your key.DateFromdoes not choose a year:Doc_Codesfinds a challan of any year, and"GlobalModifyCode": -1considers changes of every year. The known issue about earlier-year change-log lines on Get Purchase Vouchers does not apply here.Shared change log. Purchase challans and purchase challan returns share one change log of up to 150 lines per batch. A batch can hold no challans: you then get
"No Record Found."withStatus: trueand a higherLastGlobalModifyCode– store it and call again. You have caught up when the message is"No Pending Purchase Challan found..."andLastGlobalModifyCodeis the value you sent. Keep this endpoint's bookmark separate from the one for Get Purchase Challan Returns.Deleted challans. When a challan in your batch, period or
Doc_Codeshas been deleted, it is returned as a short record:Action_Codeis"2",ListItemsis an empty list, and onlyVouch_Code,Vouch_No,Vouch_DateandBranch_Codeare filled (GRN_PrefixandGRN_Numberare usually empty and0; every other field is empty or0). Remove the challan from your system. All other challans have an emptyAction_Code.Challans have no gate pass:
GPN_NumberandGPN_Dateare always empty, and the lines are never repeated.Qty_Scanned,Qty_RejectedandQty_Excessare always0.Challans use their own API site settings: the branches, series (GRN prefixes) and field choice your Logic ERP team set for purchase challans.
Known issue – a deleted challan return can appear as a deleted challan. The short records for deleted documents are taken from the change log shared with challan returns, without checking which kind of document was deleted. A short record with
Action_Code"2"can therefore be a deleted challan return. If you also store challan returns, look theVouch_Codeup among both before you remove it.
Example request
Next batch after your stored bookmark:
Two challans by their internal numbers (a deleted one comes back as a short record):
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. The example asks for the first batch of the change log. Do not send "GlobalModifyCode": -1 here – it changes what the sandbox has marked as already sent.
Returns your purchase challans (goods received from suppliers on a delivery challan, before the purchase bill) from Logic ERP, each with its header and item lines. Use it to copy new and changed challans into your own system — normally by asking only for challans added or changed since your last call — or to fetch particular challans by their internal number. Deleted challans are reported too.
The user name and password of your API site.
Your bookmark in the change log, as described in How Every API Call Works: 0 = from the start (or a period, with DateFrom/DateTo), a number = only changes after it, -1 = Logic ERP keeps the bookmark for you.
With GlobalModifyCode 0: a period of changes (the date a challan was saved, edited or deleted). Send both as null when you are not asking for a period. Write them as yyyy-MM-dd.
With GlobalModifyCode 0: a period of changes (the date a challan was saved, edited or deleted). Send both as null when you are not asking for a period. Write them as yyyy-MM-dd.
Logic ERP's internal challan numbers (Vouch_Code), separated by commas, for example "140,143". Returns exactly these challans (and a short record for each one that was deleted); the bookmark and period are ignored. Numbers and commas only.
Branch codes separated by commas, for example "2,5". Only challans of these branches are returned. Numbers and commas only.
Only challans whose internal number starts with this text: CH followed by the challan date as yyyyMMdd, for example "CH202604". Challan returns use the same CH start. Used with the bookmark or a period.
Always HTTP 200. Check Status, Message and GetData.
See the Status rules on this page and on How Every API Call Works.
Why the call failed, or a note. The reason may be followed by technical detail - read the first line.
The change-log bookmark (see How Every API Call Works).
Size of the answer, for example "2 KB".
No login was sent.
POST /api/GetPurchaseChallan HTTP/1.1
Host: demo.logicerp.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 52
{
"GlobalModifyCode": 0,
"DateFrom": null,
"DateTo": null
}{
"GetData": [
{
"Vouch_Code": 1,
"Vouch_No": "text",
"Vouch_Date": "text",
"Account_Code": "text",
"Account_Name": "text",
"Agent_Name": "text",
"Quantity": 1,
"Gross_Amount": 1,
"Net_Amount": 1,
"Total_Tax": "text",
"Branch_Name": "text",
"Branch_Code": 1,
"Currency_Name": "text",
"Bill_No": "text",
"Bill_Date": "text",
"GRN_Prefix": "text",
"GRN_Number": 1,
"Tax_Region_Name": "text",
"Goods_In_Transit": 1,
"Action_Code": "text",
"Doc_Type_Desc": "text",
"Doc_Type": "text",
"Gr_Number": "text",
"Gr_Date": "text",
"Order_No": "text",
"Order_Date": "text",
"Header_Remarks_1": "text",
"Header_Remarks_2": "text",
"Header_Remarks_3": "text",
"Transport_Mode": "text",
"Transport_Name": "text",
"Trans_ID": "text",
"Trans_Services": "text",
"Weight": "text",
"Cases": "text",
"GPN_Number": "text",
"GPN_Date": "text",
"ListItems": [
{
"Pur_Txn_Code": 1,
"Lot_Code": 1,
"Lot_Number": "text",
"AddlItemCode": "text",
"ItemCode": "text",
"PackName": "text",
"CF_1": 1,
"CF_2": 1,
"CF_3": 1,
"Item_Sale_Rate": 1,
"Item_Sp_Rate_1": 1,
"Item_Sp_Rate_2": 1,
"Item_Sp_Rate_3": 1,
"Item_Sp_Rate_4": 1,
"Item_Sp_Rate_5": 1,
"Item_Pur_Rate": 1,
"Item_MRP": 1,
"HSN_Code": "text",
"Quantity": 1,
"Lot_MRP": 1,
"Rate": 1,
"Tax_Amt_1": 1,
"Tax_Amt_3": 1,
"Pur_MRP": 1,
"Pur_Gross_Amt": 1,
"Pur_Net_Amt": 1,
"Pur_Round_Amt": 1,
"Pur_Net_Rate": 1,
"Gross_Pur_Amt": 1,
"CD": 1,
"TD": 1,
"SP_CD": 1,
"Scheme_Unit": 1,
"Scheme_Rs": 1,
"Freight": 1,
"Adjust_Item": 1,
"Handling": 1,
"Postage": 1,
"ExciseUnit": 1,
"ExcisePercentage": 1,
"CD_Per": 1,
"TD_Per": 1,
"SP_CD_Per": 1,
"Tax_P_1": 1,
"Tax_P_2": 1,
"Tax_P_3": 1,
"Qty_Scanned": 1,
"Qty_Rejected": 1,
"Qty_Excess": 1,
"ItemName": "text",
"ItemHDName": "text",
"ColorName": "text",
"ItemDesc_1": "text",
"CompanyName": "text",
"HSN_Serial_No": "text",
"HSN_Description": "text",
"HSN_UOM": "text",
"Packing": "text",
"Item_Group_Name_1": "text",
"LotPcsInfo": [
{}
]
}
]
}
],
"Status": true,
"Message": "text",
"LastGlobalModifyCode": 1,
"resultSize": "text"
}Response fields
Every field is the same as in the response of Get Purchase Vouchers (GetData items and ListItems). For a challan:
Vouch_Code
Internal challan number, unique across all years.
Vouch_No
The internal challan number shortened to year, -, month, day and serial, for example 2024-04262.
Doc_Type
CH (empty on a deleted challan's short record).
Doc_Type_Desc
Purchase Challan (empty on a short record).
GRN_Prefix, GRN_Number
The challan's series prefix and number, for example TGRN and 79.
Bill_No, Bill_Date
The supplier's challan or bill number and date.
Action_Code
"", or "2" for a deleted challan.
GPN_Number, GPN_Date
Always empty.
ListItems[].Qty_Scanned, Qty_Rejected, Qty_Excess
Always 0.
Example response
A challan and a deleted challan:
Messages you may see
No Pending Purchase Challan found... (with Status: true)
Nothing has been added to the change log after your bookmark.
You are up to date. Call again later with the same bookmark.
No Record Found. (with Status: true)
No purchase challan matched: the batch held only challan returns or challans outside your filters, nothing in the period was a challan, or the numbers you sent are not challans.
With a bookmark: store the new LastGlobalModifyCode and call again. Otherwise: check what you sent.
A database error (with Status: false), for example a message containing Invalid column name 'abc'.
Doc_Codes or Branch_Codes_From contained something other than numbers and commas. The reason may be followed by technical detail – read the first line.
Send numbers separated by commas.
The date messages listed in How Every API Call Works (with Status: true)
A period request with a missing or invalid date.
Send both dates as yyyy-MM-dd, or both as null.
Last updated