This article applies to Microsoft Dynamics NAV for the Eastern Europe (EE) language locale.

Symptoms

Consider the following scenario in the Eastern European version of Microsoft Dynamics NAV 2009 Service Pack 1 (SP1) and of Microsoft Dynamics NAV 2009 R2:

  • You have a sales order that uses a prepayment.

  • You create an Advance Letter. Then, you post and invoice the Advance Letter.

  • You reopen the sales order and then try to change the value in the Prepayment % field on the header.

In this scenario, you receive the following error message:

The Prepayment Inv. Line Buffer table is empty.


This problem occurs after you apply the hotfixes in the following KBs: KB2543219, KB2546451, KB2546490, and KB2546498.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2543219 You cannot process overpaid prepayment as expected in the Eastern European version of Microsoft Dynamics NAV 2009 R2 For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2546451 "There is no Cust. Ledger Entry within the filter" error message when you try to post the remaining quantity of a sales order in the Eastern European version of Microsoft Dynamics NAV 2009 For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2546490 "Cust. Ledger Entry Entry No. '[Number]' already exists" error message when you try to post a sales order that uses an Advance Letter prepayment in the Eastern European version of Microsoft Dynamics NAV 2009 For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2546498 The posted prepayment remains open after you post the final purchase invoice in the Eastern European version of Microsoft Dynamics NAV 2009

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 UpdateVATOnLines function in the Sales-Post Prepayments codeunit (442) as follows:
    Existing code

    ...
    ROUND(NewAmountIncludingVAT,Currency."Amount Rounding Precision");
    "Prepmt. VAT Base Amt." := NewVATBaseAmount;

    // Delete the following lines.
    IF SalesHeader."Prices Including VAT" THEN
    "Prepmt. Line Amount" := "Prepmt. Amt. Incl. VAT"
    ELSE
    "Prepmt. Line Amount" :=
    ROUND(
    "Prepmt. Amt. Incl. VAT" / (1 + "VAT %" / 100),
    Currency."Amount Rounding Precision");
    // End of the deleted lines.

    IF (VATAmountLine."Line Amount" - VATAmountLine."Invoice Discount Amount") = 0 THEN
    VATDifference := 0
    ELSE
    ...

    Replacement code

    ...
    ROUND(NewAmountIncludingVAT,Currency."Amount Rounding Precision");
    "Prepmt. VAT Base Amt." := NewVATBaseAmount;

    IF (VATAmountLine."Line Amount" - VATAmountLine."Invoice Discount Amount") = 0 THEN
    VATDifference := 0
    ELSE
    ...
  2. Change the code in the UpdateVATOnLines function in the Purchase-Post Prepayments codeunit (444) as follows:
    Existing code

    ...
    ROUND(NewAmountIncludingVAT,Currency."Amount Rounding Precision");
    "Prepmt. VAT Base Amt." := NewVATBaseAmount;

    // Delete the following lines.
    IF PurchHeader."Prices Including VAT" THEN
    "Prepmt. Line Amount" := "Prepmt. Amt. Incl. VAT"
    ELSE
    "Prepmt. Line Amount" :=
    ROUND(
    "Prepmt. Amt. Incl. VAT" / (1 + "VAT %" / 100),
    Currency."Amount Rounding Precision");
    // End of the deleted lines.

    IF (VATAmountLine."Line Amount" - VATAmountLine."Invoice Discount Amount") = 0 THEN
    VATDifference := 0
    ELSE
    ...

    Replacement code

    ...
    ROUND(NewAmountIncludingVAT,Currency."Amount Rounding Precision");
    "Prepmt. VAT Base Amt." := NewVATBaseAmount;

    IF (VATAmountLine."Line Amount" - VATAmountLine."Invoice Discount Amount") = 0 THEN
    VATDifference := 0
    ELSE
    ...
  3. Change the code in the PostInvoiceCorrection function in the Sales-Post Advances codeunit (26585) as follows:
    Delete the following global variable:

    • Name: SumAmountToApply

    • DataType: Decimal


    Add the following global variable:

    • Name: TempLineRelation

    • DataType:TEMPORARY Record (26592)

    :
    Existing code

    ...
    GLSetup.GET;
    SalesSetup.GET;
    LinkedAdvanceEntry.DELETEALL;

    SalesLine.RESET;
    SalesLine.SETRANGE("Document Type",SalesHeader."Document Type");
    ...

    Replacement code

    ...
    GLSetup.GET;
    SalesSetup.GET;
    LinkedAdvanceEntry.DELETEALL;

    // Add the following line.
    TempLineRelation.DELETEALL;

    SalesLine.RESET;
    SalesLine.SETRANGE("Document Type",SalesHeader."Document Type");
    ...
  4. Change the code in the PostInvLineCorrection function in the Sales-Post Advances codeunit (26585) as follows:
    Existing code

    ...
    LineRelation."Deducted Amount" := LineRelation."Deducted Amount" + AmountToDeduct;
    LineRelation.MODIFY;

    // Delete the following line.
    CalcLinkedPmtAmountToApply(LetterLine,AmountToDeduct,LinkedAdvanceEntry);
    IF LetterLine."VAT Amount" <> 0 THEN // NO VAT handling
    PostVATCorrection(
    LetterLine,SalesInvHeader,AmountToDeduct,DocNoForVATCorr,VATAmount,GenJnlPostLine,TempJnlLineDim);
    ...

    Replacement code

    ...
    LineRelation."Deducted Amount" := LineRelation."Deducted Amount" + AmountToDeduct;
    LineRelation.MODIFY;

    // Add the following lines.
    CalcLinkedPmtAmountToApply(
    LetterLine,
    AmountToDeduct,
    LinkedAdvanceEntry,
    RetrieveSumAmountToApply(LineRelation,AmountToDeduct));
    //End of the added lines.

    IF LetterLine."VAT Amount" <> 0 THEN // NO VAT handling
    PostVATCorrection(
    LetterLine,SalesInvHeader,AmountToDeduct,DocNoForVATCorr,VATAmount,GenJnlPostLine,TempJnlLineDim);
    ...
  5. Change the code in the CalcLinkedPmtAmountToApply function in the Sales-Post Advances codeunit (26585) as follows:
    Add the following parameter:

    • Name: SumAmountToApply

    • DataType: Decimal


    Existing code

    ...
    // Delete the following line .
    SumAmountToApply := SumAmountToApply + TotalAmountToApply;

    IF TotalAmountToApply = 0 THEN
    EXIT;
    SetCurrencyPrecision(LetterLine."Currency Code");
    ...

    Replacement code

    ...
    IF TotalAmountToApply = 0 THEN
    EXIT;
    SetCurrencyPrecision(LetterLine."Currency Code");
    ...
  6. Change the code in the UpdateOrderLine function in the Sales-Post Advances codeunit (26585) as follows:
    Existing code 1

    ...
    LineRelation.SETRANGE(Type,LineRelation.Type::Sale);
    LineRelation.SETRANGE("Order No.",SalesLine."Document No.");
    LineRelation.SETRANGE("Order Line No.",SalesLine."Line No.");
    // Delete the following line
    LineRelation.CALCSUMS("Invoiced Amount","Deducted Amount");

    SalesLine."Prepmt. Amount Inv. Incl. VAT" := LineRelation."Invoiced Amount";
    IF PricesInclVAT THEN BEGIN
    ...

    Replacement code 1

    ...
    LineRelation.SETRANGE(Type,LineRelation.Type::Sale);
    LineRelation.SETRANGE("Order No.",SalesLine."Document No.");
    LineRelation.SETRANGE("Order Line No.",SalesLine."Line No.");
    // Add the following line
    LineRelation.CALCSUMS("Invoiced Amount","Deducted Amount",Amount,"Requested Amount");

    SalesLine."Prepmt. Amount Inv. Incl. VAT" := LineRelation."Invoiced Amount";
    IF PricesInclVAT THEN BEGIN
    ...

    Existing code 2

    ...
    SalesLine."Prepayment VAT %" / (100 + SalesLine."Prepayment VAT %"),
    Currency."Amount Rounding Precision");
    END ELSE BEGIN
    // Delete the following lines.
    SalesLine."Prepmt. Amt. Inv." :=
    ROUND(LineRelation."Invoiced Amount" / (1 + SalesLine."Prepayment VAT %" / 100),
    Currency."Amount Rounding Precision");
    // End of the deleted lines.
    SalesLine."Prepmt. VAT Amount Inv." :=
    SalesLine."Prepmt. Amount Inv. Incl. VAT" - SalesLine."Prepmt. Amt. Inv.";
    END;
    ...

    Replacement code 2

    ...
    SalesLine."Prepayment VAT %" / (100 + SalesLine."Prepayment VAT %"),
    Currency."Amount Rounding Precision");
    END ELSE BEGIN
    // Add the following lines.
    IF LineRelation."Invoiced Amount" = LineRelation.Amount THEN
    SalesLine."Prepmt. Amt. Inv." := LineRelation."Requested Amount"
    ELSE
    SalesLine."Prepmt. Amt. Inv." :=
    ROUND(LineRelation."Invoiced Amount" / (1 + SalesLine."Prepayment VAT %" / 100),
    Currency."Amount Rounding Precision");
    //End of the added lines.
    SalesLine."Prepmt. VAT Amount Inv." :=
    SalesLine."Prepmt. Amount Inv. Incl. VAT" - SalesLine."Prepmt. Amt. Inv.";
    END;
    ...
  7. Change the code in the UpdateLineRelations function in the Sales-Post Advances codeunit (26585) as follows:
    Existing code

    ...
    LineRelation.SETRANGE("Letter No.",LetterLine."Letter No.");
    LineRelation.SETRANGE("Letter Line No.",LetterLine."Line No.");
    LineRelation.CALCSUMS("Invoiced Amount","Deducted Amount");
    ...

    Replacement code

    ...
    // Add the following line
    LineRelation.SETRANGE(Type,LineRelation.Type::Sale);

    LineRelation.SETRANGE("Letter No.",LetterLine."Letter No.");
    LineRelation.SETRANGE("Letter Line No.",LetterLine."Line No.");
    LineRelation.CALCSUMS("Invoiced Amount","Deducted Amount");
    ...
  8. Create the RetrieveSumAmountToApply procedure in the Sales-Post Advances codeunit (26585) as follows:

    LOCAL PROCEDURE RetrieveSumAmountToApply@1470050(LineRelation@1470000 : Record 26592;AmountToDeduct@1470001 : Decimal) : Decimal;
    BEGIN
    WITH TempLineRelation DO BEGIN
    RESET;
    SETRANGE("Order No.",LineRelation."Order No.");
    SETRANGE("Letter No.",LineRelation."Letter No.");
    IF NOT FINDFIRST THEN BEGIN
    INIT;
    "Order No." := LineRelation."Order No.";
    "Letter No." := LineRelation."Letter No.";
    Amount := AmountToDeduct;
    INSERT;
    END ELSE BEGIN
    Amount := Amount + AmountToDeduct;
    MODIFY;
    END;
    EXIT(Amount);
    END;
    END;
  9. Change the code in the PostInvoiceCorrection function in the Purchase-Post Advances codeunit (26586) as follows:
    Delete the following global variable:

    • Name: SumAmountToApply

    • DataType: Decimal


    Add the following global variable:

    • Name: TempLineRelation

    • DataType: TEMPORARY Record (26592)


    Existing code

    ...
    GLSetup.GET;
    PurchSetup.GET;
    LinkedAdvanceEntry.DELETEALL;

    PurchLine.RESET;
    PurchLine.SETRANGE("Document Type",PurchHeader."Document Type");
    ...

    Replacement code

    ...
    GLSetup.GET;
    PurchSetup.GET;
    LinkedAdvanceEntry.DELETEALL;
    // Add the following line
    TempLineRelation.DELETEALL;

    PurchLine.RESET;
    PurchLine.SETRANGE("Document Type",PurchHeader."Document Type");
    ...
  10. Change the code in the PostInvLineCorrection function in the Purchase-Post Advances codeunit (26586) as follows:
    Existing code

    ...
    LineRelation."Deducted Amount" := LineRelation."Deducted Amount" + AmountToDeduct;
    LineRelation.MODIFY;
    // Delete the following line.
    CalcLinkedPmtAmountToApply(LetterLine,AmountToDeduct,LinkedAdvanceEntry);
    IF LetterLine."VAT Amount" <> 0 THEN // NO VAT handling
    PostVATCorrection(
    LetterLine,PurchInvHeader,AmountToDeduct,DocNoForVATCorr,VATAmount,GenJnlPostLine,TempJnlLineDim);
    ...

    Replacement code

    ...
    LineRelation."Deducted Amount" := LineRelation."Deducted Amount" + AmountToDeduct;
    LineRelation.MODIFY;
    // Add the following lines.
    CalcLinkedPmtAmountToApply(
    LetterLine,
    AmountToDeduct,
    LinkedAdvanceEntry,
    RetrieveSumAmountToApply(LineRelation,AmountToDeduct));
    //End of the added lines.
    IF LetterLine."VAT Amount" <> 0 THEN // NO VAT handling
    PostVATCorrection(
    LetterLine,PurchInvHeader,AmountToDeduct,DocNoForVATCorr,VATAmount,GenJnlPostLine,TempJnlLineDim);
    ...
  11. Change the code in the CalcLinkedPmtAmountToApply function in the Purchase-Post Advances codeunit (26586) as follows:
    Add the following parameter to the function:

    • Name: SumAmountToApply

    • DataType: Decimal


    Existing code

    ...
    IF TotalAmountToApply = 0 THEN
    EXIT;
    // Delete the following lines.
    SumAmountToApply := SumAmountToApply + TotalAmountToApply;
    // End of the deleted lines.

    SetCurrencyPrecision(LetterLine."Currency Code");
    Link.SETRANGE("Entry Type",Link."Entry Type"::"Link To Letter");
    ...

    Replacement code

    ...
    IF TotalAmountToApply = 0 THEN
    EXIT;

    SetCurrencyPrecision(LetterLine."Currency Code");
    Link.SETRANGE("Entry Type",Link."Entry Type"::"Link To Letter");
    ...
  12. Change the code in the UpdateOrderLine function in the Purchase-Post Advances codeunit (26586) as follows:
    Existing code 1

    ...
    LineRelation.SETRANGE(Type,LineRelation.Type::Purchase);
    LineRelation.SETRANGE("Order No.",PurchLine."Document No.");
    LineRelation.SETRANGE("Order Line No.",PurchLine."Line No.");
    // Delete the following line.
    LineRelation.CALCSUMS("Invoiced Amount","Deducted Amount");

    PurchLine."Prepmt. Amount Inv. Incl. VAT" := LineRelation."Invoiced Amount";
    IF PricesInclVAT THEN BEGIN
    ...

    Replacement code 1

    ...
    LineRelation.SETRANGE(Type,LineRelation.Type::Purchase);
    LineRelation.SETRANGE("Order No.",PurchLine."Document No.");
    LineRelation.SETRANGE("Order Line No.",PurchLine."Line No.");
    // Add the following line.
    LineRelation.CALCSUMS("Invoiced Amount","Deducted Amount",Amount,"Requested Amount");

    PurchLine."Prepmt. Amount Inv. Incl. VAT" := LineRelation."Invoiced Amount";
    IF PricesInclVAT THEN BEGIN
    ...


    Existing code 2

    ...
    PurchLine."Prepayment VAT %" / (100 + PurchLine."Prepayment VAT %"),
    Currency."Amount Rounding Precision");
    END ELSE BEGIN
    // Delete the following lines.
    PurchLine."Prepmt. Amt. Inv." :=
    ROUND(LineRelation."Invoiced Amount" / (1 + PurchLine."Prepayment VAT %" / 100),
    Currency."Amount Rounding Precision");
    // End of the deleted lines.
    PurchLine."Prepmt. VAT Amount Inv." :=
    PurchLine."Prepmt. Amount Inv. Incl. VAT" - PurchLine."Prepmt. Amt. Inv.";
    END;
    ...

    Replacement code 2

    ...
    PurchLine."Prepayment VAT %" / (100 + PurchLine."Prepayment VAT %"),
    Currency."Amount Rounding Precision");
    END ELSE BEGIN
    // Add the following lines.
    IF LineRelation."Invoiced Amount" = LineRelation.Amount THEN
    PurchLine."Prepmt. Amt. Inv." := LineRelation."Requested Amount"
    ELSE
    PurchLine."Prepmt. Amt. Inv." :=
    ROUND(LineRelation."Invoiced Amount" / (1 + PurchLine."Prepayment VAT %" / 100),
    Currency."Amount Rounding Precision");
    // End of the added lines.
    PurchLine."Prepmt. VAT Amount Inv." :=
    PurchLine."Prepmt. Amount Inv. Incl. VAT" - PurchLine."Prepmt. Amt. Inv.";
    END;
    ...
  13. Change the code in the UpdateLineRelations function in the Purchase-Post Advances codeunit (26586) as follows:
    Existing code

    ...
    LineRelation.SETRANGE("Letter No.",LetterLine."Letter No.");
    LineRelation.SETRANGE("Letter Line No.",LetterLine."Line No.");
    LineRelation.CALCSUMS("Invoiced Amount","Deducted Amount");
    ...

    Replacement code

    ...
    // Add the following line.
    LineRelation.SETRANGE(Type,LineRelation.Type::Purchase);
    // End of the added line.

    LineRelation.SETRANGE("Letter No.",LetterLine."Letter No.");
    LineRelation.SETRANGE("Letter Line No.",LetterLine."Line No.");
    LineRelation.CALCSUMS("Invoiced Amount","Deducted Amount");
    ...
  14. Create the RetrieveSumAmountToApply procedure in the Purchase-Post Advances codeunit (26586) as follows:

     LOCAL PROCEDURE RetrieveSumAmountToApply@1470048(LineRelation@1470000 : Record 26592;AmountToDeduct@1470001 : Decimal) : Decimal;
    BEGIN
    WITH TempLineRelation DO BEGIN
    RESET;
    SETRANGE("Order No.",LineRelation."Order No.");
    SETRANGE("Letter No.",LineRelation."Letter No.");
    IF NOT FINDFIRST THEN BEGIN
    INIT;
    "Order No." := LineRelation."Order No.";
    "Letter No." := LineRelation."Letter No.";
    Amount := AmountToDeduct;
    INSERT;
    END ELSE BEGIN
    Amount := Amount + AmountToDeduct;
    MODIFY;
    END;
    EXIT(Amount);
    END;
    END;


Prerequisites

You must have one of the following products installed to apply this hotfix:

  • The Eastern European version of Microsoft Dynamics NAV 2009 Service Pack 1

  • The Eastern European version of Microsoft Dynamics NAV 2009 R2

Note To apply this hotfix, you must apply the hotfixes in the following KB: KB2543219, KB2546451, KB2546490, and KB2546498.

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: 261669

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.

Benötigen Sie weitere Hilfe?

Ihre Office-Fähigkeiten erweitern
Schulungen erkunden
Neue Funktionen als Erster erhalten
Microsoft Insider beitreten

War diese Information hilfreich?

Was hat Ihre Erfahrung beeinflusst?

Vielen Dank für Ihr Feedback!

×