Skip to main content What is Dynamics 365? Guided tours Customer stories Try our products Build your own agents CRM ERP Sales Service Sales Customer Insights Customer Service Contact Center Field Service Supply Chain Management Commerce Finance Project Operations Human Resources Business Central Pricing Business application topics Training & certifications Migrate to the cloud Documentation Events Dynamics 365 Blog Product updates Onboarding and implementation Community Find a partner Software Development Companies Partner resources Microsoft Marketplace Product documentation Technical support On-premises product support Contact us Try for free Sign in
  • 1 min read

Creating General Journals in AX 2012 in X++


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;

   
header.parmJournalName("GenJrn");   
header.save();  

   
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();

Get started with Dynamics 365

Drive more efficiency, reduce costs, and create a hyperconnected business that links people, data, and processes across your organization—enabling every team to quickly adapt and innovate.