Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support Teams Worldwide

Vendor invoice – A currency to convert from is required to retrieve exchange rate information when trying to access a Vendor Invoice that is linked to a Purchase Order

Characteristics of issue:

We have had some Dynamics AX 2012 customers run into the error:  “A currency to convert from is required to retrieve exchange rate information when trying to access a Vendor Invoice that is linked to a Purchase Order” when attempting to access the vendor invoice within the client.  In the cases we have seen all of these vendor invoices have been attached to a workflow. 

 

How to validate that issue exists on your system:

You can validate whether the issue exists on your system by running the following query:

Select * from SOURCEDOCUMENTLINE a where a.RECID not in (select SOURCEDOCUMENTLINE fromVENDINVOICEINFOTABLE) and (a.SOURCERELATIONTYPE = 1425 and a.TYPEENUMNAME=’SourceDocumentLIne_VendorInvoice’)

If you get any results returned from the query above we then need to verify that these are associated with orphaned SOURCEDOCUMENTLINE records.  You can run the following query to verify that there is an orphan SOURCEDOCUMENTLINE record associated with the Vendor Invoice Header. 

Select SOURCEDOCUMENTHEADER, COUNT(*) From SOURCEDOCUMENTLINE where SOURCEDOCUMENTHEADER in (Select SOURCEDOCUMENTHEADER from SOURCEDOCUMENTLINE a where a.RECID not in (select SOURCEDOCUMENTLINE from VENDINVOICEINFOTABLE) and (a.SOURCERELATIONTYPE = 1425 and a.TYPEENUMNAME=’SourceDocumentLIne_VendorInvoice’)) And SOURCERELATIONTYPE = 1425 GROUP BY SOURCEDOCUMENTHEADER HAVING COUNT(*) > 1

If results exist for the above query we have verified that the issue exists in your environment.

 

Resolution:

Step 1:

To clean up the orphaned records:

1. Run the query below again:

Select SOURCEDOCUMENTHEADER, COUNT(*) From SOURCEDOCUMENTLINE where SOURCEDOCUMENTHEADER in (Select SOURCEDOCUMENTHEADER from SOURCEDOCUMENTLINE a where a.RECID not in (select SOURCEDOCUMENTLINE from VENDINVOICEINFOTABLE) and (a.SOURCERELATIONTYPE = 1425 and a.TYPEENUMNAME=’SourceDocumentLIne_VendorInvoice’)) And SOURCERELATIONTYPE = 1425 GROUP BY SOURCEDOCUMENTHEADER HAVING COUNT(*)

2.  For each SOURCEDOCUMENTHEADER value returned in the result set, delete the orphaned SOURCEDOCUMENTLINE record by inserting the appropriate SOURCEDOCUMENTHEADER value in the delete statement below.

Delete from SOURCEDOCUMENTLINE where RECID not in (select SOURCEDOCUMENTLINE from VENDINVOICEINFOTABLE) and (SOURCERELATIONTYPE = 1425 and TYPEENUMNAME=’SourceDocumentLIne_VendorInvoice’ and SOURCEDOCUMENTHEADER = <ENTER YOUR SOURCEDOCUMENTHEADER VALUE>)

3.  To prevent future occurrences of this issue install KB 3008597.