You might encounter the message “function dimensionvalidation::syncstructurechangesprivate has been incorrectly called” when dealing with importing ledger journal lines.
The error relates to a ledger dimension or offset ledger dimension being incorrectly formatted, normally as a result of data importing, or X++ code used to build a journal.
If you are trying to load non ledger accounts into the journal, customers, vendors or bank, you can use the following X++ command:
ledgerJournalTrans.LedgerDimension = DimensionStorage::getDynamicAccount(VendAccount, LedgerJournalACType::Vend);
Changing the LedgerJournalACType for the appropriate account type.
If you want to use the standard summary offset account for the customer or vendor then you can use the following command to load the value:
ledgerJournalTrans.OffsetLedgerDimension = LedgerJournalTrans.getLedgerDimensionForLedgerType(DimensionStorage::getLedgerDefaultAccountFromLedgerDim(VendTable.summaryLedgerDimension()), LedgerJournalTrans.Company);
The above is an extension of the follow which will let you populate the ledger account to use with any ledger account value. This can then be passed into either the ledgerDimension field or OffsetLedgerDmension field.
LedgerJournalTrans .getLedgerDimensionForLedgerType(Ledger Account, LedgerJournalTrans .Company);
Handling ledger accounts can be a challenge in AX2012, so I hope this helps.