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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to get the Ledger Dimension form Ledger Account

(0) ShareShare
ReportReport
Posted on by 1,737

I want to get the ledger dimension From ledger account.

*This post is locked for comments

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

    Hello Srinivas pamidi,

    Can you explain in more detail what you try to achieve (obtain default dimension from main account in Chart of Accounts, obtain financial dimensions from posted vouchers, etc)?

    Many thanks and best regards,

    Ludwig

  • srinivas pamidi Profile Picture
    1,737 on at

    In one report Every time the while loop is executed i am getting one ledger Account.

    Like this.

    14210101-00000002----

    Based on this i am retrieve the ledger dimension

    like this.

    5637167844

    Can you please explain me about this.

    After googling i get one code but it is not working

    dimensions = ['112050-AFS002', '0001', 2, 'Branch', 'AFS002', 'Service centre', 'Mumbai'];

    JournalTrans.LedgerDimension(AxdDimensionUtil::getLedgerAccountId(dimensions));

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hello Srinivas pamidi,

    I am not a developer and can thus not help you much with that. Yet, probably have a look at Heinz Schweda's blog where he describes similar things www.schweda.net/blog_ax.php;tid=ZmluYW5jaWFsX2RpbWVuc2lvbnM= Hopefully you can take and modify some of the code examples that he uses to fix your issue.

    Best regards,

    Ludwig

  • Mea_ Profile Picture
    60,284 on at

    Hi srinivas pamidi,

    So you have ledger dimensions values in a container and want to get recId to pass it to JournalTrans.LedgerDimension() ?

    Or what are you trying to achieve ?

  • srinivas pamidi Profile Picture
    1,737 on at

    Hi ievgen,

    In BudgetbalancesActualsDP class sumbudgettmpbalance method

    i am get the Ledger account form budgettmpBalance table like

    ledger account = budgettmpbalance.dimensionfocus;

    Now tell me how to get the Particular ledger dimension ?

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    AxdDimensionUtil::getLedgerAccountId(LedgerDimensions)

    Will return you a container like you mentioned before.

    Or you can read this blog articles:

    sumitsaxfactor.wordpress.com/.../getting-individual-dimension-combination-valuesusing-views-ax-2012

    axvuongbao.blogspot.co.nz/.../how-to-get-ledger-dimension-values-for.html

  • srinivas pamidi Profile Picture
    1,737 on at

    OK ievgen,

    I am writing the below code in the Sumbudgettmpbalance method

    like this.

    select generalJournalAccountEntry

                 where generalJournalAccountEntry.LedgerAccount == budgetTmpBalance.DimensionFocus;

                 //Fetch the Value combination record

                 dimensionAttributeValueCombination = DimensionAttributeValueCombination::find(generalJournalAccountEntry.LedgerDimension);

                // Get dimension storage

                dimensionStorage = DimensionStorage::findById(generalJournalAccountEntry.LedgerDimension);

                if (dimensionStorage == null)

                {

                throw error("@SYS83964");

                }

                // Get hierarchy count

               hierarchyCount = dimensionStorage.hierarchyCount();

               //Loop through hierarchies to get individual segments

              for(hierarchyIndex = 1; hierarchyIndex <= hierarchyCount; hierarchyIndex++)

              {

             //Get segment count for hierarchy

             segmentCount = dimensionStorage.segmentCountForHierarchy(hierarchyIndex);

            //Loop through segments and display required values

             for (segmentIndex = 1; segmentIndex <= segmentCount; segmentIndex++)

            {

               // Get segment

               segment = dimensionStorage.getSegmentForHierarchy(hierarchyIndex, segmentIndex);

               // Get the segment information

               if (segment.parmDimensionAttributeValueId() != 0)

               {

                   // Get segment name

                   segmentName = DimensionAttribute::find(DimensionAttributeValue::find(segment.parmDimensionAttributeValueId()).DimensionAttribute).Name;

                   if(segmentName == 'MainAccount')

                   {

                   mainAccount        = segment.parmDisplayValue();

                   mainAccountName  = segment.getName();

                   }

                   if(segmentName == 'BusinessUnit')

                   {

                   businessUnit        = segment.parmDisplayValue();

                   businessUnitName  = segment.getName();

                   }

                   if(segmentName == 'Department')

                   {

                   department        = segment.parmDisplayValue();

                   departmentName  = segment.getName();

                   }

                   if(segmentName == 'Worker')

                   {

                   worker        = segment.parmDisplayValue();

                   workerName  = segment.getName();

                   }

    first i am write the select query

    select generalJournalAccountEntry

                 where generalJournalAccountEntry.LedgerAccount == budgetTmpBalance.DimensionFocus;

    to map the current dimension focus to the general journal account entry ledger account.

    but this relation is not working.

    you have any other idea to solve this?

  • srinivas pamidi Profile Picture
    1,737 on at

    Any one have any solution for this.

    how to map the current dimension focus to general journal account entry ledger account

  • Mea_ Profile Picture
    60,284 on at

    If something is not working - debug. We cannot debug for you.

    Did you check that budgetTmpBalance.DimensionFocus is actually a ledgerAccount without any "-" or other dimensions ?

  • srinivas pamidi Profile Picture
    1,737 on at

    Hi ievgen Miroshnikov

    i am debugging

    budgetTmpBalance.DimensionFocus is showing the debugger is like this.

    ""14210101-00000001--"

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans