Search This Blog

Friday, February 17, 2012

Ax2012 Get Active Dimension Names for Ledger account


Get the active Dimension names for the Ledger order by the Dimension Hierarchy Level.

static void krishh_getActiveFinanicialdimensions(Args _args)
{
    DimensionAttributeSetItem   dimAttrSetItem;
    DimensionAttribute          dimAttr;
    DimensionEnumeration        dimensionSetId;

    DimensionHierarchyLevel     dimHierarchyLevel;
    recId                       chartOfAccountsId;
    LedgerChartOfAccountsStructure  ledgerChartOfAccountsStructure;
    ;
    //Get the record Id (dimension set id) for current ledger to find active dimensions
    dimensionSetId = DimensionCache::getDimensionAttributeSetForLedger();
    chartOfAccountsId = Ledger::find(Ledger::current()).ChartOfAccounts;
    //Find all the active dimensions for current ledger except main account and display them
 
 while select name from dimAttr
            where dimAttr.Type != DimensionAttributeType::MainAccount
        join RecId from dimAttrSetItem
            where dimAttrSetItem.DimensionAttribute == dimAttr.RecId &&
                dimAttrSetItem.DimensionAttributeSet == dimensionSetId
        join RecId from dimHierarchyLevel
                 order by level
                where dimHierarchyLevel.DimensionAttribute == dimAttr.RecId
        exists join ledgerChartOfAccountsStructure
                where ledgerChartOfAccountsStructure.DimensionHierarchy == dimHierarchyLevel.DimensionHierarchy &&
                    ledgerChartOfAccountsStructure.ChartOfAccounts == chartOfAccountsId
    {
        info(dimAttr.Name);
    }

}

7 comments:

  1. Hi,
    Can you tell me how I can link the projectid and itemid to the generaljournalaccountentry table? It appears I can get the itemid form the inventjournaltrans table, but I don't see a way to link the records line for line with their counter parts in the generaljournalaccountentry. I appreciate any help you can provide.

    Thanks,
    Anthony

    ReplyDelete
  2. In LedgerEntryJournal Table you will have one record with your inventJournalTrans JournalNum, that record recid will be there in the GeneralJournalEntry-field(LedgerEntryJournal) and this record recid must be in the
    generaljournalaccountentry- field(GeneralJounralEntry) where your posting type will be project.

    This is how it is related.
    LedgerEntryJournal(recid)->GeneralJournalEntry(LedgerEntryJournal)->generaljournalaccountentry(GeneralJounralEntry)

    ReplyDelete
  3. Hi,

    I have to create a ledger dimension account (with a given default dimension)for a vendor type of account. I tried various methods but i couldnot. Is it possible to create a ledger dimension account for vendor type of account ? How can i do this ?

    can you please help me in this ?

    ReplyDelete
  4. I dont think you can create Dimension for vendor type , you can create on Vendor.

    see the follwing link that posted in blog for create Dimensions.

    http://krishhdax.blogspot.com/2012/05/ax2012-import-fixes-assests-journals.html

    ReplyDelete
  5. Hello,

    Can you please tell me a way to display all the available dimensions based on a given Main Account, like when you enter a General Journal lines, you enter the main account and the available dimension combination (structure+advanced struct) shows up if you hit the top arrow button. I know how to get the ones that are part of Structure but not the ones from Advanced rule structure.
    Thanks!

    Carol

    ReplyDelete
  6. hello sir,

    I am facing with uninstalling ax 2012 r2.error 2337 and sometimes error 1316.could you please provide me a solution

    ReplyDelete

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.