I need to pass Ledger Dimension value for General Journal (Table:LedgerJournalTable) form to LedgerJournalTransDaily(Table:LedgerJournalTrns) form along with combination values. EX:
In General Journal form I am creating a new journal with the journal name "Alloc"(ledger dimension is like 1003), and in Financial dimension tab I am selecting Cost centre(024), department(001), purpose(training) after that I am clicking on lines, then a new form LedgerJournalTransDaily. In the from grid one filed called Account Num, in that segment field I need ledger dimension value along with selected combination value. like 1003-024-001-Training
Thanks in advance
The Offset Account Num is the only ledger dimension on the header table, so I'll assume you want to use that, however you can apply this logic with any dimension combination (assuming the ledger account type is Ledger). To combine the ledger dimension with the ledger dimensions fields from LedgerJournalTable, The process is as follows:
First we'll retrieve the Account Num from the offset ledger dimension. You can do this with a simple base AX method:
Next, the financial dimensions on the
LedgerJournalTable
.Background info: these dimensions are stored in the field
DefaultDimension
, which references the tableDimensionAttributeValueSet
. This table in itself may not seem useful, but it is a cross-reference. Join theDimensionAttributeValueSetItem
table where itsDimensionAttributeValueSet
field equalsDimensionAttributeValueSet.RecId
. You will see the dimension attributes and their display values that have been selected:Now we have the
DimensionAttributeValueSetItem
records, we also now have theDimensionAttributeValue
and the top tier dimension information stored inDimensionAttribute
. We need all these tables! Pretty intense right? You can create a hefty while loop to go through each individual dimension, add it to a container, and combine it with the Account Num retrieved earlier. The container has to be built very specifically to work with the base ax dimension utility methods (or at least the ones I am aware of).Below is a simple job that effectively does what I have described. I've hand-picked a journal for convenience.
If all works out, you have successfully created a combination! You can varify by finding the dimension you just created in
DimensionAttributeValueCombination
. This combination can now be the RecId inLedgerJournalTrans.LedgerDimension
It should be noted that the dimension utility will only apply dimensions that are applicable based on your configured account structure. This is configured in General Ledger module > Setup > Chart of accounts > Configure account structures.