hello guys, i need help here
Inventory Management > Periodic > Transfer Orders > Lines
im making a button that can delete Transfer Order Lines that are not Reserved Physical,
but if the Line has partial Reserved Physical and partial On Order, I only have to delete the On Order.
here is the picture sample:
you can see the box in (Inventory > Transactions)
you can see in the picture that the Item 0000000004 is not Reserved Physical, so it has to be deleted (when the button is clicked)
and the 0000000009 has Partial Reserved Physical and On Order, so Ionly need to delete the On Order (it is in InventTrans)
I have this code here but when i run it, the AX goes "Microsoft AX client has stopped working" then after I reopen it,
the code first delete code works (delete partial on order) it only deletes all On Order Status (from InventTrans) and did not continue to Remove all Line that has no Reserve Physical, here is the output after button click(i reopen it because it goes "Microsoft AX client has stopped working" after button click):
now, i need the 0000000004 to be deleted because it is not Reserve Physical, and stop the "Microsoft AX client has stopped working", i think it is happening because my code is making Infinite loop? or the code is wrong.
here is my code:
void clicked()
{
InventTransOrigin inventTransOrigin;
InventTrans inventTrans;
ttsBegin;
{
while select forupdate inventTrans
join inventTransOrigin
where inventTrans.InventTransOrigin == inventTransOrigin.RecId
join InventTransferLine
where inventTransOrigin.InventTransId == InventTransferLine.InventTransId
&& inventTrans.StatusIssue != 4
&& InventTransferLine.TransferId == InventTransferTable.TransferId
if ( inventTrans)
{
inventTrans.delete();
}
}
ttsCommit;
InventTransferLine_ds.refresh();
while select InventTransferLine
join inventTransOrigin
where InventTransferLine.InventTransID == inventTransOrigin.InventTransId
join inventTrans
where inventTransOrigin.RecId == inventTrans.InventTransOrigin
&& inventTrans.StatusIssue != 4
&& InventTransferLine.TransferId == InventTransferTable.TransferId
InventTransferLine.delete();
super();
InventTransferLine_ds.refresh();
InventTransferLine_ds.executeQuery();
}
please help me modify my code, thanks.