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)

Create Invoice Journal via AIF

(0) ShareShare
ReportReport
Posted on by 2

Hi All,

I am trying to create an invoice journal using AIF services in AX 2012. I have tried to use LedgerGeneralJournalService and LedgerPurchaseInvioceService but none of them allows me to make an invoice journal. The first one only creates journal type : Daily and the second one only creates Invoice register. Is there any service for creating an Invoice Journal?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    As per my understanding you can utilize LedgerGeneralJournalService to create Invoice Journal

    You need to specify valid Journal name, Account type and Offset Type

    please verify and let us know if you need details

  • dynamics developer Profile Picture
    2 on at

    Hi Nitesh,

    Thanks for your response.

    This exception is thrown by AX when I try to use LedgerGeneralJournalService

    Exception: "Journal name APInv does not support journal type Daily."

    The journal type is "Vendor invoice recording". Also there is no property for inserting Invoice  Number and Doc Date in this service.

  • Community Member Profile Picture
    on at

    Have you got this issue resolved? Please let me know.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi dev,

    The error is thrown because journal type is defaulted to daily and the journal setup has a different setting eg 'Vendor invoice recording' in your case. I faced the same error while creating my journals through code. I added the following line of code to pick the journal type from the journal setup:

    journalTable.parmJournalType(LedgerJournalName::find(JournalName).JournalType);

  • Dick Wenning Profile Picture
    8,705 Moderator on at

    ALLOW CUSTOMER AND VENDOR ACCOUNT TYPES:

    Microsoft has code some hardcoded limitation in the class LedgerJournalTransType method validateAccountType and validateOffsetAccountType. Simply remove the AifFault::checkFailedLogFault line and it will work again.

    GET IN CONTROL WITH VOUCHERS:

    In case the voucher Num sequence is set on manual, you have to add the voucher in the XML message. But there are some quite annoying implementation choices made by the AX 2009 developers’ team. Look in class LedgerJournalTransType method defaultVoucher. The field gets unattached and cleared. Next it calls the method determineDefaultVoucher and this will trigger the numbersequence. In case it was a manual numbersequence your value was lost by processing the defaultVoucher method.

    CREATE NON DAILY JOURNALS

    You need to create new derived classes from the class LedgerJournalTableType overload the methods:

    • defaultJournalType

    • isJournalNameValidJournalType

    • new

    • construct

    Also remove the limitation of the method initQuery in the AxdLedgerGeneralJournal class Also add this new class in the construct of the LedgerJournalTableType class.

    INVOICE REGISTRATION

    Create a new derived class for LedgerJournalTableType

    protected void new(AxLedgerJournalTable _axLedgerJournalTable, LedgerJournalOperation _operation, boolean _isInteractiveContext)

    {

       ;

       Debug::assert(_operation == LedgerJournalOperation::Create);

       axLedgerJournalTable = _axLedgerJournalTable;

       ledgerJournalTable = axLedgerJournalTable.ledgerJournalTable();

       operation = _operation;

       isInteractiveContext = _isInteractiveContext;

    }

    protected boolean isJournalNameValidJournalType()

    {

       boolean journalTypeIsValid;

       ;

       if (ledgerJournalName.RecId != 0)

       {

           journalTypeIsValid = (ledgerJournalName.JournalType == LedgerJournalType::PurchaseLedger);

       }

       else

       {

           journalTypeIsValid =  false;

       }

       return journalTypeIsValid;

    }

    protected void defaultJournalType()

    {

       if (operation == LedgerJournalOperation::Create)

       {

           ledgerJournalTable.JournalType = LedgerJournalType::PurchaseLedger;

           axLedgerJournalTable.setFieldAsTouched(fieldnum(LedgerJournalTable,JournalType));

       }

    }

    public static LedgerJournalTableType_PurchaseLedger construct(AxLedgerJournalTable _axLedgerJournalTable, LedgerJournalOperation _operation, boolean _isInteractiveContext)

    {

       LedgerJournalTableType_PurchaseLedger ledgerJournalTableType_PurchaseLedger;

       ;

       ledgerJournalTableType_PurchaseLedger = new LedgerJournalTableType_PurchaseLedger(_axLedgerJournalTable, _operation, _isInteractiveContext);

       return ledgerJournalTableType_PurchaseLedger;

    }

    Also the default ledger account of the vendor posting profile needs to be added to the prepeare for save method of the AxdLedgerGeneral class

    if(axLedgerJournalTable.parmJournalType() == LedgerJournalType::PurchaseLedger &&                                                                  

                  axLedgerJournalTrans.parmAccountType() == LedgerJournalACType::Vend)                                                                            

    {                                                                                                                                                  

         axLedgerJournalTrans.parmOffsetAccountType(LedgerJournalACType::Ledger);                                                                        

         axLedgerJournalTrans.parmOffsetAccount(

                              VendLedgerAccounts::purchLedgerOffsetAccount(axLedgerJournalTrans.parmAccountNum()));                    

               }

  • vaasu Profile Picture
    415 on at

    Is there any way to fix the problem. 

    Pls guide me on this. i am also facing the same problem. 

    regards,

    srinivas

  • Muhammad Haroon Profile Picture
    2,376 on at

    Hi Dick
    I am enabling creation of Vendor Invoice Journal and have followed the steps you have mentioned in your post but still getting following error message:

    Journal name APINV does not support journal type Daily.

    To resolve this problem, I made following changes to construct method of LedgerJournalTableType

        journalNameId = _axLedgerJournalTable.ledgerJournalTable().JournalName;

        journalType = LedgerJournalName::find(journalNameId).JournalType;

              //switch(_axLedgerJournalTable.ledgerJournalTable().JournalType)

            switch(journalType)

    but now the following error is popping when I am trying to create APINV journal

    Field 'Journal batch number' must be filled in.

    Any clue, how this can be resolved.

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans