web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

LedgerBalanceMainAccountAmounts opeining balance for ledger with all dimensions

(0) ShareShare
ReportReport
Posted on by 1,196

Hi,

I used the following code to get opening balance for a ledger account. It works well if we are not posting with dimensions.

If there are posting with dimensions it only includes the total without any dimensions.

How to get the full total including dimensions.

Example 

assume ledger 1123333 has to entries posted

1123333       100
1123333-IT    50

The below function return 100 only, however i need 150 as total regardless of dimensions.
Please advice.
 LedgerBalanceMainAccountAmounts ledgerBalance;  
AmountMst opSum;
;
ledgerBalance = LedgerBalanceMainAccountAmounts::construct();
ledgerBalance.parmIncludeRegularPeriod(true);
ledgerBalance.parmIncludeOpeningPeriod(true);
ledgerBalance.parmIncludeClosingPeriod(false);
ledgerBalance.parmAccountingDateRange(mkDate(01,01,2017), mkDate(31,12,2017));
ledgerBalance.calculateBalance(MainAccount::findByMainAccountId('1123333'));
opSum = ledgerBalance.getAccountingCurrencyBalance();
info(num2str(opSum,10,2,1,1));

Thanks for for posting this code.

Regards
Shijith
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    304,443 Super User 2026 Season 1 on at

    Hi Pranesh,

    Do you have an actual question or did you intend to share your findings only?

  • Pranesh M Juwale Profile Picture
    1,196 on at

    I am asking question.

    I need the balance for full ledger. The current code only gives the total that is posted without dimension. I need total regardless of dimension is there or not.

    Regards

    Shijith

  • Suggested answer
    WillWU Profile Picture
    22,363 on at

    Hi partner,

    You could use LedgerTrialBalanceDP class to get balance for specific dimensions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 627

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 615 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 301

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans