Attach a financial Dimension to a vendor

I have a customization in Invoice Journal(AP Invoice )which requires a ledger’s financial dimension be attached to the vendor.

Ex:

Ledger :

123456-00001-002-Purpose

123456-00002-001-Expense

Vendor: 211000

Now I want to make this look like the below examples in the voucher transactions.:

211000-000001-002

211000-000020001

The assigning of values to the vendor account should happen on the actual posting of the Journal…

Now, how can this be done?I tried using DimensionDefaultingService::ServiceCreateLedgerDiemnsion and tried also merging Vendor and the ledger but failed.

The purpose of this is to split vendor balance according to financial dimension.

Thanks in advance.

Hi Guys,

Sharing you the solution to this.

My Colleague gave me this.

static void CombineLedgerDimensions(Args _args)

{

LedgerDimensionDefaultAccount defaultAccount;

DimensionDefault dimensionDefault;

LedgerDimensionAccount ledgerDimension;

DimensionDynamicAccount mainDimensionAccount,

finDimensionAccount;

container dimContainer;

int xy;

//Ledger Dimension of Vendor Balance: This is where Main Account should come from

mainDimensionAccount = 5637148157;

//Ledger Dimension of Ledger Type: This is where Financial Dimension should come from

finDimensionAccount = 5637147078;

dimContainer = AxdDimensionUtil::getDefaultAccountValue(mainDimensionAccount);

defaultAccount = AxdDimensionUtil::getDefaultAccountId(dimContainer);

dimensionDefault = DimensionStorage::getDefaultDimensionFromLedgerDimension(finDimensionAccount);

//Combined Ledger Dimensions

ledgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(defaultAccount, dimensionDefault);

// -------

//TODO: Please Remove

info(strFmt("%1", ledgerDimension));

dimContainer = AxdDimensionUtil::getLedgerAccountValue(ledgerDimension);

for(xy=1; xy<= conLen(dimContainer); xy++)

{

info(conPeek(dimContainer, xy));

}

// -------

}