It’s surprising that LedgerTrialBalanceTmp is temporary in AX2012 R1 and persistent in R2. Be careful if you use both versions and move code between them.
You said you have some customizations there - even if you don’t see anything suspicious, try to remove them. If it fixes the problem, your modifications are the culprit.
The error is thrown by disableLockEscalation() if it’s called for a wrong table. Look at the call stack in debugger and try to find out what code is passing the invalid value.