Hi experts,
I am working on Vendor payment journal creation using excel upload. On the journal line if Account type is "Vendor", I want to place
"Vendor#" on journal line but on LedgerJournalTrans table, field "Vendor#" stores as "LedgerDimension" value.
My question if "Vendor" doesn't have ledgerDimension on table "dimensionAttributeValueCombination" then how to generate "Vendor"
ledgerDimension on table "dimensionAttributeValueCombination"?
I tried to create Vendor "ledgerDimension" based on following code but the challenge for me in the table "DimensionAttribute", I don't
have name value for Vendor in table "DimensionAttribute".
I tried to take name(Table DimensionAttribute) as "SystemGeneratedAttributeVendor" but its not working.
********** Code *********
public static LedgerDimensionAccount createDimensionValueForVendor(MainAccountNum _mainAccountId, str _vendor)
{
MainAccount mainAccount;
RecId hierarchy;
LedgerStructure ledgerStruct;
DimensionAttributeValueSetStorage storage = new DimensionAttributeValueSetStorage();
mainAccount = MainAccount::findByMainAccountId(_mainAccountId);
hierarchy = DimensionHierarchy::getAccountStructure(mainAccount.RecId);
if (_vendor)
{
storage.addItem(DimensionAttributeValue::findByDimensionAttributeAndValue(
DimensionAttribute::findByName('SystemGeneratedAttributeVendor'), _vendor));
}
LedgerDimensionAccount ledgerDimensionAccount =
LedgerDimensionDefaultingEngine::getLedgerDimensionFromAccountAndDim(
mainAccount.RecId, hierarchy, storage.save());
return ledgerDimensionAccount;
}
Current "DimensionAttribute", name values in the system