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 :
Microsoft Dynamics AX (Archived)

How can i get Main Account with financial dimension balance in ax 2012 throw x++

(0) ShareShare
ReportReport
Posted on by 1,025

Hello :),

I'm using ax 2012 R3 cumulative 11

I need to get MainAccount with Bussines Unit balance throw x++ 

i can get main account balance by this code below but i need financial dimension also

MainAccount                     mainAccount;
    CostAmountPosted                balance;

    mainaccount = MainAccount::findByMainAccountId('MainAccountId');
    balance = mainaccount.getBalance(01\01\2019,31\12\2019,FiscalPeriodType::Operating, OperationsTax::Current);

can I get some help, please

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi,

    You can use the trial balance form for that purpose.

    There is not development required.

    Have you tried using this form?

    Best regards,

    Ludwig

  • source258147 Profile Picture
    1,025 on at

    Thanks Ludwig,

    I know this form but i need to get main account balance with business unit throw x++ code

    and this form is very complicated for me to do something like it

  • guk1964 Profile Picture
    10,888 on at

    The suggestion is that you look at the code behind the standard report, or just run the report and take the output ie. its pulling  the same data that you need.

    The Trial Balance report allows to select by dimension - and that requires a financial dimension set. Create a Financial dimension set from General Ledger->setup->financial dimension->financial dimension set. Add the main account and the required financial dimension(s) to create the required  financial dimension set.

     

     

  • source258147 Profile Picture
    1,025 on at

    Thanks, magic1949  for your replay

    I try your solution but I get an error when I consume the DP class could you please help me with it

    static void TestJob(Args _args)
    {
        LedgerTrialBalanceTmp       tmp;
        LedgerTrialBalanceDP        dp = new LedgerTrialBalanceDP();
    
        LedgerTrialBalanceContract  contract = new LedgerTrialBalanceContract();
        contract.parmDetailSummary(DetailSummary::Summary);
        contract.parmFromDate(01\01\2018);
        contract.parmToDate(31\12\2018);
        contract.parmPrimaryDimensionFocus("02");
        //contract.parmDimensionRangeMap(5637144583);
    
    
        dp.parmDataContract(contract);
        dp.processReport();
        tmp = dp.getLedgerTrialBalanceTmp();
    
        //tmp.setConnection(dp.parmUserConnection());
        
    
    
        while select tmp
        {
            info(strFmt("%1,%2,%3",tmp.PrimaryFocus,tmp.EndingBalance));
        }
    
    
    }

    I got this error 

    Function LedgerTrialBalanceDP.updateSummaryMainFocusDescriptions has been incorrectly called.

  • Suggested answer
    guk1964 Profile Picture
    10,888 on at

    I missed your last post - it was on my birthday and I was not in country.

    This is fairly complex however, I have note in my files that there is a good post here that explains two approaches:

    mazandik.wordpress.com/.../get-ledger-dimension-value-in-ax-2012

  • source258147 Profile Picture
    1,025 on at

    happy birthday magic1949  :)

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans