Tuesday, April 2, 2019

AX 2012 R3 - Retail statement posting error - After upgrade CU13 or later - Physical updating quantity in the inventory unit XXX must be other than zero.

After upgrading AX 2012 R3 to CU13 or later an error such as "Physical updating quantity in the inventory unit XXX must be other than zero" may occur on posting retail statement which has already been calculated. The issue is slightly confusing in that the inventory which is allowed for physically negative is also showing such error.

On investigation, it has been found that a bug which already existed, was fixed in CU13 or later. When you calculate the statement, the items are reserved on On-hand inventory which are already in transactions, and a record already exist in RetailTransactionSalesTrans table. The bug was qty for the item which was reserved were not exactly same as the unposted transactions, so it was mismatch which caused the error.

The best solution would be to clear the already calculated retail statement and then re-calculate statement and then post. This solution is tested and it is working in one of the production environment of my client.

However, when you clear the calculated statement, the system will try to un-reserve the qty already calculated, but it might give another error as " Quantity xxx cannot be returned because items have already been returned or marked as open transactions". To temporarily fix this issue for prior upgrade calculated statements, we can disable the validation by commenting the following lines in InventUpd_registered.updateRegisterLess() class method.

    if (addRegistered)
    {
        throw error(strFmt("@SYS15535",addRegistered));
    }