I have the following code to set corrected tax in AX 2009 when registering invoice in invoice register journal (purchase invoice):
[...]
taxLedgerJournal = TaxLedgerJournal::construct(TaxJournalCall::Journal, ledgerJournalTrans, null);
taxLedgerJournal.calcAndPost();
taxRegulation = new TaxRegulation();
taxAmount = taxLedgerJournal.taxAmountCalculated();
taxRegulation.setTax(taxLedgerJournal);
taxRegulation.createSumsFromTmp();
taxRegulation.allocateAmount(42);
taxRegulation.saveTaxRegulation();
[...]
ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable, NoYes::Yes, NoYes::Yes);
ledgerJournalCheckPost.run();
ttsCommit;
Does anyone know how to do it in AX 2012?