Please follow series of screenshots of source code with explanation:
Source code explanation: (1.1)
- Initialization of table buffers.
- Get purchase order table.
- Get purchase order lines.
- Get vendor table.
Source code explanation: (1.2)
- Insert data in VendInvoiceInfoTable table.
- This table contains the vendor invoices for one or more purchase orders.
- Assignment of values.
Source code explanation: (1.3)
- Insert data in VendInvoiceInfoSubTable table.
- This table contains the associations between the vendor invoices and the purchase orders.
- Assignment of values.
Source code explanation: (1.4)
- Insert data in VendInvoiceInfoLine table.
- This table contains vendor invoice lines for a specific purchase order.
- Assignment of values.
Source code explanation: (1.5)
- Insert data in VendInvoiceInfoSubLine table.
- This table contains associations between the vendor invoice lines and the posted vendor packing slips.
- Assignment of values.
That is all you need to do for creating pending vendor invoice through X++ code.
Hi,
ReplyDeleteThanks for your Post.
I am getting the below error when i try to post the Pending vendor invoice .
Number: Item: Invoice quantity is greater than the quantity matched to product receipts
Please help on this
Hi,
ReplyDeleteError says the quantity you received and the quantity you invoiced is not same. Invoice Quantity should be same as receipt. Please check your product receipt quantity and pass that quantity to your invoice that will resolve your issue.
Hi I was not able to match the price. it keep on saying failed only could you please help me with this? Price matching is failing
ReplyDeleteHi,
ReplyDeleteThanks for the post. I reused your code to create it myself. But it still can be improved with simple methods.
For example
1.VendInvoiceSubTable::createFromVendInvoiceInfoTable(vendInvoiceInfoTable, true) instead of just inserting all the fields apart.
2. vendInvoiceInfoLine.initFromPurchLine(vendPackingslipTrans.purchLine()); much easier than all these fields apart.
...
But still a big thank you!
This comment has been removed by the author.
ReplyDelete