Monday 25 April 2016

Overdelivery of line is 100,00 percent, but the allowed overdelivery is only 0 percent.

We had the same problem with one of our client. The reason behind was, there were some orphans purchParmSubLine records lying in the table, which led to add up the remain del note qty and attempting to post Delivery note again. We suspected, the reasons these records were left in the table, when posting failed for any reason or client session crashed when posting was being done. Anyways, simple way to resolve it by creating a simple job to clean up those records and Hallelujah! the problem is gone!
static void tecDeleteOrphanParmRecords(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  == "Your PO number"
       && purchParmTable.ParmJobStatus == ParmJobStatus::Waiting
       && purchParmTable.Ordering == DocumentStatus::Invoice
   if(purchParmTable.RecId || purchParmLine.RecId)
   {
       purchParmTable.delete();
       purchParmLine.delete();
   }
   ttscommit;
}
Cleaning up PurchParmTable and Line will also clean up related tables (Sub tables) by itself.
Try posting again.  Everything should work smoothly.
Cheers!
PG