Today I got chance to find a relationship between vendor packing list and vendor Invoice. I was expecting that it there was direct relationship between VendPackingtrans and VendInvocietrans. If you expand VendInvoceTrans, there will be a relation but that relation will never use in Dynamics ax 2012. After searching I found VendPackingSlipQuantityMatch table which has relation between VendPackingTrans and VendInvoiceTrans.
VendPackingSlipTrans _PackingTrans; VendPackingSlipQuantityMatch _ VendPackingSlipQuantityMatch; vendInvoicetrans _ vendInvoicetrans; I got the VendInvoiceTrans and VendPackingTrans as follow. select firstOnly * from _PackingTrans join _VendPackingSlipQuantityMatch where _VendPackingSlipQuantityMatch.InvoiceSourceDocumentLIne ==vendInvoiceTrans.SourceDocumentLine && _PackingTrans.SourceDocumentLine == _VendPackingSlipQuantityMatch.PackingSlipSourceDocumentLine;