Sunday, October 26, 2014

Getting MainAccount for Particular Account Num in class



Getting MainAccount for Particular Account Num: class

public LedgerDimensionAccount getLedgerDimension(AccountNum _accountNum)
{
    MainAccount                 mainAccount;

    RefRecId                    accountStructureId;
    List                        dimensionList = new List(Types::Class);
    DimensionDefaultingEngine   dimensionDefaultingEngine;
    ;

    mainAccount = MainAccount::findByMainAccountId(_accountNum);

    accountStructureId = DimensionHierarchy::getAccountStructure(mainAccount.RecId);

    if(mainAccount)
    {
        dimensionDefaultingEngine = DimensionDefaultingEngine::constructForMainAccountId(mainAccount.RecId, accountStructureId);
        dimensionDefaultingEngine.applyDimensionSources(dimensionList);

    return dimensionDefaultingEngine.getLedgerDimension();
    }
    else
    return 0;
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...