web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

X++ code to create General Journal (The main account 0 does not exist.) , Error found when validating record.

(0) ShareShare
ReportReport
Posted on by 576

Hello..

I used these article to create general transaction (Header and lines)

https://community.dynamics.com/ax/b/axrajdipdas/archive/2013/04/16/dynamics-ax-2012-x-code-to-create-amp-post-general-Journal

https://community.dynamics.com/365/financeandoperations/b/axsupport/archive/2011/12/21/creating-general-journals-in-ax-2012-in-x

my code

static void Job12(Args _args)
{
    AxLedgerJournalTable header = new AxLedgerJournalTable();

    AxLedgerJournalTrans trans = new AxLedgerJournalTrans();

    container  ledgerDimensions, offsetDimensions;

   
    header.parmJournalName("CSH-001");   
    header.save();  

   
    trans.parmAccountType(LedgerJournalACType::Ledger);   
    trans.parmJournalNum(header.ledgerJournalTable().JournalNum);   
    ledgerDimensions = ["1101010000"];   
    trans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(ledgerDimensions));   
    trans.parmAmountCurDebit(230);   
    offsetDimensions = ["9999999999"];   
    trans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offsetDimensions));   
    trans.save();


}


when run the job I got next error 

0882.main.png

Any help ..

Thank you in advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    It should be

    ledgerDimensions = ["1101010000", "1101010000", 0]

    0 means that you don't have any financial dimensions, try it and same way for offset account

  • Ismail Mohamed Profile Picture
    576 on at

    I tried as u said but also gave me error (The main account 1204010101 does not exist.)

    this photo of manual  insert in ax form

    led2.png

    when i tried to insert  by x++ by the next code 

        journalTrans.parmAccountType(LedgerJournalACType::Ledger);
        acctPattern = ["2107032000","2107032000",0];
        journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));
    
        journalTrans.parmOffsetAccountType(LedgerJournalACType::Bank );
        offSetAcctPattern = ["1204010101","1204010101",0];
        journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetAcctPattern));

    Error is (The main account 1204010101 does not exist.)

    1204010101 is wrote right as first photo 
    also please tell me why you repeated the number  "1101010000" in this container in your replay 

    ["1101010000", "1101010000", 0]

    thank you sir

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans