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

Save a Sale Return Against a Sale Challan Return

Turns a sale challan return that is already in Logic ERP into a billed document. A sale challan return brings goods back on a challan – stock comes back, but nothing is posted to the party's account yet. This endpoint takes the lines of that challan return that are not billed yet, prices and taxes them, and saves them as one document posted to the party's account. You send the challan return's internal number; you do not send the items.

To record goods coming back without a challan return, use Save a Sale Return. To create the challan return itself, use Save a Sale Challan Return.

Endpoint

Name
Detail

Address

https://your-server/api/SaveInvoiceAgainstSaleChallanReturn

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 Sale Invoice, but this endpoint reads only the fields below. Field names are not case-sensitive. Names are looked up without regard to capitals; spaces around them are not trimmed (only Tax_Region and TransporterName are trimmed).

Field
Type
Required
Default
Meaning

Doc_Code

number

Yes

0

Logic ERP's internal number of the sale challan return – the LastSavedCode you got from Save a Sale Challan Return.

BranchCode

number

No – but always send it (or BranchShortName)

0

The branch where the challan return was saved. The document itself is always saved in the challan return's branch; this field decides which branch's API settings and financial year are used – see the rules.

BranchShortName

text

No

empty

The branch's short name, used only when BranchCode is 0.

Bill_Date

date

No

today

Date of the document, yyyy-MM-dd. It decides the financial year it is saved in. It does not have to match the challan return's date.

BillSeries

text

No

see rules

A sale return series of the branch, by name.

Bill_Number

number

No

0

0 = next number of the series; above 0 = used as the number (needs BillSeries, must be free).

Ext_Bill_No

text

No

empty

Your own document number; kept as the displayed number and returned in Invoice_No.

ActEntryPartyUserCode

text

No

the challan return's party

A different account to post the document to in the accounts, by its code.

Tax_Region

text

No

the default of the series and party

The tax region, by name. "AUTO" is not supported here.

GST_State_Code

text

No

Logic ERP's value

Place-of-supply state code. Used whenever sent (no API setting needed on this endpoint).

PaymentMode

text

No

the series' setting

"CASH" or "CREDIT", in capitals.

OrderNo, OrderDate, Order_Id

text, date, text

No

empty

Your references, kept on the document. No duplicate check is made.

AgentName, CostCenter, Tax_Form_Name, TransporterName, TransportMode, WayBillNo, CurrencyName, ExchangeRate, CreditDays

No

As on Save a Sale Invoice. See the known issue about WayBillNo on that page.

CD_P, TD_P, SpCD_P, Freight, SpDiscountRs, Adjustment_Rs, Handling

number

No

0

Document-level discounts and charges, applied over the challan return's lines. Only values above 0 are used.

Ext_NetSale_Value

number

No

0

When not 0, the document is refused if Logic ERP's net amount differs.

Remarks1, Remarks2, Remarks3, DeliveryAt, DeliveryAdd1, DeliveryAdd2, Cases, Weight, PVTMark, GRNo, GRDate, Challan_No, Challan_Date, Insurance_Policy_No, Declaration_No, DeclarationNo

No

empty

Kept on the document, as on Save a Sale Invoice.

Sale_BillNo, Sale_Bill_Date

text, date

No

empty

Read but not saved.

LstItems

list

No

empty list

Not used to choose lines – every open line of the challan return is billed. If you send lines, each is still checked (item code, quantity above 0, lot number exists for the item), and a wrong one stops the request. Leave it empty.

Godown_Name

text

No

empty

Not used – the lines keep the challan return's godowns – but a name that does not exist still stops the request. Leave it empty.

TenderDetails

list

No

empty list

Not used. Send [] or leave it out – never null.

RCU_First_Name, RCU_State

text

No

empty

Used only in one case: without RCU_Mobile_No and RCU_Email, when both are the same word, the document is linked to the one retail customer with that first name in that state. Otherwise no retail customer is created or looked up.

Request_ID

text

No

empty

Used only when your API site keeps requests for later processing, as on Save a Sale Invoice.

DisplayError

text

No

"0"

"1" = when the request fails, Message holds the full technical detail. Use only while testing.

Ignored fields. PartyUserCode (the party is always the challan return's party), Doc_Type, Token_No, STBranchCode, InvoiceType, EntrySource, BillingAddress, ShippingAddress, Billing_Address1, Billing_Address2 and the other RCU_… fields are accepted but not used.

Rules Logic ERP applies

  • What is billed. Every line of the challan return in Doc_Code that is not billed yet, has a quantity and is approved – with the challan return's items, lots, quantities, rates, discounts and godowns. Filters set on the return series in Logic ERP (default companies, challan series, party item groups) can leave some lines out. The challan return itself must be approved. Lines that were taken back against an earlier sale challan (they reduce that challan rather than stand on their own) are not picked up. You cannot bill only part of a challan return.

  • Party. The document is made out to the challan return's party; PartyUserCode is ignored. A party locked for billing is refused.

  • Branch. The document is saved in the challan return's branch, and the series is looked up there. BranchCode only decides which branch's API settings, financial year and number check are used, so send the branch where the challan return was saved.

  • Series and number. The series is, in this order: the series your Logic ERP team has linked to the challan return's series in the API site setup, else the BillSeries you send (a sale return series of the challan return's branch), else the series linked to the party for sale bills, else the API site's default series. A BillSeries that is not found is skipped without a message – check Invoice_No in the response. The document gets the next number of that series in the year of Bill_Date unless you send Bill_Number.

  • Stock is not moved again. The challan return already brought the goods back into stock; this document only bills those lines.

  • Tax and totals. Logic ERP works out GST and other taxes on the challan return's lines for the tax region, applies the schemes set up in Logic ERP and rounds the total, as its own screens do. If the party is set up for TCS, TCS is worked out on this document as on a sale bill.

  • No sale history link. The lines are not linked to an original sale bill; no sale history is searched and OrderNo is only a reference.

  • No tenders, no retail customer. TenderDetails and the retail customer fields are not used (except the first-name and state look-up above).

  • Duplicates. A challan return line that has been billed is not billed again, so sending the same Doc_Code twice does not bill the lines twice; the second request finds nothing left to bill and saves nothing.

  • All or nothing. The document and all its lines are saved together. If anything fails, nothing is saved.

  • Your Logic ERP team can set the API site to save in the background or keep requests for later processing, as on Save a Sale Invoice.

Known issue – the document is saved as a sale bill. This endpoint builds the document in sale-bill mode: although the series is looked up among sale return series, the document is numbered and saved with the sale-bill document type, with the challan return's lines as return lines in it. It therefore appears among sale bills, not among sale returns. Check the result in Logic ERP before you rely on this endpoint; to record a return as a sale return, use Save a Sale Return.

Known issue – Doc_Code is not checked to be a challan return. Any sale challan's number is accepted, and its open lines are billed. Make sure you send the internal number of a sale challan return.

Known issue – a switched-off endpoint answers "Status": false. When your support team has switched this endpoint off for the branch, the answer is "Status": false with technical text containing Request cannot be processed. API Template is marked as In-Active in the configuration, not "Status": true as described in How Every API Call Works. Either way nothing is saved.

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, so use test values like the example. The example's challan return has already been billed, so sending it unchanged answers that there is nothing left to bill; save a new challan return on its page first and put its LastSavedCode in Doc_Code.

Save a Sale Return Against a Sale Challan Return

post

Turns a sale challan return that is already in Logic ERP into a billed document. A sale challan return brings goods back on a challan – stock comes back, but nothing is posted to the party's account yet. This endpoint takes the lines of that challan return that are not billed yet, prices and taxes them, and saves them as one document posted to the party's account. You send the challan return's internal number; you do not send the items.

Authorizations
AuthorizationstringRequired

The user name and password of your API site.

Body
Doc_CodeintegerOptional

Logic ERP's internal number of the sale challan return – the LastSavedCode you got from Save a Sale Challan Return.

BranchCodeintegerOptional

The branch where the challan return was saved. The document itself is always saved in the challan return's branch; this field decides which branch's API settings and financial year are used – see the rules.

Bill_DatestringOptional

Date of the document, yyyy-MM-dd. It decides the financial year it is saved in. It does not have to match the challan return's date.

BillSeriesstringOptional

A sale return series of the branch, by name.

Bill_NumberintegerOptional

0 = next number of the series; above 0 = used as the number (needs BillSeries, must be free).

OrderNostringOptional

Your references, kept on the document. No duplicate check is made.

Remarks1stringOptional

Kept on the document, as on Save a Sale Invoice.

Tax_RegionstringOptional

The tax region, by name. "AUTO" is not supported here.

LstItemsobject[]Optional

Not used to choose lines – every open line of the challan return is billed. If you send lines, each is still checked (item code, quantity above 0, lot number exists for the item), and a wrong one stops the request. Leave it empty.

TenderDetailsobject[]Optional

Not used. Send [] or leave it out – never null.

Responses
200

Always HTTP 200. Check Status and Message.

application/json
PrintFilestringOptional

Always empty.

Invoice_NostringOptional

The new document's number, or your Ext_Bill_No. For a series with its own number format this is the formatted number (for example 26-27/2/ESR-35); otherwise series and number (for example ESR-9).

Order_NostringOptional

The challan return's document number as Logic ERP stores it internally, for example CHCRET12.

PartyOrderNostringOptional

The OrderNo you sent.

StatusbooleanOptional

true when the document was saved.

MessagestringOptional

Empty when saved, unless your Logic ERP shows the document number after saving. When automatic export is set up for your company, a note from that step can follow in the same text even though the document was saved – for example Export Virtual Txns : No Suppliers Linked With Current Branch, Can Not Export in Auto Mode .... Go by Status. The reason when not saved.

LastSavedCodeintegerOptional

Logic ERP's internal number of the new document; 0 when not saved.

request_IDstringOptional

The ID of this request – quote it to support.

post/SaveInvoiceAgainstSaleChallanReturn
POST /api/SaveInvoiceAgainstSaleChallanReturn HTTP/1.1
Host: demo.logicerp.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 199

{
  "Doc_Code": 193,
  "BranchCode": 2,
  "Bill_Date": "2026-10-30",
  "BillSeries": "ESR",
  "Bill_Number": 0,
  "OrderNo": "APITEST-SRC-001",
  "Remarks1": "API TEST",
  "Tax_Region": "CGST/SGST",
  "LstItems": [],
  "TenderDetails": []
}
{
  "PrintFile": "text",
  "Invoice_No": "text",
  "Order_No": "text",
  "PartyOrderNo": "text",
  "Status": true,
  "Message": "text",
  "LastSavedCode": 1,
  "request_ID": "text"
}

Response

Field
Type
Meaning

Status

true / false

true when the document was saved.

Message

text

Empty when saved, unless your Logic ERP shows the document number after saving. When automatic export is set up for your company, a note from that step can follow in the same text even though the document was saved – for example Export Virtual Txns : No Suppliers Linked With Current Branch, Can Not Export in Auto Mode .... Go by Status. The reason when not saved.

LastSavedCode

number

Logic ERP's internal number of the new document; 0 when not saved.

request_ID

text

The ID of this request – quote it to support.

Invoice_No

text

The new document's number, or your Ext_Bill_No. For a series with its own number format this is the formatted number (for example 26-27/2/ESR-35); otherwise series and number (for example ESR-9).

Order_No

text

The challan return's document number as Logic ERP stores it internally, for example CHCRET12.

PartyOrderNo

text

The OrderNo you sent.

PrintFile

text

Always empty.

Example response

Messages you may see

Messages from Logic ERP's own checks also come back in Message. Where the code adds technical detail, the reason may be followed by technical detail – read the first line.

Message
Meaning
What to do

Unable to Sale Challan...

Doc_Code is 0 or missing.

Send the challan return's internal number.

Doc_Code (Challan Code) : … not exists..Please Check...

No challan has that number.

Check Doc_Code.

Error Occured While Retriving Sale Challan.Please Check...

The challan return's lines could not be read.

Check the challan return in Logic ERP.

"Status": false with No Items present...., another message from Logic ERP, or an empty Message

Nothing is left to bill – the lines are billed already, or the challan return is not approved.

Check the challan return in Logic ERP.

Bill Series : … Not found for Branch Code :… in API Parameter.. / Default Bill Series Not Set for Branch Code :…

No series was found.

Send a return series of the branch, or ask for a series link or default.

Cannot allow Bill Saving If Bill Number defined without Bill Series....

Bill_Number without BillSeries.

Send both, or neither.

Bill No. […] against Branch Code : … already exists...Please Check..

That number is used.

Send another number, or 0.

Unable to Retrieve Accounts...

The challan return's party could not be found.

Check the challan return in Logic ERP.

Sale Bill Locked against Party(Setup New Accounts)

The party is locked for billing.

Ask your Logic ERP team.

Unable to found Tax Region : …

The tax region does not exist (AUTO is not supported here).

Use a region name from Logic ERP.

Invalid LogicUserCode / EANCode : …, Invalid Item Qty : …, Unable to found LotNo : … againts EAN/Item Code : …

A line in LstItems is wrong.

Leave LstItems empty.

Invalid Godown Name […]. Please Check...

Godown_Name does not exist.

Leave Godown_Name empty.

Currency Name : … not found...Please Check..., Exchange Rate not Defined for Currency Name :…...Please Check...

The currency is unknown, or sent without an exchange rate above 0.

Fix CurrencyName / ExchangeRate.

Net Value cannot match with External Net Value...

Ext_NetSale_Value differs from Logic ERP's net amount.

Check the challan return and the discounts sent.

Date not Within Financial Year

Bill_Date is outside the financial year.

Check the date.

Unable to found A/E Party : …, Invalid Agent […] .Please Check, Unable to found Cost Center […] .Please Check, Invalid Tax Form […] .Please Check, Transporter Name [ … ] not found. Please Check...

A code or name was not found.

Send it exactly as in Logic ERP.

A technical error naming a save step

Saving failed inside Logic ERP; nothing was saved.

Retry once; if it repeats, send the request_ID to support.

Last updated