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

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...