Default main account with an invalid chart of accounts: locating and fixing
The following posting error will result if a default main account with an invalid chart of accounts is used during posting.
Account structure %1, for the combination %2, is not valid for ledger %3.
The message contains the account structure from the ledger, the combination containing the string value of the default main account with the invalid chart of accounts, and the name of the ledger.
Dynamics AX uses default main accounts when posting to the General Ledger. An example is the customer posting profile used to configure and retrieve the default main accounts corresponding to a customer. Main accounts are organized in a chart of accounts and each ledger specifies a chart of accounts and only allows main accounts from its chart of accounts. Even though a default main account value may look okay, it could reference an invalid chart of accounts.
When this posting error is received, the only way to fix it is to update the default main account with the invalid chart of accounts. The default main account corresponds to the transaction being posted and the source of the default main account is also related to the transaction. For example, the customer of the transaction will help you find the default main account in the customer posting profile. There are Microsoft Dynamics Lifecycle Services diagnostics checks being added for default main accounts with an invalid chart of accounts.
When a default main account is entered, the lookup and validation ensure it is from the correct chart of accounts. The most common way to get a default main account with an invalid chart of accounts is for the ledger’s chart of accounts to be changed after some of the default main accounts have been entered. Another way is for records containing default main accounts to be copied from one company to another at the database level.
Here is a customization to the ledger dimension preview that shows whether the default main account has the wrong chart of accounts. Use this when you have a reference point for the default main account with the invalid chart of accounts and need to locate the exact default main account.
To install it, modify the buildLedgerDimensionPreviewTmp method of the LedgerDimensionPreviewTmp table in the following way.
New variable declaration
New field selected from DimensionAttributeLevelValueAllView (add at the beginning of the select list)
New code right before the call to the insert method of the LedgerDimensionPreviewTmp table
if (Debug::debugMode() && dimensionAttribute.RecId == DimensionAttribute::getMainAccountDimensionAttribute())
mainAccount = MainAccount::find(dimensionAttributeLevelValueAllView.EntityInstance);
if (mainAccount != null && mainAccount.LedgerChartOfAccounts != LedgerChartOfAccounts::current())
ledgerDimensionPreviewTmp.Name = '**Invalid chart of accounts';
ledgerDimensionPreviewTmp.Description = 'Clear and reenter the account';
This customization requires the client to be in debug mode. Go to Tools-->Options and select the Development tab and change “Debug mode” to “When Breakpoint.” Remove the customization or change “Debug mode” back to “No” to restore maximum performance.
The following example is the ledger dimension preview that appears when you hover the mouse over a default main account.
The following is the ledger dimension preview for a default main account that is valid.
The following is the ledger dimension preview for a default main account with an invalid chart of accounts.
As is noted in the customization message, once the default main account with the invalid chart of accounts is located, correct it by clearing the existing value, moving focus from the field, and then moving focus back and entering the new value. The same default main account value may not exist in the correct chart of accounts and that will have to be resolved by someone who understands the organization's chart of accounts.