Hi guys, here is the code to get various values related to Dimensions
1.Default Dimension:
Struct struct = new Struct();
container ledgerDimension;
DimensionDefault DimensionDefault;
DimensionValue department, costCenter;
;
department = '02';
costCenter = '02-03';
ledgerDimension = conNull();
struct.remove('Department');
struct.remove(‘CostCenter’);
struct.add(‘Department', department);
struct.add(‘CostCenter’, costCenter);
costCenter = '02-03';
ledgerDimension = conNull();
struct.remove('Department');
struct.remove(‘CostCenter’);
struct.add(‘Department', department);
struct.add(‘CostCenter’, costCenter);
ledgerDimension += struct.fields();
ledgerDimension += struct.fieldName(1);
ledgerDimension += struct.valueIndex(1);
ledgerDimension += struct.fieldName(2);
ledgerDimension += struct.valueIndex(2);
DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
ledgerDimension += struct.fieldName(1);
ledgerDimension += struct.valueIndex(1);
ledgerDimension += struct.fieldName(2);
ledgerDimension += struct.valueIndex(2);
DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
2.Display value & LedgerDimension for Non-Ledger account:
LedgerDimensionAccount ledgerDim;;
ledgerDim = DimensionStorage::getDynamicAccount('AHLI-01', LedgerJournalACType::Bank); info(strFmt("%1 -%2", ledgerDim, DimensionAttributeValueCombination::find(ledgerDim).DisplayValue));
3.LedgerDimension for Ledger account:
LedgerDimensionAccount ledgerDimension, ledgerDimension4;
Struct struct = new Struct();
container ledgerDimensionCon;
DimensionDefault DimensionDefault;
DimensionValue department, costCenter;
;
department = '01';
costCenter = '01-01';
ledgerDimensionCon = conNull();
struct.remove('Department');
struct.remove(‘CostCenter’);
struct.add('Department', department);
struct.add(‘CostCenter’, costCenter);
struct.remove(‘CostCenter’);
struct.add('Department', department);
struct.add(‘CostCenter’, costCenter);
ledgerDimensionCon += struct.fields();
ledgerDimensionCon += struct.fieldName(1);
ledgerDimensionCon += struct.valueIndex(1);
ledgerDimensionCon += struct.fieldName(2);
ledgerDimensionCon += struct.valueIndex(2);
DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimensionCon);
ledgerDimension = DimensionStorage::getDefaultAccountForMainAccountNum("4100021");
ledgerDimension4 = DimensionDefaultingService::serviceCreateLedgerDimension(ledgerDimension, DimensionDefault);
info(strFmt("%1", ledgerDimension4));
No comments:
Post a Comment