Recently I had a look at an error that occurred on a custom journal posting routine. It was somewhat similar the journal allocations by looking at existing transaction to make adjustment. What I didn’t know is the account structure has changed. An error popped up: Account structure X for the combination x-x-x-x-x, is not valid for the ledger X.
When ever using ledger dimensions don’t just stamp the LedgerDimensionRecId. Use this method to resolve the RecId in the current account structure for the current company.
toLedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(fromLedgerdimension);
I had to do a quick unit test to prove this. Below is a job that converts.
In the AOT I found a dimension combination that existed in 2 account structures that are the same.