Hi Davut,
Thank you very much for your reply, I got the solution. below is the method I have used and it is working fine.
public void createRegisterline(SalesTable _salestable)
{
Integer lastRec = 0;
SalesId oldSalesId;
inventTrans inventTrans;
SalesFormLetter salesFormLetter;
inventTransOrigin inventTransOrigin;
TradeOrderLineRegister tradeOrderlineRegister;
autoRegistrationSBC salesReturnOrderLineRegister;
InventTransWMS_Register inventTransWMS_register;
TmpInventTransWMS TmpInventTransWMS;
ReturnDispositionCode returnDispositionCode;
Description255 errorMsg;
Args _args = new Args();
try
{
ttsBegin;
select firstOnly * from returnDispositionCode
where returnDispositionCode.DispositionAction == DispositionAction::Credit;
while select forUpdate salesLine
where _salestable.SalesId == salesLine.SalesId
&& _salestable.SalesType == SalesType::ReturnItem
{
try
{
_args.record(salesLine);
tradeOrderLineRegister = autoRegistrationSBC::construct();
tradeOrderLineRegister.parmArgs(_args);
tradeOrderLineRegister.init();
salesReturnOrderLineRegister = tradeOrderLineRegister;
salesReturnOrderLineRegister.runPreSuper();
//update returnDisposioncode
salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId;
salesLine.update();
select firstOnly crossCompany inventTrans
join RecId,InventTransId from inventTransOrigin
where inventTransOrigin.InventTransId == salesLine.InventTransId
&& inventTrans.InventTransOrigin == inventTransOrigin.RecId;
inventTransWMS_register = inventTransWMS_register::newStandard(tmpInventTransWMS);
tmpInventTransWMS.clear();
tmpInventTransWMS.initFromInventTrans(inventTrans);
tmpInventTransWMS.InventDimId = inventTrans.InventDimId;
tmpInventTransWMS.insert();
inventTransWMS_register.writeTmpInventTransWMS(tmpInventTransWMS,
inventTrans,
inventTrans.inventDim());
inventTransWMS_register.updateInvent(salesLine);
}
catch
{
continue;
}
}
ttsCommit;
}
catch
{
throw error("@SYS332911");
}
}