Due to popular demand, below is example code that creates a general journal in 2012 using X++ code:
AxLedgerJournalTable header = new AxLedgerJournalTable();
AxLedgerJournalTrans trans = new AxLedgerJournalTrans();
container ledgerDimensions, offsetDimensions;
trans.parmAccountType(LedgerJournalACType::Ledger); trans.parmJournalNum(header.ledgerJournalTable().JournalNum); ledgerDimensions = ["131100-USA","131100", 1, "COUNTRY","USA"]; trans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(ledgerDimensions)); trans.parmAmountCurDebit(230); offsetDimensions = ["0103-USA","0103", 1, "COUNTRY", "USA"]; trans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offsetDimensions)); trans.save();
Writing code is fine for a specific interface, but if the data can change or needs to be cleaned up first via Excel, then Atlas can be used to create journals without writing code.
This video shows importing a 10,000 line journal from Excel.
This is a nice sample how you can create the dimensions. There is a small addition to this. The dimension with the name "country" doesn't always exist. Read this as "Department" or "CostCenter".
Besides that it took me some time to understand the container.
The first value in the container, contains the display value (a combination value of the main account + all the dimensions). Secondly you can add the main account which can be a ledger account, vendor, customer, project etc. The others are followed by dimension name and then value.
What should i do if i need to import multi line transaction and how can i control the voucher number
I'm guessing you might need this KB # 2784306.
I wondering, what the 'DisplayValue' is used for. I have created a tans line passing it as an empty string and it worked just fine. Am I missing something here?
The display value would likely get regenerated if you pass it in as a blank value and pull up the transaction for editing. The display value is primarily used for display purposes on reports that may show the ledger details along with any non-editable type of form fields.