Add the Below Code in DimensionAttributeValueCombination Table
Use DimensionDynamicAccount EDT to store the dimension value which is in segmented entry format
public static LedgerDimensionAccount getLedgerDimension(MainAccountNum _mainAccountId, container _dimensions, container _values)
{
MainAccount mainAccount;
DimensionHierarchy dimHier;
LedgerChartOfAccountsStructure coaStruct;
Map dimSpec;
Name dimName;
Name dimValue;
DimensionAttribute dimAttr;
DimensionAttributeValue dimAttrValue;
List dimSources;
DimensionDefaultingEngine dimEng;
int i;
mainAccount = MainAccount::findByMainAccountId(_mainAccountId);
if (!mainAccount.RecId)
{
return 0;
}
select firstOnly RecId from dimHier
where dimHier.StructureType ==
DimensionHierarchyType::AccountStructure
&& dimHier.IsDraft == NoYes::No
exists join coaStruct
where coaStruct.ChartOfAccounts ==
LedgerChartOfAccounts::current()
&& coaStruct.DimensionHierarchy == dimHier.RecId;
if (!dimHier.RecId)
{
return 0;
}
dimSpec = DimensionDefaultingEngine::createEmptyDimensionSpecifiers();
for (i = 1; i <= conLen(_dimensions); i++)
{
dimName = conPeek(_dimensions, i);
dimValue = conPeek(_values, i);
dimAttr = DimensionAttribute::findByName(dimName);
if (!dimAttr.RecId)
{
continue;
}
dimAttrValue =
DimensionAttributeValue::findByDimensionAttributeAndValue(
dimAttr, dimValue, false, true);
if (dimAttrValue.IsDeleted)
{
continue;
}
DimensionDefaultingEngine::insertDimensionSpecifer(
dimSpec,
dimAttr.RecId,
dimValue,
dimAttrValue.RecId,
dimAttrValue.HashKey);
}
dimSources = new List(Types::Class);
dimSources.addEnd(dimSpec);
dimEng = DimensionDefaultingEngine::constructForMainAccountId(
mainAccount.RecId,
dimHier.RecId);
dimEng.applyDimensionSources(dimSources);
return dimEng.getLedgerDimension();
}
Use DimensionDynamicAccount EDT to store the dimension value which is in segmented entry format
public static LedgerDimensionAccount getLedgerDimension(MainAccountNum _mainAccountId, container _dimensions, container _values)
{
MainAccount mainAccount;
DimensionHierarchy dimHier;
LedgerChartOfAccountsStructure coaStruct;
Map dimSpec;
Name dimName;
Name dimValue;
DimensionAttribute dimAttr;
DimensionAttributeValue dimAttrValue;
List dimSources;
DimensionDefaultingEngine dimEng;
int i;
mainAccount = MainAccount::findByMainAccountId(_mainAccountId);
if (!mainAccount.RecId)
{
return 0;
}
select firstOnly RecId from dimHier
where dimHier.StructureType ==
DimensionHierarchyType::AccountStructure
&& dimHier.IsDraft == NoYes::No
exists join coaStruct
where coaStruct.ChartOfAccounts ==
LedgerChartOfAccounts::current()
&& coaStruct.DimensionHierarchy == dimHier.RecId;
if (!dimHier.RecId)
{
return 0;
}
dimSpec = DimensionDefaultingEngine::createEmptyDimensionSpecifiers();
for (i = 1; i <= conLen(_dimensions); i++)
{
dimName = conPeek(_dimensions, i);
dimValue = conPeek(_values, i);
dimAttr = DimensionAttribute::findByName(dimName);
if (!dimAttr.RecId)
{
continue;
}
dimAttrValue =
DimensionAttributeValue::findByDimensionAttributeAndValue(
dimAttr, dimValue, false, true);
if (dimAttrValue.IsDeleted)
{
continue;
}
DimensionDefaultingEngine::insertDimensionSpecifer(
dimSpec,
dimAttr.RecId,
dimValue,
dimAttrValue.RecId,
dimAttrValue.HashKey);
}
dimSources = new List(Types::Class);
dimSources.addEnd(dimSpec);
dimEng = DimensionDefaultingEngine::constructForMainAccountId(
mainAccount.RecId,
dimHier.RecId);
dimEng.applyDimensionSources(dimSources);
return dimEng.getLedgerDimension();
}
No comments:
Post a Comment