To get Ledger Account balance in Axapta 2012 You can try below code. This code can be try out at any new job in AOT.
This code output will be for single ledger but if you want to get all ledger balance then you can use while select loop instead of select.
This code output will be for single ledger but if you want to get all ledger balance then you can use while select loop instead of select.
MainAccount mainAccount;
select mainAccount where mainAccount.MainAccountId == '1454542' &&
mainAccount.LedgerChartOfAccounts == LedgerChartOfAccounts::current();
info(strFmt("%1",mainAccount.getBalance(dateNull(), systemDateGet(), FiscalPeriodType::Opening, OperationsTax::Current)));