Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

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

Posted on by 1,021

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

  • source258147 Profile Picture
    source258147 1,021 on at
    RE: How can i get Main Account with financial dimension balance in ax 2012 throw x++

    happy birthday magic1949  :)

  • Suggested answer
    guk1964 Profile Picture
    guk1964 10,877 on at
    RE: How can i get Main Account with financial dimension balance in ax 2012 throw x++

    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
    source258147 1,021 on at
    RE: How can i get Main Account with financial dimension balance in ax 2012 throw x++

    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.

  • guk1964 Profile Picture
    guk1964 10,877 on at
    RE: How can i get Main Account with financial dimension balance in ax 2012 throw x++

    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
    source258147 1,021 on at
    RE: How can i get Main Account with financial dimension balance in ax 2012 throw x++

    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

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: How can i get Main Account with financial dimension balance in ax 2012 throw x++

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans