Microsoft Dynamics AX : Pending vendor invoice data import utility

Hi Guys,

Today, I will be demonstrating you how we can import the Pending invoice using excel file using Batch process.i.e Pending vendor invoice import data utility


Things to know:

Pending vendor invoice: Simply we can say that, it is the invoice that is used for invoicing against the purchase order for the vendor.

VendInvoiceInfoTable: It contains the pending invoice header information for one/more purchase Orders


VendInvoiceInfoLine: The VendInvoiceInfoLine table contains vendor invoice lines for a specific purchase order.

VendInvoiceInfoSubTable: Middle table between purch table and vendinvoiceInfo Table. It associates between the vendor invoices and the purchase orders.

VendInvoiceInfoSubLine: The VendInvoiceInfoSubLine table contains associations between the vendor invoice lines and the posted vendor packing slips.

VendPackingSlipTrans : The VendPackingSlipTrans table contains posted product receipt lines.


Sample Pending Invoice CSV/Excel file:



MzkPendingInvoiceBatch class: It is a batch class that does following actions

  • Create a batch dialog
  • Create an input file field
  • Import t data from CSV file
  • Executes batch

Here is the completed code:



dialog getFromDialog

Invoice Header creation





Invoice Line creation:




Note: One thing we noted that, it takes multiple packing slip id from the CSV template , and ids are separated via ‘comma’ and base on that i have written the code to first split the packing slip ids in list and then iterate the list above screen.


Main methods, entry point for the batch class, which ask for the dialog using ‘prompt’ method



Finally the run method, where actual work is done i.e

Import data from CSV and creates the invoice header and invoice lines





Lastly here is the batch job customized dialog that we have created.



Please let me know for any issue.!


5 responses to “Microsoft Dynamics AX : Pending vendor invoice data import utility

  1. Hi Asim,
    Did you ever tried to post Pending vendor invoices right after importing 10k lines?
    There is a bug with pending vendor invoices when you have huge data in it.


  2. Hi Asim, i tried your code it has created the pending invoice successfully, but when i am verifying it from the Invoice matching details, i can see “Quantity matching error exists” error on the form, also i can see the “PO unit price” and “Expected net amount” fields are also seems 0 (it should be some values, isnt it).

    It would be a great help if you can look into and give your inputs.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s