How to cancel or close a Purchase Order

We create a new PO in AX 2009. There was a PO line for an item. Someone then went in and delete the line on the PO, so now when you open the PO, only the header shows up, no line.

I’m trying to either close/cancel/delete the PO. When I highlight the PO and click the red X, I get this error message:

“The purchase order can not be deleted because related not posted transactions exist”

We have not done anything with this PO, or line, as far as I can see. What do I need to do?

Thanks,

Hello Tony,

Click on the post buttons (po, packing slip, etc.) and if you find a line in one of those windows - probably with a red X - , delete it and try to delete the complete PO thereafter.

If this does not work, you might want to check the ‘pending PO invoices’ window under ‘places’.

If you find a line related to your PO there, delete it and try to delete the complete PO thereafter.

Hope it helps.

Cheers,

Ludwig

What if the PO is old, such as from 2009 and you just need to remove it, nothing ever received?

You can cancel the PO. go to lines>functions>deliver remainder>cancel qty

if you want to do it in code, you can do something like this:

void cancelPurchLine(recId PurchLineRecId)
{
PurchLine localPurchLine = PurchLine::findRecId(PurchLineRecId,true);
;
ttsbegin;

localPurchLine.RemainPurchPhysical = 0;
localPurchLine.RemainInventPhysical = 0;

localPurchLine.update();

ttscommit;
}