static void DefaultFinancialDim(Args _args)
{
DimensionAttributeValue dimAttrBUValue,dimAtrrCCValue,dimAtrrDepValue,dimAttrIGValue,dimAtrrProjValue;
DimensionAttribute dimAttrBU,dimAtrrCC,dimAtrrDep,dimAttrIG,dimAtrrProj;
DimensionAttributeValueSetStorage davss;
RecId defaultDimension;
CustTable custTable;
while select forUpdate custTable
{
if(custTable.AccountNum)
{
davss = DimensionAttributeValueSetStorage::find(CustTable::find(custTable.AccountNum).DefaultDimension);
dimAttrBU = DimensionAttribute::findByName('BusinessUnit');
dimAtrrCC = DimensionAttribute::findByName('CostCenter');
dimAtrrDep = DimensionAttribute::findByName('Department');
dimAttrIG = DimensionAttribute::findByName('ItemGroup');
dimAtrrProj = DimensionAttribute::findByName('Project');
dimAttrBUValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttrBU, "003", false, true);
dimAtrrCCValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrCC, "009", false, true);
dimAtrrDepValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrDep, "024", false, true);
dimAttrIGValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttrIG, "AudioRM", false, true);
dimAtrrProjValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrProj, "000006", false, true);
if(dimAttrBUValue || dimAtrrCCValue ||dimAtrrDepValue || dimAttrIGValue || dimAtrrProjValue)
{
davss.addItem(dimAttrBUValue);
davss.addItem(dimAtrrCCValue);
davss.addItem(dimAtrrDepValue);
davss.addItem(dimAttrIGValue);
davss.addItem(dimAtrrProjValue);
//custTable = custTable::find(custTable.AccountNum, true);
ttsBegin;
custTable.DefaultDimension = davss.save();
custTable.update();
ttsCommit;
info(custTable.AccountNum);
}
}
}
}
{
DimensionAttributeValue dimAttrBUValue,dimAtrrCCValue,dimAtrrDepValue,dimAttrIGValue,dimAtrrProjValue;
DimensionAttribute dimAttrBU,dimAtrrCC,dimAtrrDep,dimAttrIG,dimAtrrProj;
DimensionAttributeValueSetStorage davss;
RecId defaultDimension;
CustTable custTable;
while select forUpdate custTable
{
if(custTable.AccountNum)
{
davss = DimensionAttributeValueSetStorage::find(CustTable::find(custTable.AccountNum).DefaultDimension);
dimAttrBU = DimensionAttribute::findByName('BusinessUnit');
dimAtrrCC = DimensionAttribute::findByName('CostCenter');
dimAtrrDep = DimensionAttribute::findByName('Department');
dimAttrIG = DimensionAttribute::findByName('ItemGroup');
dimAtrrProj = DimensionAttribute::findByName('Project');
dimAttrBUValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttrBU, "003", false, true);
dimAtrrCCValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrCC, "009", false, true);
dimAtrrDepValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrDep, "024", false, true);
dimAttrIGValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttrIG, "AudioRM", false, true);
dimAtrrProjValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrProj, "000006", false, true);
if(dimAttrBUValue || dimAtrrCCValue ||dimAtrrDepValue || dimAttrIGValue || dimAtrrProjValue)
{
davss.addItem(dimAttrBUValue);
davss.addItem(dimAtrrCCValue);
davss.addItem(dimAtrrDepValue);
davss.addItem(dimAttrIGValue);
davss.addItem(dimAtrrProjValue);
//custTable = custTable::find(custTable.AccountNum, true);
ttsBegin;
custTable.DefaultDimension = davss.save();
custTable.update();
ttsCommit;
info(custTable.AccountNum);
}
}
}
}
No comments:
Post a Comment