I need to create a DimensionAttributeValueCombination record for a Vendor thru code. I have been able to create dimensionAttributeValueCombination for MainAccount with Financial Dimensions. And red that for just a Main Account I have to suppress the financial dimension part code. But when execute the code I receive an error "Function DimensionDefaultingEngine::constructForMainAccountId has been incorrectly called"
this is the code i am using
public static refRecId createMainAccount(str _MainAccount)
{
DimensionServiceProvider DimensionServiceProvider = new DimensionServiceProvider();
LedgerAccountContract LedgerAccountContract = new LedgerAccountContract();
DimensionAttributeValueContract ValueContract;
List ListValueContract = new List(Types::Class);
dimensionAttributeValueCombination dimensionAttributeValueCombination;
DimensionStorage dimStorage;
LedgerAccountContract.parmMainAccount(_MainAccount);
LedgerAccountContract.parmValues(ListValueContract);
dimStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(LedgerAccountContract);
dimensionAttributeValueCombination = DimensionAttributeValueCombination::find(dimStorage.save());
return dimensionAttributeValueCombination.RecId;
}
What I finally need to accomplish is to create a ledger line, but i need to assign a value for the LedgerDimension when the vendor does not exist in the DimensionAttributeValueCombination table.
Thanks in advance