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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Error: LedgerJournalEngine object not initialized during Number Sequence access

(0) ShareShare
ReportReport
Posted on by 40

In AX2009 I have created a new number sequence and added it into the LedgerJournalTransVendPaym form’s LedgerJournalTrans datasource. My intention was to populate the PaymId field with a distinct number for each batch of ACH payment transactions processed.  An error occurs with message below. It fails because the LedgerJournalEngine has not been initialized. I tested this number sequence successfully in two other test forms that did not use LedgerJournal classes. Is this error due to my lack of familiarity with the LedgerJournalEngine and its use in the LedgerJournalTransVendPaym?

I very much appreciate any help on this. Or just a hint to point me in the right direction.

HERE IS THE ENTIRE ERROR MSG

Error executing code: LedgerJournalEngine object not initialized.
(C)\Classes\LedgerJournalEngine\takeNewVoucher
(C)\Classes\NumberSeqFormHandlerLedgerJournal\formMethodDataSourceCreate - line 5
(C)\Forms\LedgerJournalTransVendPaym\Data Sources\LedgerJournalTrans\Methods\create - line 28
(C)\Classes\FormDataSource\executeQuery
(C)\Classes\FormDataSource\linkActive
(C)\Forms\LedgerJournalTransVendPaym\Data Sources\LedgerJournalTrans\Methods\linkActive - line 10

 

HERE IS THE METHOD FAILING ON LINE 5

void formMethodDataSourceCreate(boolean _forced = false)

{
     ;
     newVoucher = false;
     if (ledgerJournalEngine.takeNewVoucher()) << Line 5
     {
             super();
             if (lastNumber)
             {
                    newVoucher = true;
                    currentNewUnsaved = 0;
             }
      }
     currentNewUnsaved++;

}

           

HERE IS MY CODE PERTINENT TO THE FORM AND DATASOURCE

LedgerJournalTransVendPaym

class FormRun extends ObjectRun

{

NumberSeqFormHandler   numberSeqFormHandler;

}

LedgerJournalTrans write

super();

element.numberSeqFormHandler().formMethodDataSourceWrite();

 

LedgerJournalTrans validateWrite

super();

ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret) && ret;

return ret;

 

LedgerJournalTrans delete

element.numberSeqFormHandler().formMethodDataSourceDelete();

super();

 

LedgerJournalTrans create

element.numberSeqFormHandler().formMethodDataSourceCreatePre();

super(append);

element.numberSeqFormHandler().formMethodDataSourceCreate();

 

LedgerJournalTrans linkActive

element.numberSeqFormHandler().formMethodDataSourceLinkActive();

super();

 

 THIS IS THE SEQ NUM SETUP

/*Setup payment reference for CIBC CAD Payment Id's*/

   numRef.DataTypeId               = typeId2ExtendedTypeId(typeid(CADPaymId));

   numRef.ReferenceHelp           = literalstr("CAD Payment Id");

   numRef.WizardHighest           = 9999999;

   numRef.WizardLowest             = 1;

   numRef.WizardContinuous         = true;

   numRef.WizardManual             = NoYes::No;

   numRef.WizardAllowChangeDown   = NoYes::No;

   numRef.WizardAllowChangeUp     = NoYes::No;

   numRef.SortField               = 5;

   this.create(numRef);

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    305,643 Super User 2026 Season 1 on at

    Hi Rodney,

    I do assume all coding provided above is related to your customization. Why are you using the LedgerJournalEngine class? This class is used for journal implementations where one of the option is retrieving a voucher number. You want to draw a new number from a number sequence for a non journal voucher related field. In that case, just use the NumberSequence classes.

  • blujay712 Profile Picture
    40 on at

    Hi Andre,

    I followed your directions to avoided the use of the LedgerJornalEngine class for my particular case and re-coded my number sequence using the NumberSequence classes.  It worked perfectly.  Thank you very much for your quick response and concise explanation.  Thanks again.

    Rodney

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dserp Profile Picture

dserp 4

#2
dekion Profile Picture

dekion 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans