Rebuilding the dimension set balance through code
The dimension set balance (DSB) rebuild will recreate all balances for each dimension set that is initialized. It can be performed for a single company or for all companies at once.
The DSB rebuild needs to be run if the detailed GL data is deleted or modified by any customization or other means outside of the core AX application. This includes jobs and using SQL directly.
Only invoke the DSB rebuild exactly once after all deleting and modifying of the detailed GL data is complete. Invoking the DSB rebuild more than once for the same change is unnecessary and can result in temporary degradation in performance.
To perform a DSB rebuild you can call DimensionFocusInitializeBalance::scheduleProcessFullRebuild(). This will schedule a batch job to rebuild balances. Pass in Ledger::current() if the detailed GL data that was deleted or modified was limited to the current company/ledger. Don’t pass a ledger parameter value if the detailed GL data that was deleted or modified was in multiple companies/ledgers. It is a normal AX practice to perform updates to a single company/ledger at a time.
Here is an example of a form close method which would be a logical place to do a DSB rebuild if updates came from the form. It is important to note that just closing the form with no changes should not invoke the full DSB rebuild.
private void close()
{
if (changesMade)
{
DimensionFocusInitializeBalance::scheduleProcessFullRebuild(Ledger::current());
}
}
Comments
- Anonymous
September 03, 2014
It seems that even passing a determined ledger, the batch job will rebuild the balances for all the legal entities inside the partition... Can you please check? - Anonymous
February 05, 2015
This has the ability to recalculate balances for all ledgers but if you pass in a ledger it will only recalculate the balances for the given ledger.