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)

Invoicing a purchase order that has a procurement category with fixed asset

(0) ShareShare
ReportReport
Posted on by 59

Hello, i'm trying to invoice a purchase order in ax 2012 that already exists. The proc category is fixed assets.  It has a qty of 1 and net amount of 150.  matching policy is none.

It has fixed asset number value model of sl and transaction type acquisition.

What i'm trying to do just invoice a specific line on a PO. In this case there is only 1 line. I'm trying to do this in x++ code.  Below I have code that usually invoices and works in a regular situation that has posting profiles setup etc. But in this case we have a proc category setup with a fixed asset.  I get this error in code and i'm not sure how to get around it... is there any other way or something i can do to not check the posting profile for expense because it has fixed asset acquisition?

Error when invoicing invoice number: PO-xxx on Purchase Order: PO-xxx

Account number for transaction type Purchase expenditure for expense does not exist.

Posting of order PO-xx canceled

  purchFormLetterInvoice = PurchFormLetter_Invoice::newFromSavedInvoice(vendInvoiceInfoTable);
purchFormLetterInvoice.showQueryForm(false);
purchFormLetterInvoice.specQty(PurchUpdate::RegisteredAndServices);
purchFormLetterInvoice.update(vendInvoiceInfoTable, vendInvoiceInfoTable.Num, systemdateget());

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi,

    Please check the inventory posting matrix available under inventory/setup/posting/posting. There is a purchase tab available there and a radio button for the 'purchase expenditure for expense' account. Check whether this type has an account for your category included.

    Best regards,

    Ludwig

  • Sirus49 Profile Picture
    59 on at

    Hello,  the thing is... the don't use a purchase expenditure for expense for this category.  It works on the front end if you have an acquisition of a fixed asset.. it doesn't check this code. but when i call the invoicing from code, it check this part.. i'm wondering how i can ignore that just like the front end does for the users.

  • Suggested answer
    SouravDam Profile Picture
    11,730 on at

    Hi Sirus49,

    While invoicing, system will automatically reverse the posting type 'Purchase expenditure un-invoiced' for service type items and actual entry will be posted with 'Purchase expenditure for expense'. This posting type is mainly used for service type items. And if you don't select any main account for your FA item group here, system will show this error.

    In case of FA item, when you post a PO invoice, actual fixed asset main account will be Debited and this posting type 'Purchase expenditure for expense' will show '0' value which is correct. Ultimately you will have no impact in this posting type for fixed asset. But as I mentioned; this posting type is required to record posted amount with other service type items. That's why system cannot bypass it.

    Is there any specific reason why users do not want to use this posting type? How they want to record other service / expenses type items in PO when the invoice is posted?

    Best regards,
    Sourav Dam

  • Sirus49 Profile Picture
    59 on at

    Ok thanks for the explanation, we are just doing integration and creating PO's behind the scenes and i guess the users just never setup the profile for posting profiles so i'm not 100 percent sure why. I guess what i'm trying to figure out. Why can users and myself post & invoice from the front end UI? But when I tried to do it from x++ code it generates the error.... Does the front end UI bypass or trigger something that allows this to happen some how?

    Btw sorry i accidentally clicked on "report as abusive" to your response lol...it popped up as i was writing and clicked it and wouldn't go away.. FYI sorry

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hello Sirius49,

    What is it that you want to post this transaction by code?

    Best regards,

    Ludwig

  • Sirus49 Profile Picture
    59 on at

    Actually I just tested this theory.  If I add a an account for FA in the posting profile, it does work in code now without getting that error, but it actually debits that expense account and that's not what we want.  We want it to go against the fixed asset account.  So this isn't a solution.

  • Sirus49 Profile Picture
    59 on at

    Because we are doing integration so users don't have to do this manually.  Basically it matches a PO up and invoices it. But now we are getting that error through code and on the front end it works going against the Fixed asset without an expense posting account.

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi Sirus49,

    Can you describe a bit more on the integration?

    I am used to integration scenarios where forms / journals / orders are filled but not immediately posted without a prior check and approval from finance.

    Many thanks,

    Ludwig

  • Sirus49 Profile Picture
    59 on at

    For example a user will create a purchase order with 1 line. Say It has a qty of 1 and net amount of 150.  matching policy is setup as none.

    It has fixed asset number ,value model of sl and transaction type acquisition.

    Its sitting in received status.

    Basically the a job comes along and looks for this PO number in code.  All i'm doing is looking up the Purchase order in code, setting up all the parameters in vendInvoiceInfoTable and vendInvoiceInfoLine and finally calling the invoice function below.  Now this works for any other situation fine.  But again, when the users sets a procurement category , and on the fixed assets tab chooses what i mentioned above.  This will not go against the expense in the posting profile setup and doesn't require it because it goes against the fixed asset as a capital expenditure (which is allowed on the front end) and is what we want.  But when I try to run this code from x++, it looks for that expense if its setup instead of just realizing that I have a fixed asset set on that line and to go against the fa instead.  I'm not sure if you guys really understand my issue but that's whats happening and I just wanted to know how to do this from code because it works from the front end...

    purchFormLetterInvoice = PurchFormLetter_Invoice::newFromSavedInvoice(vendInvoiceInfoTable);

    purchFormLetterInvoice.showQueryForm(false);

    purchFormLetterInvoice.update(vendInvoiceInfoTable, vendInvoiceInfoTable.Num, systemdateget());

  • Sirus49 Profile Picture
    59 on at

    Looks like i figured it out. I wasn't setting the assetID on  vendInvoiceInfoLine_Asset table. One its set there it takes the path of not checking the expense in the posting profile!

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans