Cancel a Sale Challan
Cancels a sale challan (delivery challan) that is already saved in Logic ERP. The challan is not removed: it stays marked as cancelled, its number stays used, and what it had put in place is reversed — the stock comes back, sale-order quantities become pending again, its accounting entries (if the challan was posted in accounts) are removed, and loyalty points, discount coupons and gift vouchers linked to it are released. You point to the challan by its series and number, by your party order number, or by Logic ERP's internal number. A cancel cannot be undone.
Endpoint
Address
https://your-server/api/CancelSaleChallan
Method
POST
Authorization
Basic Auth
The response and the common messages are explained in How Every API Call Works.
This endpoint has its own licence, separate from Cancel a Sale Invoice. Send one challan per request. Field names are matched without regard to upper/lower case; fields not listed below are ignored.
Request fields
Branch_Code
number
Yes (in practice)
0
The branch the challan belongs to (Branch_Code in Get Branch Info). The challan is looked for in this branch only. A branch short name is not accepted.
DocCode
number
One of the three ways
0
Logic ERP's internal number of the challan – the LastSavedCode you received when you saved it. When it is above 0, BillSeries, Bill_No and PartyOrderNo are not used.
BillSeries
text
One of the three ways
empty
The challan series as shown in Logic ERP. It must be a sale challan series of the branch – a challan return series is not accepted here. Use it with Bill_No.
Bill_No
number
With BillSeries
0
The challan number within the series. A number only.
PartyOrderNo
text
One of the three ways
empty
The party order number saved on the challan. Used when DocCode is 0 and the challan was not found by series and number.
Cancel_Reason
text
Yes
–
Why the challan is cancelled. Stored with the cancellation, together with the Logic ERP user, date and time.
DisplayError
text
No
"0"
"1" = when the cancel fails, Message carries the full technical detail.
Rules Logic ERP applies
Finding the challan
The challan must belong to the branch in
Branch_Code. Challans of any financial year are found.With
DocCodeabove0, the document with that internal number is used. OtherwiseBillSeries+Bill_Noare tried first, thenPartyOrderNo, which must match exactly one challan or challan return of the branch.You must send at least
DocCode, orBillSerieswithBill_No, orPartyOrderNo.
Known issue – a wrong challan number with an empty
PartyOrderNo. If the series exists but no challan has theBill_Noyou sent, andPartyOrderNois empty, Logic ERP looks for a challan or challan return whose party order number is blank. If the branch has exactly one such document, that document is cancelled instead; if it has several, you get Duplicate Bill exists againts Party Order No. …. Check the number before you send it, or sendDocCode.
Known issue – a
DocCodethat is not found. If no challan of the branch has theDocCodeyou sent, the request does not answer Unable to found Document…; it fails with a short technical database error inMessage. Nothing is cancelled. Check theDocCodeand theBranch_Code.
Known issue – challan returns are not excluded.
DocCodeand thePartyOrderNosearch look at sale challans and challan returns together. If the number belongs to a sale challan return of the same branch, that return is cancelled. UseBillSeriesandBill_No, or send only theLastSavedCodeof a sale challan.
What blocks a cancel
Nothing is changed when any of these applies:
The challan is already cancelled, or
Cancel_Reasonis empty.For a challan posted in accounts: it has been billed (taken into a sale invoice), or advances have been received against it.
It has been marked as posted in Logic ERP's document posting.
It was transferred to head office or imported from another branch, when the user rights of your API user stop changes to such documents.
The challan date is in a locked period, on or before the lock date for modifications, or on or before the last physical stock entry date (when that lock is switched on).
It has been approved, when approved documents may not be changed; or it was changed by someone else while the cancel was running.
Cancelling would make the stock of a lot negative, when negative stock is not allowed.
What a cancel does
All of the following happen together, or none of them:
The challan and its lines are marked as cancelled and kept. Its number is not freed.
Stock of every line comes back, unless the challan was saved not to affect stock.
Quantities taken from sale orders and delivery orders become pending again.
If the challan was posted in accounts, its accounting entries are removed, and the advance entry made for it is reversed.
Loyalty points of the challan are removed, discount coupons used on it are released, and gift vouchers linked to it are unlinked from it.
Scheme records, alteration details and remarks of the challan are removed; the reason, user, date and time are recorded, and an audit-trail entry is written.
There is no endpoint that un-cancels a challan, and a cancelled challan cannot be cancelled again.
Known issue – the reason is sometimes missing from
Message. When the cancel is refused by one of the later checks (for example the challan has been billed, the lock date, insufficient stock),Messageholds a short technical text instead of the reason, and some refusals come back as The operation was canceled. Nothing was cancelled. Repeat the request with"DisplayError": "1": the reason appears inside the technical detail, after the short technical text. The operation was canceled. stays without a reason even then.
Example request
Response
Status
true / false
true when the challan was cancelled.
Message
text
"Success" when cancelled; otherwise the reason.
LastSavedCode
number
Logic ERP's internal number of the cancelled challan.
LastSavedDocNo
text
The challan number in Logic ERP's internal form of type, series and number, for example "CHDCH 118". null when the request failed.
request_ID
text
As described on the common page. null when the request failed before the challan was found.
Example response
Messages you may see
Please Define Bill No. Or PartyOrderNo to Continue...
None of DocCode, BillSeries or PartyOrderNo was sent.
Send one of them.
Bill No. not defined against Bill Series : …
BillSeries sent without Bill_No.
Send the challan number.
Unable to Retrive Bill Series : …
No sale challan series with that name in the branch (a challan return series gives this too).
Check the series and Branch_Code.
Duplicate Bill exists againts Party Order No. : … in Branch Code : …
More than one challan matched.
Send DocCode or the series and number.
Unable to found Document againts Party Order No. … and Branch Code : …
No challan matched in that branch. A DocCode that is not found gives a technical error instead – see the known issue.
Check the branch and the number.
Document has already been cancelled...
Already cancelled.
Nothing to do.
Please Enter Cancel Remarks to Continue...
Cancel_Reason is empty.
Send a reason.
Cannot allow cancellation.... This document has been posted.....
The challan is marked as posted.
Ask your Logic ERP team.
This document has been transferred to H.O. Modification not allowed......, This document has been imported from other Branches. Modification not allowed......
The challan was transferred between branches.
Cancel it where it was created.
Entry/Modification is locked for this period....
The challan date is in a locked period.
Ask your Logic ERP team.
The operation was canceled.
Refused by a check that does not return its reason. Nothing was cancelled.
Check the challan in Logic ERP, or ask your Logic ERP team.