TransDate startDate,endDate; LedgerTrialBalanceListPageTmp LedgerTrialBalanceListPageTmp; Name primaryFocus="Account"; boolean includeOpening; boolean includeClosing; OperationsTax postingLayer = OperationsTax::Current; DimensionAttributeValueCombination DimensionAttributeValueCombination; Amount balance; ; startDate = mkdate(1,1,2019); endDate = mkdate(31,12,2019); select firstOnly RecId from LedgerTrialBalanceListPageTmp; LedgerTrialBalanceListPageTmp::constructBalances( LedgerTrialBalanceListPageTmp,primaryFocus,startDate,endDate, includeOpening,includeClosing,postingLayer); select sum(EndingBalance) from LedgerTrialBalanceListPageTmp join DimensionAttributeValueCombination where DimensionAttributeValueCombination.RecId == LedgerTrialBalanceListPageTmp.LedgerDimension &&DimensionAttributeValueCombination.DisplayValue == "21120"; balance = LedgerTrialBalanceListPageTmp.EndingBalance;