Cancel a Sale Challan Return
Cancels a sale challan return (goods taken back against delivery challans) that is already saved in Logic ERP. The return is not removed: it stays marked as cancelled, its number stays used, and what it had put in place is reversed — the returned goods are taken out of stock again, and challan lines it had returned are open again. You point to the return 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/CancelSaleChallanReturn
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. It works like Cancel a Sale Challan; the differences are the series it accepts and the direction of the stock. Send one return 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 return belongs to (Branch_Code in Get Branch Info). The return is looked for in this branch only.
DocCode
number
One of the three ways
0
Logic ERP's internal number of the return – 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 series of the return as shown in Logic ERP. It must be a challan return series of the branch – a normal challan series is not accepted here. Use it with Bill_No.
Bill_No
number
With BillSeries
0
The return number within the series. A number only.
PartyOrderNo
text
One of the three ways
empty
The party order number saved on the return. Used when DocCode is 0 and the return was not found by series and number.
Cancel_Reason
text
Yes
–
Why the return 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 return
The return must belong to the branch in
Branch_Code. Returns 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 – the party order number is not limited to returns. The
PartyOrderNosearch, andDocCode, look at sale challans and challan returns together. If the number belongs to a sale challan, that challan is cancelled. UseBillSeriesandBill_Nowith a challan return series to be sure.
Known issue – a wrong return number with an empty
PartyOrderNo. If the series exists but no return has theBill_Noyou sent, andPartyOrderNois empty, Logic ERP looks for a challan or return whose party order number is blank. If the branch has exactly one, 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 or return 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.
What blocks a cancel
Nothing is changed when any of these applies:
The return is already cancelled, or
Cancel_Reasonis empty.It has been marked as posted in Logic ERP's document posting, or 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 return 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.
Taking the goods out of stock again 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 return and its lines are marked as cancelled and kept. Its number is not freed.
The returned quantities are taken out of stock again.
Challan lines that the return had marked as returned are open again on their challans.
If the return was posted in accounts, its accounting entries are removed. Loyalty points, discount coupons and gift vouchers linked to it are released, as for a challan.
The reason, user, date and time are recorded, and an audit-trail entry is written.
There is no endpoint that un-cancels a return, and a cancelled return 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 lock date or 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 return was cancelled.
Message
text
"Success" when cancelled; otherwise the reason.
LastSavedCode
number
Logic ERP's internal number of the cancelled return.
LastSavedDocNo
text
The return number in Logic ERP's internal form of type, series and number, for example "CHCRT 14". null when the request failed.
request_ID
text
As described on the common page. null when the request failed before the return 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 return number.
Unable to Retrive Bill Series : …
No challan return series with that name in the branch (a normal challan series gives this too).
Check the series and Branch_Code.
Duplicate Bill exists againts Party Order No. : … in Branch Code : …
More than one document matched.
Send DocCode or the series and number.
Unable to found Document againts Party Order No. … and Branch Code : …
No document 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 return is marked as posted.
Ask your Logic ERP team.
Entry/Modification is locked for this period....
The return 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 return in Logic ERP, or ask your Logic ERP team.