Sales Order Invoiced with line status open


I am having an issue in a sales order where I have shipped and invoiced all the QTY in the sales order status is showing as Invoiced but when I see the line status it’s showing as open order.

On checking the transaction I have one additional line created for the same sales lines with a status of “OnOrder” which seems to be a garbage value and that line is not allowing me to close the line I have attached the sample screen of that transactions. The second line is causing the issue

Can I delete those orphan records from the system to close the lines and if I delete them will there be any impacts on the other table data.

Can anyone help me to solve this?

Do you mean deleting the inventory transaction? If so, it is not suggested.

What is the delivery remainder on the sales order line? Does it allows you to set this to zero?

Hi Kranthi,

The deliver remainder on the sales line is 1108 which is coming from the second line also I get delivered and invoiced qty as 1108 which is coming from the first line. But in the Sales Order, I have only one Line with Qty 1108, Which has been invoiced.

Were you able to cancel the delivery reminder?

No, Kranthi. We are not able to cancel the delivery remainder.

Is the button disabled or do you receive any error while cancelling the delivery reminder?

Try running the below code in a job for your sales line. This will cancel the delivery remainder on that salesLine.

SalesLine salesLine;

select forUpdate salesLine
    where salesLine.SalesStatus == SalesStatus::Backorder
       && salesLine.SalesId == 'YourSalesId' // replace it with your sales Id
       && salesLine.InventTransId == 'YourLotId' // replace it wiht your inventTransId;

if (salesLine)
    salesLine.RemainSalesPhysical = 0;
    salesLine.RemainInventPhysical = 0;


Thank you very much for guiding me Kranthi. I want to know from where the line quantity on order is coming and how can I brings them to zero in SalesLine.

Is your initial query resolved?

How is the sales order created? Why do you want to make the quantity on sales order line to zero? Rather you could delete the line or cancel the delivery remainder.

Hi Kranthi,

My issue has cleared by using your job.Thanks for your guidance.