Cannot update PO due to expiration - Ax 2012

This question has suggested answer(s)
Hi All,
We have come across a strange error on just modifying a PO. A PO was created with 8 lines and a line was revised and the same line deleted successfully confirmed. However when the user attempts to create a new line, system is throwing as error
“Cannot edit a record in purchase line history (Purchlinehistory). Invalid value specified for ‘Exprration’.  It has to be less than the expiration of next record.”
On the PurchLineHistory table, we see the deleted line (and its versions) and has a value in the ValidTo column. All other PO lines hold the value “Never”. What we are not able to figure out is what caused the change of the value in that column to a specific date. Tried recreating the issue, but in vain. The only solution we have found so far is by deleting the problem records in the PurchLineHistory table.
Has anyone encountered this problem before? This was a very normal PO modification that happens realistically.
All Replies
  • Hi Pranav,

    I'm experiencing the same issue.  Have you made any headway?


  • We found that the resolution is to delete the record from purchlinehistory table and it will allow you to edit the purchase line.


  • Hi Debra,

    This workaround in allready we are following.. but this is not solution. Asking client to delete record from backend is not suggested.



  • We are having the same issue... any idea what causes this, or an update on how to resolve it?

  • I'm still deleting the records.  I've only seen it happen a couple of times.  I think it is caused when a change is made, but it runs a long time and the user kills the session.

  • I have came across a similar situation when dealing with Intercompany orders. There are two legal entities in this scenario. One legal entity creates actual SO for external customer and using intercompany and direct delivery features of standard AX the linked intercompany PO and SO are created, when end user tries to update Unit price in original SO for external customer they come across the same error:

    “Cannot edit a record in purchase lines history. Invalid value specified for expiration. It has to be less than the 'Expiration' of the next record.”

    We can not ask client to delete the records from Production environment as it runs into compliance issues for having developer accessing LIVE environment.

    Does anyone know a solution/fix for this? is it a bug that needs a hotfix from MS?


  • I just got a hotfix from Microsoft.  It's apparently not publicly available yet so you have to open a support case to get it.  Hope this helps!

  • Thanks Jessica!

  • Can you please post the KB article number. That would help me in sending a request to microsoft for hotfix.

  • It is a known Microsoft bug, which seems to be fixed in CU-4. For previous versions, i requested a Hot-fix using the "KB#2730201".

  • You should be able to get around with this by changing first update_recordset statement in \Classes\VersioningPurchaseOrder\archivePurchLine. I added one more where clause so that AX does not try to update lines with max date value.

    update_recordset purchLineHistory  

    setting ValidTo = prevVersionValidTo

    exists join purchLine

    where purchLine.InventTransId == purchLineHistory.InventTransId

                   && purchLine.PurchId == purchTable.PurchId

                   && purchLine.IsDeleted

                   && purchLine.IsModified

                   && purchLineHistory.ValidTo == DateTimeUtil::maxValue();//skip lines with max date values

    View Fan Page on Facebook

  • The hotfix number is wrong. You need fixing using  KB2901696. See Lifecycle services for additional details.