How to post a Vendor Invoice related with an Purchase Order using x++?

This question has suggested answer(s)

Hello,

I've created a Purch Order, but I want to post and invoice with partial lines of purch order.

I've been following these steps:

- Intanciate PurchFormLetter with PurchFormLetter::construct(DocumentStatus::Invoice)

- CreateParmTable, CreateParmLine, respectively.

- Executed PurchFormLetter.run()

I've read that is possible use PurchFormLetter.update(), what is the difference, in AX 2009, with run it's works, but in AX2012 is different.

I'll appreciate any help.

regards!

 

Sergio Sepúlveda M.
Dev-Solutions S.A.

All Replies
  • Hi,

        Did you achieved this requirement in AX 2012.I am also having same requirement.

  • I didn´t. Did you find information about it?

    Sergio Sepúlveda M.
    Dev-Solutions S.A.

  • Assuming you have access to source code, one good place to look (in AX 2009 or 2012) is CustInvoiceJour.interCompanyUpdate().  You can see there how purchLine.PurchReceivedNow is updated to the quantity to invoice for each PO line, the chooseLinesQuery is defined to include each PO being received, and then purchFormletter specQty is set before calling run.

    There are quite a few other calls made to purchFormletter in this example, some of which are required, others which aren't.

    Please reply if you need more explanation.

    Bill Pfingsten

  • Bill,

         Have  you Suggesting update receivenow field and make invoice?

    Best regards,

    Sergio Sepúlveda M.

    Dev-Solutions

    Sergio Sepúlveda M.
    Dev-Solutions S.A.

  • Sergio,

    Yes.  I guess I'm just looking at a known solution that is working already in the product.

    Bill

  • Hi,

    Also be aware of the changed tables and from used for vendor invoices. AX2012 is now using the tables VendInvoiceInfoTable, VendInvoiceInfoLine and some more related to the PurchParmUpdate tables.

    kind regards,

    André Arnaud de Calavon  |  Microsoft Dynamics AX Solution architect  |  My blog  |  My company

    This post is my own opinion and does not necessarily reflect the opinion or view of my company, Microsoft, both its employees, or other MVPs.

  •  

    the data model has changed, read development 4 training of AX 2012

  • this blog has a simple example.

    shrishailtechnologies.wordpress.com/.../ax-2012-x-code-to-create-and-post-purchase-order-invoice

    i have a much more complex scenario that requires invoice matching to receipts. when i work that out, and you still need more inof i will be happy to share.