Cancel sales order lines


I tried to cancel sales order lines, and when I check in delivery reminder to cancel qty its showing zero there. but when I open

salesline’s inventory/ transactions is showing onorder value as -1. useally it should not show record when we do manually.

if we do by script its showing. how to do it.

I used following script to cancel the sales line


while select forupdate salesLine

where salesLine.SalesId == salesTable.SalesId


salesLine.RemainInventPhysical = 0;

salesLine.RemainSalesPhysical = 0;






go to that sales order select that line go to update and click pick if packing slip you have not created then.

once you come here select that item and post in the same area under update line pick.

then cancel that line it will work,