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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Data inconsistency in General Journal through x++.

(0) ShareShare
ReportReport
Posted on by 3,006

Hi all,

Trying to create & post general journal through x++ code.

I've successfully created & posted. But I found data inconsistency  in the table

"GeneralJournalEntry". field "JournalCategory" not have any value, which is mandatory in the table.

This is happening only when journal created, posted through x++ code.

Please find the script, & screen shots.

//Header

journalTable = new AxLedgerJournalTable();
journalTable.parmJournalName("ME");
journalTable.save();

select firstOnly ledgerJournalTrans_source //testing purpose selected posted transaction
where ledgerJournalTrans_source.RecId == 5637147721;

// createJournalLine(true);
journalTrans = new AxLedgerJournalTrans();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode(companyCurrency);
journalTrans.parmVoucher("ME-8111");
journalTrans.parmAmountCurDebit(422);
journalTrans.parmAccountType(ledgerJournalACType::Ledger);
journalTrans.parmLedgerDimension(ledgerJournalTrans_source.OffsetLedgerDimension);
journalTrans.save();

journalTrans = new AxLedgerJournalTrans();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode(companyCurrency);
journalTrans.parmVoucher("ME-8111");
journalTrans.parmAmountCurCredit(422);
journalTrans.parmAccountType(ledgerJournalACType::Cust);
journalTrans.parmLedgerDimension(ledgerJournalTrans_source.LedgerDimension);
journalTrans.save();

ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(), NoYes::Yes);
ledgerJournalCheckPost.run(); 

7331.Voucher.png GeneralJournalEntry_5F00_JournalCategory.png

Kindly suggest, changes required in the script?

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Just note that I've changed the category of this thread from AX (current version) to AX 2012. It's clearly not about AX 7.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Seems at header, you are not passing journalTable.parmJournalType(

  • krishna.rao@dax Profile Picture
    3,006 on at

    Hi Sohaib,

    It not seems the issue is with " journalTable.parmJournalType".

    Still having issue even  adding above line.

    Would be great, if someone please able to find the solution for this?

  • krishna.rao@dax Profile Picture
    3,006 on at

    Please someone could point the issue in the script or share any article/script which works well would be great help.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Hi Krishna,

    what is your journal type that you are creating?

  • Suggested answer
    jayh Profile Picture
    410 on at

    Set the Transaction type field on the Journal line:

    journalTrans.parmTransactionType(LedgerTransType::Cust);

  • krishna.rao@dax Profile Picture
    3,006 on at

    Journal type - Daily.

    As I said I've added line & done post, still the issue persists.

    I read some articles, haven't mentioned journal type in the script.

    Please let me know Is it the same issue someone facing.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Hi Krishna,

    Thank you for providing information.

    I will be getting back to in few hours may be at night after having testing.

  • krishna.rao@dax Profile Picture
    3,006 on at

    Appreciate your kind acknowledgement.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans