Tuesday, May 26, 2015

Over delivery of line is 100 percent, but the allowed over delivery is only 0 percent.

Q: I am getting the following error in AX 2009, how can I fix it?
"Over delivery of line is 100 percent, but the allowed over delivery is only 0 percent."

A:
Use the following script
static void fixPurchaseOrders(Args _args)
{
   PurchParmTable purchParmTable;
   PurchParmLine purchParmLine;
   ;
   ttsbegin;
   while select forupdate purchParmTable
       join forupdate purchParmLine
       where purchParmLine.ParmId == purchParmTable.ParmId
       && purchParmLine.TableRefId == purchParmTable.TableRefId
       && purchParmTable.PurchId == ""
       && purchParmTable.ParmJobStatus == ParmJobStatus::Waiting
       && purchParmTable.Ordering == DocumentStatus::Invoice
   if(purchParmTable.RecId || purchParmLine.RecId)
   {
       purchParmTable.delete();
       purchParmLine.delete();
   }
   ttscommit;

}