Error message when you post a purchase order in Microsoft Dynamics AX 2009


Error message when you post a purchase order in Microsoft Dynamics AX 2009: "Cannot create a record in Purchase order header - Updating table (PurchParmSubTable)"

SYMPTOMS

When you post a purchase order in Microsoft Dynamics AX 2009, you receive the following error message:
Cannot create a record in Purchase order header - Updating table (PurchParmSubTable).
This problem occurs if one of the following conditions is true:
You enable the "Life sciences electronic signature audit trail setup" setting for all tables.
You create a record for the Common table.
You set the PurchParmTable table in the database log.
This problem occurs when you post a purchase order, a receipts list, a packing slip, and an invoice.

This problem occurs in the following products:
Microsoft Dynamics AX 2009 with Service Pack 1
Microsoft Dynamics AX 2009

SOLUTION


Code changes

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Always test code fixes in a controlled environment before you apply the fixes to your production computers.

To resolve this problem, follow these these steps:
1.Overwrite the code in the insert method in the PurchParmSubTable table as follows:
public void insert()
{
    PurchParmSubTable tempPurchParmSubTable;
    ;

    select tempPurchParmSubTable where
        tempPurchParmSubTable.ParmId == this.ParmId
        && tempPurchParmSubTable.TableRefId == this.TableRefId
        && tempPurchParmSubTable.OrigPurchId == this.OrigPurchId;
    if(tempPurchParmSubTable.RecId == 0)
    {
        super();
    }
}
2.Overwrite the code in the createFromPurchParmTable method in the PurchParmSubTable table as follows:
static PurchParmSubTable createFromPurchParmTable(PurchParmTable _purchParmTable, boolean _insert = true)
{
    PurchParmSubTable   purchParmSubTable;
    systemSequence systemSequence;
    ;

    ttsbegin;

    purchParmSubTable.clear();
    purchParmSubTable.initValue();
    purchParmSubTable.initFromPurchParmTable(_purchParmTable);

    if (_insert)
    {
        systemSequence = new systemSequence();
        purchParmSubTable.RecId = systemSequence.reserveValues(1, tablenum(PurchParmSubTable));
        purchParmSubTable.insert();
    }

    ttscommit;
    return purchParmSubTable;
}
3.Overwrite the code in the insert method in the SalesParmSubTable table as follows:
public void insert()
{
    SalesParmSubTable tempSalesParmSubTable;
    ;

    select tempSalesParmSubTable where
        tempSalesParmSubTable.ParmId == this.ParmId
        && tempSalesParmSubTable.TableRefId == this.TableRefId
        && tempSalesParmSubTable.OrigSalesId == this.OrigSalesId
        && tempSalesParmSubTable.subId == this.subId;
    if(tempSalesParmSubTable.RecId == 0)
    {
        super();
    }
}
Note You must merge any existing customizations in these methods.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete