"There is no Currency Exchange Rate within the filter" error message when you try to create a sales order in a foreign currency if the Default Posting Date is blank in Microsoft Dynamics NAV

Applies to: Dynamics NAV 2009

This article applies to Microsoft Dynamics NAV for all language locales.

Symptoms


In Microsoft Dynamics NAV, when you try to create a sales order in a foreign currency if the Default Posting Date is set to "No Date", the system cannot validate the exchange rate. Therefore, you receive the following error message:
There is no Currency Exchange Rate within the filter.

Additionally, you cannot print the Order Confirmation report (205).
This problem occurs in the following products:
  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)
  • Microsoft Dynamics NAV 2009 R2

Resolution


Hotfix information

A supported hotfix is now available from Microsoft. However, it is only intended to correct the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Dynamics NAV 2009 service pack or the next Microsoft Dynamics NAV version that contains this hotfix.

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Technical Support Professional for Microsoft Dynamics and related products determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.




Installation information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Note Before you install this hotfix, verify that all Microsoft Navision client users are logged off the system. This includes Microsoft Navision Application Services (NAS) client users. You should be the only client user who is logged on when you implement this hotfix.

To implement this hotfix, you must have a developer license.

We recommend that the user account in the Windows Logins window or in the Database Logins window be assigned the "SUPER" role ID. If the user account cannot be assigned the "SUPER" role ID, you must verify that the user account has the following permissions:
  • The Modify permission for the object that you will be changing.
  • The Execute permission for the System Object ID 5210 object and for the System Object ID 9015 object.


Note You do not have to have rights to the data stores unless you have to perform data repair.

Code changes

Note Always test code fixes in a controlled environment before you apply the fixes to your production computers.
To resolve this problem, follow these steps:
  1. Change the code in the SalesHeaderExchDate function in the Sales Price Calc. Mgt. codeunit (7000) as follows:
    Existing code
    ...
    WITH SalesHeader DO BEGIN

    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    ("Posting Date" = 0D)
    THEN
    EXIT(WORKDATE);
    EXIT("Posting Date");
    // End of the deleted lines.

    END;
    ...
    Replacement code
    ...
    WITH SalesHeader DO BEGIN

    // Add the following lines.
    IF "Posting Date" <>0D THEN
    EXIT("Posting Date");
    EXIT(WORKDATE);
    // End of the added lines.

    END;
    ...
  2. Change the code in the PurchHeaderExchDate function in the Purch. Price Calc. Mgt. codeunit (7010) as follows:
    Existing code
    ...
    WITH PurchHeader DO BEGIN
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    ("Posting Date" = 0D)
    THEN
    EXIT(WORKDATE);
    EXIT("Posting Date");
    // End of the deleted lines.
    END;
    ...
    Replacement code
    ...
    WITH PurchHeader DO BEGIN

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    EXIT("Posting Date");
    EXIT(WORKDATE);
    // End of the added lines.

    END;
    ...
  3. Change the code in the OnAssistEdit trigger in the Currency Code field (111) in the Sales Order form (42) as follows:
    Existing code
    ...
    CLEAR(ChangeExchangeRate);

    // Delete the following line.
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date");
    // End of the deleted line.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
    Replacement code
    ...
    CLEAR(ChangeExchangeRate);

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date")
    ELSE
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor",WORKDATE);
    // End of the added lines.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
  4. Change the code in the OnAssistEdit trigger in the Currency Code field (107) in the Sales Invoice form (43) as follows:
    Existing code
    ...
    CLEAR(ChangeExchangeRate);
    // Delete the following line.
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date");
    // End of the deleted line.
    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
    Replacement code
    ...
    CLEAR(ChangeExchangeRate);
    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date")
    ELSE
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor",WORKDATE);
    // End of the added lines.
    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
  5. Change the code in the OnAssistEdit trigger in the Currency Code field (91) in the Sales Credit Memo form (44) as follows:
    Existing code
    ...
    CLEAR(ChangeExchangeRate);

    // Delete the following line.
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date");
    // End of the deleted line.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
    Replacement code
    ...
    CLEAR(ChangeExchangeRate);

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date")
    ELSE
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor",WORKDATE);
    // End of the added lines

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
  6. Change the code in the OnAssistEdit trigger in the Currency Code field (119) in the Purchase Order form (50) as follows:
    Existing code
    ...
    CLEAR(ChangeExchangeRate);

    // Delete the following line.
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date");
    // End of the deleted line.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
    Replacement code
    ...
    CLEAR(ChangeExchangeRate);

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date")
    ELSE
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor",WORKDATE);
    // End of the added lines.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
  7. Change the code in the OnAssistEdit trigger in the Currency Code field (104) in the Purchase Invoice form (51) as follows:
    Existing code
    ...
    CLEAR(ChangeExchangeRate);

    // Delete the following line.
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date");
    // End of the deleted line.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
    Replacement code
    ...
    CLEAR(ChangeExchangeRate);

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date")
    ELSE
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor",WORKDATE);
    // End of the added lines.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
  8. Change the code in the OnAssistEdit trigger in the Currency Code field (91) in the Purchase Credit Memo form (52) as follows:
    Existing code
    ...
    CLEAR(ChangeExchangeRate);

    // Delete the following line.
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date");
    // End of the deleted line.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
    Replacement code
    ...
    CLEAR(ChangeExchangeRate);

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date")
    ELSE
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor",WORKDATE);
    // End of the added lines.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
  9. Change the code in the OnAssistEdit trigger in the Currency Code field (91) in the Sales Return Order form (6630) as follows:
    Existing code
    ...
    CLEAR(ChangeExchangeRate);

    // Delete the following line.
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date");
    // End of the deleted line.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
    Replacement code
    ...
    CLEAR(ChangeExchangeRate);

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date")
    ELSE
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor",WORKDATE);
    // End of the added lines.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
  10. Change the code in the OnAssistEdit trigger in the Currency Code field (91) in the Purchase Return Order form (6640) as follows:
    Existing code
    ...
    CLEAR(ChangeExchangeRate);

    // Delete the following line.
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date");
    // End of the deleted line.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
    Replacement code
    ...
    CLEAR(ChangeExchangeRate);

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor","Posting Date")
    ELSE
    ChangeExchangeRate.SetParameter("Currency Code","Currency Factor",WORKDATE);
    // End of the added lines.

    IF ChangeExchangeRate.RUNMODAL = ACTION::OK THEN BEGIN
    VALIDATE("Currency Factor",ChangeExchangeRate.GetParameter);
    CurrForm.UPDATE;
    END;
    CLEAR(ChangeExchangeRate);
    ...
  11. Change the code in the UpdateCurrencyFactor function in the Sales Header table (36) as follows:
    Existing code
    ...
    IF "Currency Code" <>'' THEN BEGIN

    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::Quote,"Document Type"::"Blanket Order"]) AND
    ("Posting Date" = 0D)
    THEN
    CurrencyDate := WORKDATE
    ELSE
    CurrencyDate := "Posting Date";
    // End of the deleted lines.

    "Currency Factor" := CurrExchRate.ExchangeRate(CurrencyDate,"Currency Code");
    END ELSE
    "Currency Factor" := 0;
    ...
    Replacement code
    ...
    IF "Currency Code" <> '' THEN BEGIN

    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    CurrencyDate := "Posting Date"
    ELSE
    CurrencyDate := WORKDATE;
    // End of the added lines.

    "Currency Factor" := CurrExchRate.ExchangeRate(CurrencyDate,"Currency Code");
    END ELSE
    "Currency Factor" := 0;
    ...
  12. Change the code in the GetDate function in the Sales Line table (37) as follows:
    Existing code
    ...
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    (SalesHeader."Posting Date" = 0D)
    THEN
    EXIT(WORKDATE);
    EXIT(SalesHeader."Posting Date");
    // End of the deleted lines.
    ...
    Replacement code
    ...
    // Add the following lines.
    IF SalesHeader."Posting Date" <> 0D THEN
    EXIT(SalesHeader."Posting Date");
    EXIT(WORKDATE);
    // End of the added lines.
    ...
  13. Change the code in the UpdateCurrencyFactor function in the Purchase Header table (38) as follows:
    Existing code
    ...
    IF "Currency Code" <> '' THEN BEGIN
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::Quote,"Document Type"::"Blanket Order"]) AND
    ("Posting Date" = 0D)
    THEN
    CurrencyDate := WORKDATE
    ELSE
    CurrencyDate := "Posting Date";
    // End of the deleted lines.

    "Currency Factor" := CurrExchRate.ExchangeRate(CurrencyDate,"Currency Code");
    END ELSE
    "Currency Factor" := 0;
    ...
    Replacement code
    ...
    IF "Currency Code"<>'' THEN BEGIN
    // Add the following lines.
    IF "Posting Date" <> 0D THEN
    CurrencyDate := "Posting Date"
    ELSE
    CurrencyDate := WORKDATE;
    // End of the added lines.

    "Currency Factor" := CurrExchRate.ExchangeRate(CurrencyDate,"Currency Code");
    END ELSE
    "Currency Factor" := 0;
    ...
  14. Change the code in the GetDate function in the Purchase Line table (39) as follows:
    Existing code
    ...
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    (PurchHeader."Posting Date" = 0D)
    THEN
    EXIT(WORKDATE);
    EXIT(PurchHeader."Posting Date")
    // End of the deleted lines.
    ...
    Replacement code
    ...
    // Add the following lines.
    IF PurchHeader."Posting Date"<>0D THEN
    EXIT(PurchHeader."Posting Date");
    EXIT(WORKDATE);
    // End of the added lines.
    ...
  15. Change the code in the RoundAmount function in the Sales-Post codeunit (80) as follows:
    Existing code
    ...
    IF SalesHeader."Currency Code" <>'' THEN BEGIN
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    (SalesHeader."Posting Date" = 0D)
    THEN
    // End of the deleted lines.
    UseDate := WORKDATE
    ELSE
    UseDate := SalesHeader."Posting Date";
    ...
    Replacement code
    ...
    IF SalesHeader."Currency Code" <>'' THEN BEGIN
    // Add the following line.
    IF (SalesHeader."Posting Date" = 0D) THEN
    // End of the added line.

    UseDate := WORKDATE
    ELSE
    UseDate := SalesHeader."Posting Date";
    ...
  16. Change the code in the RoundAmount function in the Purch.-Post codeunit (90) as follows:
    Existing code
    ...
    IF PurchHeader."Currency Code" <>'' THEN BEGIN
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    (PurchHeader."Posting Date" = 0D)
    THEN
    // End of the deleted lines.
    Usedate := WORKDATE
    ELSE
    Usedate := PurchHeader."Posting Date";
    ...
    Replacement code
    ...
    IF PurchHeader."Currency Code"<> '' THEN BEGIN
    // Add the following line.
    IF (PurchHeader."Posting Date" = 0D) THEN
    // End of the added line.
    Usedate := WORKDATE
    ELSE
    Usedate := PurchHeader."Posting Date";
    ...
  17. Change the code in the UpdateHeaderInfo function in the Sales Order Statistics form (402) as follows:
    Existing code
    ...
    IF "Prices Including VAT" THEN
    TotalSalesLineLCY[IndexNo].Amount := TotalAmount2[IndexNo]
    ELSE
    TotalSalesLineLCY[IndexNo].Amount := TotalAmount1[IndexNo];
    IF "Currency Code" <> '' THEN

    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    ("Posting Date" = 0D)
    THEN
    // End of the deleted lines.

    UseDate := WORKDATE
    ELSE
    UseDate := "Posting Date";
    ...
    Replacement code
    ...
    IF "Prices Including VAT" THEN
    TotalSalesLineLCY[IndexNo].Amount := TotalAmount2[IndexNo]
    ELSE
    TotalSalesLineLCY[IndexNo].Amount := TotalAmount1[IndexNo];
    IF "Currency Code" <>'' THEN
    // Add the following line.
    IF "Posting Date" = 0D THEN
    // End of the added line.
    UseDate := WORKDATE
    ELSE
    UseDate := "Posting Date";
    ...
  18. Change the code in the UpdateHeaderInfo function in the Purchase Order Statistics form (403) as follows:
    Existing code
    ...
    IF "Prices Including VAT" THEN
    TotalPurchLineLCY[IndexNo].Amount := TotalAmount2[IndexNo]
    ELSE
    TotalPurchLineLCY[IndexNo].Amount := TotalAmount1[IndexNo];
    IF "Currency Code" <> '' THEN BEGIN
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    ("Posting Date" = 0D)
    THEN
    // End of the deleted lines.
    UseDate := WORKDATE
    ELSE
    UseDate := "Posting Date";
    ...
    Replacement code
    ...
    IF "Prices Including VAT" THEN
    TotalPurchLineLCY[IndexNo].Amount := TotalAmount2[IndexNo]
    ELSE
    TotalPurchLineLCY[IndexNo].Amount := TotalAmount1[IndexNo];
    IF "Currency Code" <> '' THEN BEGIN
    // Add the following line.
    IF "Posting Date" = 0D THEN
    // End of the added line.
    UseDate := WORKDATE
    ELSE
    UseDate := "Posting Date";
    ...
  19. Change the code in the CalculateInvoiceDiscount function in the Sales-Calc. Discount codeunit (60) as follows:
    Existing code
    ...
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    (SalesHeader."Posting Date" = 0D)
    THEN
    // End of the deleted lines.
    CurrencyDate := WORKDATE
    ELSE
    CurrencyDate := SalesHeader."Posting Date";
    ...
    Replacement code
    ...
    // Add the following line.
    IF SalesHeader."Posting Date" = 0D THEN
    // End of the added line.
    CurrencyDate := WORKDATE
    ELSE
    CurrencyDate := SalesHeader."Posting Date";
    ...
  20. Change the code in the CalculateInvoiceDiscount function in the Purch.-Calc.Discount codeunit (70) as follows:
    Existing code
    ...
    // Delete the following lines.
    IF ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
    (PurchHeader."Posting Date" = 0D)
    THEN
    // End of the deleted lines.
    CurrencyDate := WORKDATE
    ELSE
    CurrencyDate := PurchHeader."Posting Date";
    ...
    Replacement code
    ...
    // Add the following line.
    IF PurchHeader."Posting Date" = 0D THEN
    // End of the added line.
    CurrencyDate := WORKDATE
    ELSE
    CurrencyDate := PurchHeader."Posting Date";
    ...

Prerequisites

You must have one of the following products installed to apply this hotfix:
  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)
  • Microsoft Dynamics NAV 2009 R2


Removal information

You cannot remove this hotfix.

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References


VSTF DynamicsNAV SE: 237796, 245981, 254036
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.