Sales order reference

Hi All

I have one sales order, now i make the return order of that sales order. Is there any way from which i can know this return order is of that particular sales order. Currently i am putting the sales order number in customer reference feild while creating the return order.


Hi Imran,

In Return order form, Click Functions button > Find a Sales Order. In Find Sales Order form, select the Sales order by marking & select the Quantity of Return goods.


yes thats the “return order process” that what we are doing. i just want to know at the return order form if i want to know for which sales order this return order id prepared. Is there any field on the form that tell me this is the return order for that particular sales order.



Hi Adam,

Can we track the original sales order of a return order by using InventTransId or…???


There is a reference lot, and if you use serial or batch numbers you could do it - so it depends upon your traceability, but it does not on teh return order header or line tell you directly what the sales order copied from is.


I remember i have seen the reference in the Return order which tell us from which SO the return is created. I dont remember whether it was customized application.

I was wondering what iformation that the fields in the “other” tab of Return order lines will show and when? I suspect this fields should the reference sales order number. Please let us know

Those are just the sales order reference fields when DD is used I believe - if you copy an invoiced order in they are not populated. Happy to be wrong if you can get something in there [:D]


Actually that my previous problem before but I already solved it. The relation of Return Order to Sales Order is

SalesLine.InvenrTransId == SalesLine.InventTransIdReturn

It will allow you to locate the related InvoiceId and SalesId of RMA.

Here’ s my code in x++ Hope it help.

public void processReport()


SalesId saledId;

Query q;

QueryRun qr;

QueryBuildDataSource qbds;

QueryBuildDataSource qbds2;

QueryBuildRange qbr;

Salestable salesTable;

SalesLine salesLine;

Salestable rmasalesTable;

SalesLine rmasalesLine;

CustInvoiceTrans custInvoiceTrans;

HcmWorker hcmWorker;

DirPerson dirPerson;

DirPersonName dirPersonName;

ReturnReasonCode returnReasonCode;

DataArea dataArea;

DirPartyPostalAddressView dirPartyPostalAddressView;

InventDim inventDim;

CustTable custTable;


q = this.parmQuery();

qr = new QueryRun(this.parmQuery());



salesLine = qr.get(tableNum(SalesLine));//Salestable from Datasource of Query

select * from salesTable

where salesLine.SalesId==salesTable.SalesId && salesLine.dataAreaId==salesTable.dataAreaId;

select * from returnReasonCode

where returnReasonCode.ReasonCodeId==salesTable.ReturnReasonCodeId&&returnReasonCode.dataAreaId==salesTable.dataAreaId;

select * from dataArea


select * from custTable

where custTable.AccountNum==salesTable.InvoiceAccount;

select * from dirPartyPostalAddressView

where dirPartyPostalAddressView.Party == custTable.Party;

jgf_RMA_TMP.ReturnItemNum = salesTable.ReturnItemNum;

jgf_RMA_TMP.CreateDate = salesTable.createDate();

jgf_RMA_TMP.ReturnReasonCodeId = salesTable.ReturnReasonCodeId;

jgf_RMA_TMP.Description = returnReasonCode.Description;

jgf_RMA_TMP.CompanyName =;

jgf_RMA_TMP.Address = dirPartyPostalAddressView.Address;

jgf_RMA_TMP.Customer = salesTable.customerName();

select * from rmasalesLine

where salesLine.InventTransIdReturn == rmasalesLine.InventTransId && salesLine.dataAreaId == rmasalesLine.dataAreaId;

select * from custInvoiceTrans

where custInvoiceTrans.SalesId==rmasalesLine.SalesId&&custInvoiceTrans.dataAreaId==rmasalesLine.dataAreaId;

select * from rmasalesTable

where rmasalesLine.SalesId==rmasalesTable.SalesId && rmasalesLine.dataAreaId==rmasalesTable.dataAreaId ;

select * from hcmWorker

where rmasalesTable.WorkerSalesResponsible==hcmWorker.RecId;

select * from dirPersonName

where dirPersonName.Person == hcmWorker.Person;

select * from inventDim

where inventDim.inventDimId==rmasalesLine.inventdimid

&& inventDim.dataAreaId==rmasalesLine.dataAreaId;

jgf_RMA_TMP.InvoiceId = custInvoiceTrans.InvoiceId;

jgf_RMA_TMP.InvoiceDate = custInvoiceTrans.InvoiceDate;

jgf_RMA_TMP.Salesman = (dirPersonName.FirstName + ’ ’ + dirPersonName.MiddleName + ’ ’ + dirPersonName.LastName );

jgf_RMA_TMP.SalesID = rmasalesLine.SalesId;

jgf_RMA_TMP.DeliveryDate = rmasalesTable.DeliveryDate;

jgf_RMA_TMP.ItemId = rmasalesLine.ItemId;

jgf_RMA_TMP.Name = (rmasalesLine.Name + ’ : ’ + inventDim.InventSizeId);

jgf_RMA_TMP.QTYORDERED = rmasalesLine.QtyOrdered;

jgf_RMA_TMP.SALESUNIT = rmasalesLine.SalesUnit;

jgf_RMA_TMP.SALESPRICE = rmasalesLine.SalesPrice;

jgf_RMA_TMP.LINEAMOUNT = rmasalesLine.LineAmount;




My “No” answer was based upon standard, clearly you could customize it, you can customize anything [:D]