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
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.
Is there any way to fix the problem.
Pls guide me on this. i am also facing the same problem.
regards,
srinivas
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()));
}
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);
Have you got this issue resolved? Please let me know.
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.
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156