Save a Stock Transfer Out Against a Sale Order
Creates a stock transfer out from a sale order that is already in Logic ERP. Use it when a branch (or a franchise outlet set up as a branch) has placed an order on the sending branch as a sale order, and you now dispatch goods against that order. You name the order and the items and quantities you are sending; Logic ERP takes the order's lines, issues stock for them from the sending branch, saves the transfer and takes the quantities off the order's pending quantity.
The transfer itself – stock-transfer series, receiving branch, taxes, automatic stock transfer in – works as described in Save a Stock Transfer Out. This page describes what is different when the transfer is made against a sale order. To transfer goods that have already been packed on a delivery order or packing slip, use Save a Stock Transfer Out Against a Delivery Order.
Endpoint
Address
https://your-server/api/SaveSTOAgainstSO
Method
POST
Authorization
Basic Auth
The response envelope, branches, dates, queueing and the common messages are explained in How Every API Call Works.
Send one transfer, against one sale order, per request. Field names are matched without regard to upper/lower case; fields not listed below are ignored. Send TenderDetails as [] or leave it out – null makes the request fail.
How the sale order is found
Send
Doc_Code: Logic ERP's internal number of the sale order – theLastSavedCodeyou got from Save a Sale Order, or the order's internal number in Get Sale Orders. This is the reliable way.Or leave
Doc_Codeat0and sendOrderNo: Logic ERP then looks for a sale order of the branch whose party order number (theParty_Order_Nosent with Save a Sale Order) is exactlyOrderNo. See the known issues on the branch and on duplicate party order numbers.With
Doc_Code, the transfer is saved in the order's branch – theBranchCodeyou send is replaced by it. The order's branch is the sending branch.The party is the order's customer;
PartyUserCodeis ignored. For a proper stock transfer, the sale order must be made out to the receiving branch's stock-transfer party (see Save a Stock Transfer Out, How the receiving branch and party are chosen).STBranchCodeworks as there.A sale order that is waiting for approval is refused, and so is an order with nothing pending (cancelled orders and cancelled lines count as nothing pending).
What is transferred
Items and quantities. For each item in
LstItems, the quantity you send is spread over that item's open lines on the order, each line taking at most its pending quantity. Lines of the same item inLstItemsare added together. Items of the order you do not list stay pending.Not more than is pending. If you send more of an item than the order still has pending, or the sending branch cannot issue the full quantity, nothing is saved and the message names the item with both quantities (Unable to Create Bill for Item : … with Quantity : … Order Qty : …; "Order Qty" here is the quantity Logic ERP could take).
Items not on the order are refused (Unable to found Item Code : … and Rate : …). When none of the items you list has anything pending on the order, the message is No Pending Item Present against Sale Order.. instead.
Empty
LstItems. WhenLstItemsis empty or left out, everything still pending on the order is taken. The request does not then compare what was taken with what was pending – check the transfer in Logic ERP.Stock. Stock reserved against the order line is used first, then other lots with stock at the sending branch, as on Logic ERP's sale screen when an order is pulled in.
Lot numbers.
Lot_Nomust exist for the item. It chooses the lot only when your API site is set to require lot numbers for this endpoint: then stock is taken only from the lots you name for that item (from the lot named on the order line, if it names one; from any lot with stock for an item sent withoutLot_No), and if there is none with stock the request fails with a message starting Stock not available for Item :. Otherwise Logic ERP picks the lots itself.Rates are not taken from the request. Each line is priced as on Logic ERP's sale screen when an order is pulled in: from the series' price list, or from the order line's rate (and CD %) when the stock-transfer series is set to pick them from the sale order.
Rate,Mrp,CD_P,TD_P,SPCD_P,Scheme_Rs,AdjustItem_RsandItemDescriptioninLstItemsare ignored. Transfer-levelCD_P,TD_P,SpCD_P,Freight,Handling,SpDiscountRsandAdjustment_Rsstill apply as on Save a Stock Transfer Out.Some details are carried over from the order – for example its agent, and its external order ID, which replaces
Order_Id.
What happens to the sale order
The transferred quantity is taken off the pending quantity of the order lines it came from. The rest stays pending and can be transferred later with another request.
If your API site is set to cancel what is still pending after a transfer against an order, the rest of the order is cancelled right after the transfer is saved, with the reason Auto Cancel After STO from API. If that cancellation fails, the transfer stays saved and the answer does not say so – check the order in Logic ERP.
Request fields
The request has the same shape as Save a Stock Transfer Out. Fields not in this table – BillSeries, Bill_Number, Bill_Date, Ext_Bill_No, Tax_Region, GST_State_Code, Tax_Form_Name, PaymentMode, ActEntryPartyUserCode, AgentName, TransporterName, CostCenter, transport, delivery and remark fields, CurrencyName, ExchangeRate, CreditDays, Godown_Name, Ext_NetSale_Value, DisplayError, Request_ID and the transfer-level discounts and charges – work exactly as described there.
Doc_Code
number
Yes, or OrderNo
0
Logic ERP's internal number of the sale order (see above).
OrderNo
text
Yes, if Doc_Code is 0
empty
The order's party order number, used to find the order when Doc_Code is 0. It is also saved on the transfer as its order number and is subject to the order-number setting described in Save a Stock Transfer Out (see the known issue below).
BranchCode
number
No
0
Ignored when Doc_Code is sent (the order's branch is used). See the known issue for OrderNo.
BranchShortName
text
No
empty
Used to choose the branch when the order is found by OrderNo.
BillSeries
text
No*
see rules
A stock-transfer series of the order's branch. *Not used when your API site links the order's series to a sale series (see the known issue below).
STBranchCode
number
No
the party's linked branch
As on Save a Stock Transfer Out.
LstItems
list
No
empty
The items to transfer from the order. Empty or left out = everything still pending.
PartyUserCode, EntrySource, TenderDetails (when not null), InvoiceType, Doc_Type, RCU_… fields, Billing_Address1, Billing_Address2, BillingAddress, ShippingAddress, Token_No
–
No
–
Ignored by this endpoint.
LstItems
LogicUserCode
text
Yes, or AddlItemCode
empty
The item code shown in Logic ERP (UserCode in Get Item Master). Must be on the order. Do not send null.
AddlItemCode
text
Yes, or LogicUserCode
empty
The item's additional code / barcode, used when LogicUserCode is empty. Do not send null.
Quantity
number
Yes
–
Quantity to transfer; more than 0.
Lot_No
text
No
empty
Must exist for the item; chooses the lot only with the lot setting described above.
Rate, Mrp, CD_P, TD_P, SPCD_P, Scheme_Rs, AdjustItem_Rs, ItemDescription, SchemePerUnit, LabourPerUnit, AdjustmentPerUnit, AdjustmentRs, GodownName, Production_Unit, SaleOrSR
–
No
–
Ignored – rates and discounts are worked out by Logic ERP (see above).
Rules Logic ERP applies
Series. If your API site links the sale order's series to a sale series, that series is used and
BillSeriesis ignored. OtherwiseBillSeriesis looked up among the stock-transfer series of the order's branch; if it is empty or not found, the series linked to the party, then the default series of this endpoint in your API site is used – checkInvoice_Noin the answer.Date and financial year. The transfer is dated
Bill_Date(today when left out), andBill_Datedecides the financial year.Order-number setting. When your API site's order-number setting is on for this endpoint,
OrderNois required and must not already be used on a sale document of the same party in the same branch and financial year. It is checked once, before saving.Payments.
TenderDetailsis not used.Duplicates. There is no duplicate check on the request. A transferred quantity is no longer pending, so a repeat finds less to take: it is refused when the order has nothing left of the item, and transferred again when something is left. Check
Statusbefore you resend.After saving. The automatic stock transfer in, background saving and request storing work as on Save a Stock Transfer Out. The transfer, its lines and the change to the order's pending quantities are saved together; if anything fails, nothing is saved.
Your Logic ERP licence must include this endpoint.
Known issue –
BranchCodeis lost when the order is found byOrderNo. WhenDoc_Codeis0, theBranchCodeyou send is cleared before the order is looked up, so Logic ERP searches the branch named inBranchShortName, or else a default branch – and does not find an order of another branch (Unable to Retrieve Sale Order...). SendDoc_Code, or sendBranchShortNametogether withOrderNo.
Known issue – the same party order number on two sale orders. Party order numbers are unique only per party, so two parties' orders in the same branch can share one. When the order is found by
OrderNo, either of them may be taken. SendDoc_Codewhen this can happen.
Known issue – a second transfer against the same order with the order-number setting on. With your API site's order-number setting on,
OrderNomust be new for the party. If you find the order byOrderNo, the second transfer against the same order uses the sameOrderNoand is refused with Order No. already exists for same Customer.Please Check. For orders you transfer in parts, sendDoc_Codeand a newOrderNoeach time.
Known issue – series linked to the order's series. When your API site links the sale order's series to a sale series, that series is used even if it is not a stock-transfer series, and
BillSeriesis ignored without a message. CheckInvoice_Noin the answer, and ask your Logic ERP team to link the order series to a stock-transfer series.
Known issue – the document is marked as a transfer only through the party. This endpoint does not itself mark the document as a stock transfer: Logic ERP takes that mark from the party's "stock-transfer party" setting. If the sale order is made out to a party that is not a stock-transfer party, the document is normally saved as an ordinary sale in the stock-transfer series – for example the receiving branch's stock limit is not checked. Make the sale order out to the receiving branch's stock-transfer party.
Known issue –
WayBillNo. A way bill is never linked to the transfer, and a way bill that is not finalised is refused with Way Bill No. :… is already Finalized..Please Check. LeaveWayBillNoout.
Known issue – an apostrophe in a code or name. Codes and names you send (order number, series, lot number, tax region, godown, agent, transporter, cost centre and so on) are looked up exactly as typed. An apostrophe (
') in any of them makes the request fail with a database error. Leave apostrophes out of codes and names you send.
Example request
Response
Status
true / false
true = the transfer was saved.
Message
text
Why it failed. On success it is empty, or holds the notes and the Saved Doc No. text described on Save a Stock Transfer Out.
LastSavedCode
number
Logic ERP's internal number of the transfer out.
request_ID
text
The ID of this request – quote it to support.
Invoice_No
text
The transfer's number, for example STO-61, or your Ext_Bill_No.
Order_No
text
The sale order's number in Logic ERP (its prefix and number), for example SO-245. Empty when the request fails.
PartyOrderNo
text
The order number held on the transfer – normally the OrderNo you sent.
PrintFile
text
Always empty.
Example response
Messages you may see
All with Status: false. Text in … is replaced by the value concerned. Where the reason comes from an error inside Logic ERP it may be followed by technical detail – read the first line. The messages about the series, Bill_Number, item codes, lot numbers, the order-number setting, names that are not found, currency, way bill, credit limit, Ext_NetSale_Value and request storing are the same as on Save a Stock Transfer Out.
Unable to Retrieve Sale Order...
Doc_Code is 0 and no sale order of the branch has that party order number (or OrderNo is empty too).
Send Doc_Code, or check OrderNo and the branch (see the known issue).
Doc_Code (Sale Order Code) : … not exists..Please Check...
No sale order has that internal number.
Check Doc_Code.
Sale Order Is marked as Un Approved. Cannot allow Bill Creation :…
The order is waiting for approval.
Have the order approved in Logic ERP first.
No Pending Item Present against Sale Order..
The order (or the items you listed) has nothing pending – fully transferred, cancelled, or the items are not on it.
Check the order with Get Sale Orders.
Unable to found Item Code : … and Rate : … (followed by a few more words)
An item in LstItems has no pending line on the order. The rate shown is not used.
Send only items that are pending on the order.
Unable to Create Bill for Item : … with Quantity : … Order Qty : …
Less than the quantity you sent could be taken – more than is pending on the order, or not enough stock.
Send at most the pending quantity, or check stock.
Unable to Create Bill because stock not available Item Code : …
None of the item could be taken.
Check stock at the sending branch.
A message starting Stock not available for Item :
Your API site requires lot numbers for this endpoint and the lots you named have no stock.
Send lots that have stock.
Unable to Retrieve Accounts...
The order's customer could not be read.
Check the sale order in Logic ERP.
A message containing Request cannot be processed. API Template is marked as In-Active in the configuration.
Your Logic ERP team has switched this endpoint off for the branch. The answer is Status: false with technical text around the sentence. Nothing is saved.
Ask your Logic ERP team.
Last updated