For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Name
Detail

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

Field
Type
Required
Default
Meaning

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 DocCode above 0, the document with that internal number is used. Otherwise BillSeries + Bill_No are tried first, then PartyOrderNo, which must match exactly one challan or challan return of the branch.

  • You must send at least DocCode, or BillSeries with Bill_No, or PartyOrderNo.

Known issue – the party order number is not limited to returns. The PartyOrderNo search, and DocCode, look at sale challans and challan returns together. If the number belongs to a sale challan, that challan is cancelled. Use BillSeries and Bill_No with 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 the Bill_No you sent, and PartyOrderNo is 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 send DocCode.

Known issue – a DocCode that is not found. If no challan or return of the branch has the DocCode you sent, the request does not answer Unable to found Document…; it fails with a short technical database error in Message. Nothing is cancelled. Check the DocCode and the Branch_Code.

What blocks a cancel

Nothing is changed when any of these applies:

  • The return is already cancelled, or Cancel_Reason is 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), Message holds 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

Field
Type
Meaning

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

Message
Meaning
What to do

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.