returntable && salescopying update ?

hi

I have twe forms returntable(return orders) and salescopying(find sales order) when I create new record in returntable and click the button find sales orders the second form is shown salecopying I check line the custinvoicejour that I want to return and click ok it make update on the line of returntable form so I want to add to this update to get the custinvoicejour.invoiceid of salescopying and make it in the heading of returntable form how I can do this ?

this my code this code is on click button of form salescopying :

void clicked()
{

invoiceid invid;

CustInvoiceTrans custrans;
salestable st;

;

if (CustInvoiceTrans_Copy.checked(true))
{
//st =
custrans = CustInvoiceTrans_DS.cursor();
select maxof(salesid) from st where st.ReturnItemNum !="" && st.createdBy == curuserid();
select CustInvoiceJour where CustInvoiceJour.SalesId==custrans.SalesId;
invid = CustInvoiceJour.InvoiceId;
info(strfmt(“NumCMDTrans :%1,fact:%2,CMDR:%3”,custrans.SalesId,CustInvoiceJour.InvoiceId,st.SalesId));
ttsbegin;
select forUpdate salestable where SalesTable.SalesId == st.SalesId;
SalesTable.PurchOrderFormNum = CustInvoiceJour.InvoiceId;
SalesTable.update();
info(strfmt("%1",CustInvoiceJour.InvoiceId));
ttscommit;

}
super();

}

thank yoous