Understanding the dimensions on
ledgerJournalTrans
LedgerJournalTrans has
4 dimensions fields: LedgerDimension, DefaultDimension, OffSetLedgerDimension
and offSetDefaultDimension.
You can think of LedgerDimension
and OffSetLedgerDimension as holding an account and the dimensions for that account, both in one field. Where as
the DefaultDimension and the OffSetDefaultDimension only holds the dimension.
The Fields
LedgerDimension and OffSetLedgerDimension are shown in the form as “Account”
and “Offset account”. The fields DefaultDimension and OffSetDefaultDimension are
shown in the form under the button “Financial Dimension/Account” and “Financial
Dimension/Offset Account”.
Which of the fields
you have to fill out, depends on the fields Accounttype and OffSetAccountType:
AccountType = Ledger a fill out LedgerDimension with a mainAccount
and dimensions
AccountType = not
Ledger a fill out ledgerDimentin with an account (ex
CustAccount) and fill out DefaultDimension with dimensions.
OffSetAccountType =
Ledger a fill out OffSetLedgerDimension with a
mainAccount and dimensions
OffSetAccountType =
not Ledger a fill out
OffSetledgerDimentin with an account (ex CustAccount) and fill out OffSetDefaultDimension
with dimensions.
Look at the example
below. The Customer DAT-000001 has dimension show in the form “Enter account
financial dimension”. DAT-000001 is info stored in the LedgerDimension and the
dimensioninformation is stored in the DefaultDimension. The offset
ledgeraccount is 1000 and both this information and the dimensions are shown in
the “Offset account” field and stored in the OffSetLedgerDimension.
OffSetDefaultDimension is blank.
Upgrading the dimensions in LedgerJournalTrans
Then upgrading the
code concerning ledgerJournalTrans it is important to remember, that you need
to make sure that both the account and the offset account have there
dimensionsfields filled out and that the dimensions are the same, as this is
how it was in Ax 4.0.
Ex:
Old code
newJournalTrans.Dimension[6] =
TUSParameter::find().FinDep_DimTransactionTypeId;
newJournalTrans.OffsetAccountType = LedgerJournalACType::Ledger;
newJournalTrans.OffsetAccount = tusFinDepEntrySetup.PreliminaryDebtAccount;
New code:
//old code - newJournalTrans.Dimension[6] =
TUSParameter::find().FinDep_DimTransactionTypeId;
//newJournalTrans.DefaultDimension = newJournalTrans.DefaultDimension merged with
TUSParameter::find().FinDep_DimTransactionTypeId as the TransactionType attribute
tusTransactionsType=transactionsType::find(TUSParameter::find().FinDep_DimTransactionTypeId);
newJournalTrans.DefaultDimesion= TUSDimensionServices::addOneTusDimToADefaultDimension
(newJournalTrans.DefaultDimension, DimensionAttribute::getDimAttributeTUSTransactionType(), tusTransactionsType.TransactionType, tusTransactionsType.RecId);
(newJournalTrans.DefaultDimension, DimensionAttribute::getDimAttributeTUSTransactionType(), tusTransactionsType.TransactionType, tusTransactionsType.RecId);
newJournalTrans.OffsetAccountType
= LedgerJournalACType::Ledger;
//old code - newJournalTrans.OffsetAccount = tusFinDepEntrySetup.PreliminaryDebtAccount;
newJournalTrans.OffSetledgerDimension = DimensionDefaultingEngine::getLedgerDimensionFromAccountAndDim(
mainAccountRecId,
DimensionHierarchy::getAccountStructure(mainAccountRecId),
newJournalTrans.DefaultDimension);
How to add dimension on forms
Table - we need to create defaultdimension field with Edt as DimensionDefault and create relation with DimensionAttributeValueSet (Recid) to the DefaultDimension field.
Form - we need to add the table to the datasource part. In the Design side we need to create FinancialDimension Tab with Empty Fields.
Code - we need to write the code in following Methods
Class Declaration
public class FormRun extends ObjectRun
{
DimensionDefaultingController dimensionDefaultingController;
}
This object does the work in handling the dimensions. And it does it without that much work from our site.
init
public void init()
{
boolean financialsDimensionsEnabled = true;
super();
dimensionDefaultingController = DimensionDefaultingController::constructInTabWithValues(false, true, financialsDimensionsEnabled, 0, this, tabFinancialDimensions, "@SYS138491");
dimensionDefaultingController.parmAttributeValueSetDataSource(KbDimensionTab_ds, fieldStr(KbDimensionTab, defaultdimension));
dimensionDefaultingController.parmValidateBlockedForManualEntry(true);
tabFinancialDimensions.enabled(financialsDimensionsEnabled);
}
The first line instantiates the object which takes – among others – the formRun and the empty tab page as parameters.
The second line tells the class what data source and which field on the table it should use when handling the financial dimensions.
The third activates the class. If you have the dimensions on a separate tab page on your form you can call the pageActivated method when that tab page is activated to increase performance.
write
public void write()
{
super();
dimensionDefaultingController.writing();
}
active
public int active()
{
int ret;
ret = super();
dimensionDefaultingController.activated();
return ret;
}
delete
public void delete()
{
super();
dimensionDefaultingController.deleted();
}
pageactivated
public void pageActivated()
{
dimensionDefaultingController.pageActivated();
super();
}
DAVS- it stores recid of dimension
DAVSI - recid of value .
how to add dimensions on tables
1) Create New table and EDT of Dimension Default to your table.
2) Set the relation of DimensionAttributValueSet table (Recid field) to your table of DimensionDefault.
once create the table as shown above. we need to create View for your table
3) Create View for your table named as DimensionAttributeKbDimension
4) Change the Datasource name as BackingEntity
5) drag the Itemname,Tracking no and Recid to the Field and changed name as Name,Value and Key for the 3 fields.
5) Create and run the following job to clear the dimension cache:
static void clearCache(Args _args)
{
DimensionCache::clearAllScopes();
info("done");
}
6)GL--Setup--FinancialDimension.Click new and select your table name from the use values from field.
7) enter the dimension name for your table.e.g KbDimension
8) click the financial dimension button for your KbDimension.
9) see the financial dimension form for your table.here we can see yourtable data of itemname and trackingno field.
10) Goto GL--Setup---Chart of Accounts--configure account structures.
11) select anyone of structure. i have selected Account structure P&L and click the edit button.
select the ADD Segement.
12) once selected the value and click ADD Segement button. automatically coloumn will added to the form as shown below
13) finally, click the activate button.
https://sumitsaxfactor.wordpress.com/2011/12/16/getting-individual-dimension-combination-valuesdimension-storage-class-ax-2012/