Applies ToMicrosoft Dynamics NAV 2009 R2

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

Symptoms

Assume that you apply hotfix 2672643 in the Eastern European version of Microsoft Dynamics NAV 2009 R2. You post an advance letter for a sales order that contains prepayments. In this situation, when you ship and invoice the sales order, you receive the following error message:

Qty. to Ship cannot be more than 0,9. in Sales Line Document Type='Order',Document No.='Number',Line No.='Number'.

Therefore, you cannot post the sales order. For more information about hotfix 2672643, click the following article number to view the article in the Microsoft Knowledge Base:

2672643 "There are non posted Prepayment Amounts on Order [number]" error message when you post partial shipment for a sales order in the East European version of 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. However, 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 Dynamics NAV client users are logged off the system. This includes Microsoft Dynamics NAV Application Server (NAS) services. 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 Prepmt Amt to Deduct - OnValidate trigger in the "Sales Line" table (37) as follows:Existing code

    ..."Prepmt Amt to Deduct",STRSUBSTNO(Text045,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted"));IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN// Delete the following line. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted");...

    Replacement code

    ..."Prepmt Amt to Deduct",STRSUBSTNO(Text045,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted"));IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN// Add the following lines. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted");GetSalesHeader;IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGINVATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");VATPostingSetup.TESTFIELD("Adv. Invoice Correction Type",VATPostingSetup."Adv. Invoice Correction Type"::Percentage);END;// End of the added lines. ...

  2. Change the code in the CalcPrepaymentToDeduct function in the "Sales Line" table (37) as follows:

    1. Delete the following local variables:

      PrepmtPct: Decimal;AbsoluteAdvCorrection : Boolean;
    2. Change the code as follows:Existing code

      ...IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGINGetSalesHeader;IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGINVATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");// Delete the following lines. AbsoluteAdvCorrection :=VATPostingSetup."Adv. Invoice Correction Type" = VATPostingSetup."Adv. Invoice Correction Type"::Absolute;IF AbsoluteAdvCorrection THEN BEGINPrepmtPct := "Prepayment %";"Prepayment %" := 100;END;END;IF SalesHeader."Prices Including VAT" THEN"Prepmt Amt to Deduct" :=ROUND(ROUND(ROUND(ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *(1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *("Prepayment %" / 100) / (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") *(1 + ("VAT %" / 100)),Currency."Amount Rounding Precision")ELSE"Prepmt Amt to Deduct" :=ROUND(ROUND(ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *(1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *"Prepayment %" / 100 ,Currency."Amount Rounding Precision");IF AbsoluteAdvCorrection THEN BEGIN"Prepayment %" := PrepmtPct;IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN"Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted";END;END ELSE"Prepmt Amt to Deduct" := 0// End of the deleted lines....

      Replacement code

      ...IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGINGetSalesHeader;IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGINVATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");// Add the following lines. CASE VATPostingSetup."Adv. Invoice Correction Type" OFVATPostingSetup."Adv. Invoice Correction Type"::Percentage:"Prepmt Amt to Deduct" :=ROUND("Qty. to Invoice" / (Quantity - "Quantity Invoiced") *("Prepmt. Amt. Inv." - "Prepmt Amt Deducted"),Currency."Amount Rounding Precision");VATPostingSetup."Adv. Invoice Correction Type"::Absolute:BEGIN"Prepmt Amt to Deduct" := PrepmtAmtToDeduct(SalesHeader."Prices Including VAT",100);IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN"Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted";END;VATPostingSetup."Adv. Invoice Correction Type"::"Fully Invoiced":IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN"Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted"ELSE"Prepmt Amt to Deduct" := 0;END;END ELSE"Prepmt Amt to Deduct" := PrepmtAmtToDeduct(SalesHeader."Prices Including VAT","Prepayment %");END ELSE"Prepmt Amt to Deduct" := 0// End of the added lines. ...

  3. Create a new PrepmtAmtToDeduct function in the "Sales Line" table (37) as follows:

    PROCEDURE PrepmtAmtToDeduct@1470002(PricesIncludingVAT@1470000 : Boolean;PrepaymentPct@1470001 : Decimal) : Decimal;VARVATPct@1470002 : Decimal;BEGINIF PricesIncludingVAT THENVATPct := "VAT %"ELSEVATPct := 0;EXIT(ROUND(ROUND(ROUND(ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *(1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *(PrepaymentPct / 100) / (1 + (VATPct / 100)),Currency."Amount Rounding Precision") *(1 + (VATPct / 100)),Currency."Amount Rounding Precision"));END;
  4. Change the code in the Prepmt Amt to Deduct - OnValidate trigger in the "Purchase Line" table (39) as follows:Existing code

    ...FIELDERROR("Prepmt Amt to Deduct",STRSUBSTNO(Text039,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted"));IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN// Delete the following line. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted");...

    Replacement code

    ...FIELDERROR("Prepmt Amt to Deduct",STRSUBSTNO(Text039,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted"));IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN// Add the following lines. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted");GetPurchHeader;IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGINVATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");VATPostingSetup.TESTFIELD("Adv. Invoice Correction Type",VATPostingSetup."Adv. Invoice Correction Type"::Percentage);END;// End of the added lines. ...
  5. Change the code in the CalcPrepaymentToDeduct function in the "Purchase Line" table (39). To do this, follow these steps:

    1. Delete the following local variables:

      PrepmtPct@ : Decimal;AbsoluteAdvCorrection@ : Boolean;
    2. Change the code as follows:Existing code

      ...IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGINGetPurchHeader;IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGINVATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");// Delete the following lines. AbsoluteAdvCorrection :=VATPostingSetup."Adv. Invoice Correction Type" = VATPostingSetup."Adv. Invoice Correction Type"::Absolute;IF AbsoluteAdvCorrection THEN BEGINPrepmtPct := "Prepayment %";"Prepayment %" := 100;END;END;IF PurchHeader."Prices Including VAT" THEN"Prepmt Amt to Deduct" :=ROUND(ROUND(ROUND(ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") *(1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *("Prepayment %" / 100) / (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") *(1 + ("VAT %" / 100)),Currency."Amount Rounding Precision")ELSE"Prepmt Amt to Deduct" :=ROUND(ROUND(ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") *(1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *"Prepayment %" / 100,Currency."Amount Rounding Precision");IF AbsoluteAdvCorrection THEN BEGIN"Prepayment %" := PrepmtPct;IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN"Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted";END;END ELSE"Prepmt Amt to Deduct" := 0// End of the deleted lines....

      Replacement code

      ...IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGINGetPurchHeader;IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGINVATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");// Add the following lines. CASE VATPostingSetup."Adv. Invoice Correction Type" OFVATPostingSetup."Adv. Invoice Correction Type"::Percentage:"Prepmt Amt to Deduct" :=ROUND("Qty. to Invoice" / (Quantity - "Quantity Invoiced") *("Prepmt. Amt. Inv." - "Prepmt Amt Deducted"),Currency."Amount Rounding Precision");VATPostingSetup."Adv. Invoice Correction Type"::Absolute:BEGIN"Prepmt Amt to Deduct" := PrepmtAmtToDeduct(PurchHeader."Prices Including VAT",100);IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN"Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted";END;VATPostingSetup."Adv. Invoice Correction Type"::"Fully Invoiced":IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN"Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted"ELSE"Prepmt Amt to Deduct" := 0;END;END ELSE"Prepmt Amt to Deduct" := PrepmtAmtToDeduct(PurchHeader."Prices Including VAT","Prepayment %");END ELSE"Prepmt Amt to Deduct" := 0// End of the added lines. ...
  6. Create a new PrepmtAmtToDeduct function in the "Purchase Line" table (39) as follows:

    PROCEDURE PrepmtAmtToDeduct@1470002(PricesIncludingVAT@1470000 : Boolean;PrepaymentPct@1470001 : Decimal) : Decimal;VARVATPct@1470002 : Decimal;BEGINIF PricesIncludingVAT THENVATPct := "VAT %"ELSEVATPct := 0;EXIT(ROUND(ROUND(ROUND(ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") *(1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *(PrepaymentPct / 100) / (1 + (VATPct / 100)),Currency."Amount Rounding Precision") *(1 + (VATPct / 100)),Currency."Amount Rounding Precision"));END;
  7. Change the code in the OnRun trigger in the "Sales-Post" codeunit (80) as follows:Existing code

    ...ItemJnlRollRndg := FALSE;LineCount := LineCount + 1;Window.UPDATE(2,LineCount);IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THENSalesLine."VAT Date" := "VAT Date";IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGINSalesLine.TESTFIELD(Amount);SalesLine.TESTFIELD("Job No.",'');SalesLine.TESTFIELD("Job Contract Entry No.",0);END;...

    Replacement code

    ...ItemJnlRollRndg := FALSE;LineCount := LineCount + 1;Window.UPDATE(2,LineCount);IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THENSalesLine."VAT Date" := "VAT Date";// Add the following lines. IF Invoice THENIF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THENTestPrepmtAmount;// End of the added lines. IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGINSalesLine.TESTFIELD(Amount);SalesLine.TESTFIELD("Job No.",'');SalesLine.TESTFIELD("Job Contract Entry No.",0);END;...
  8. Create a new TestPrepmtAmount function in the "Sales-Post" codeunit (80) as follows:

    PROCEDURE TestPrepmtAmount@1470003();VARAllowedQtyToShip@1470000 : Decimal;SalesAdvLetterHeader@1470001 : Record 26585;BEGINWITH SalesLine DO BEGINIF ("Prepmt. Line Amount" = 0) OR (Quantity = 0) THENEXIT;SalesAdvLetterHeader.SETRANGE("Order No.","Document No.");IF NOT SalesAdvLetterHeader.ISEMPTY THEN BEGINAllowedQtyToShip :=ROUND(("Line Amount" - "Prepmt. Line Amount" + "Prepmt. Amt. Inv.") /"Line Amount" * Quantity - "Quantity Invoiced",0.00001);IF "Qty. to Ship" > AllowedQtyToShip THENFIELDERROR("Qty. to Ship",STRSUBSTNO(Text047,AllowedQtyToShip));END;END;END;
  9. Change the code in the OnRun trigger in the "Purch.-Post" codeunit (90) as follows:Existing code

    ...IF GUIALLOWED THENWindow.UPDATE(2,LineCount);IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THENPurchLine."VAT Date" := "VAT Date";IF Invoice THENTestPrepmtAmount;IF PurchLine.Type = PurchLine.Type::"Charge (Item)" THEN BEGINPurchLine.TESTFIELD(Amount);PurchLine.TESTFIELD("Job No.",'');END;...

    Replacement code

    ...IF GUIALLOWED THENWindow.UPDATE(2,LineCount);IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THENPurchLine."VAT Date" := "VAT Date";IF Invoice THEN// Add the following line.IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THENTestPrepmtAmount;IF PurchLine.Type = PurchLine.Type::"Charge (Item)" THEN BEGINPurchLine.TESTFIELD(Amount);PurchLine.TESTFIELD("Job No.",'');END;...
  10. Delete the TestPrepmtAmount function and create it again in the "Sales-Post" codeunit (80) as follows:

    LOCAL PROCEDURE TestPrepmtAmount@55();VARAllowedQtyToReceive@1470000 : Decimal;PurchAdvLetterHeader@147001 : Record 26587;BEGINWITH PurchLine DO BEGINIF ("Prepmt. Line Amount" = 0) OR (Quantity = 0) THENEXIT;PurchAdvLetterHeader.SETRANGE("Order No.","Document No.");IF NOT PurchAdvLetterHeader.ISEMPTY THEN BEGINAllowedQtyToReceive :=ROUND(("Line Amount" - "Prepmt. Line Amount" + "Prepmt. Amt. Inv.") /"Line Amount" * Quantity - "Quantity Invoiced",0.00001);IF "Qty. to Receive" > AllowedQtyToReceive THENFIELDERROR("Qty. to Receive",STRSUBSTNO(Text047,AllowedQtyToReceive));END;END;END;
  11. Change the code in the TestSalesPrepayment function in the "Approvals Management" codeunit (439) as follows:Existing code

    ...SalesLines.SETRANGE("Document Type",SalesHeader."Document Type");SalesLines.SETRANGE("Document No.",SalesHeader."No.");SalesLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);IF SalesLines.FIND('-') THEN BEGINREPEAT...

    Replacement code

    ...// Add the following lines.IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THENEXIT(IsNotInvoicedSalesAdvLetter(SalesHeader."No."));// End of the added lines. SalesLines.SETRANGE("Document Type",SalesHeader."Document Type");SalesLines.SETRANGE("Document No.",SalesHeader."No.");SalesLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);IF SalesLines.FIND('-') THEN BEGINREPEAT...

  12. Change the code in the TestPurchasePrepayment function in the "Approvals Management" codeunit (439) as follows:Existing code

    ...PurchaseLines.SETRANGE("Document Type",PurchaseHeader."Document Type");PurchaseLines.SETRANGE("Document No.",PurchaseHeader."No.");PurchaseLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);IF PurchaseLines.FIND('-') THEN BEGINREPEAT...

    Replacement code

    ...// Add the following lines.IF PurchaseHeader."Prepayment Type" = PurchaseHeader."Prepayment Type"::Advance THENEXIT(IsNotInvoicedPurchAdvLetter(PurchaseHeader."No."));// End of the added lines. PurchaseLines.SETRANGE("Document Type",PurchaseHeader."Document Type");PurchaseLines.SETRANGE("Document No.",PurchaseHeader."No.");PurchaseLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);IF PurchaseLines.FIND('-') THEN BEGINREPEAT...
  13. Create a new IsNotInvoicedSalesAdvLetter local function in the "Approvals Management" codeunit (439) as follows:

    LOCAL PROCEDURE IsNotInvoicedSalesAdvLetter@38(SalesOrderNo@1170000000 : Code[30]) : Boolean;VARSalesAdvLetterHeader@1001 : Record 26585;SalesAdvLetterLine@1002 : Record 26586;BEGINWITH SalesAdvLetterHeader DO BEGINSETRANGE("Order No.",SalesOrderNo);IF FIND('-') THENREPEATSalesAdvLetterLine.SETRANGE("Letter No.","No.");IF SalesAdvLetterLine.FIND('-') THENREPEATIF SalesAdvLetterLine."Amount Including VAT" <> SalesAdvLetterLine."Amount Invoiced" THENEXIT(TRUE);UNTIL SalesAdvLetterLine.NEXT = 0;UNTIL NEXT = 0;END;END;
  14. Create a new IsNotInvoicedPurchAdvLetter local function in the "Approvals Management" codeunit (439) as follows:

    LOCAL PROCEDURE IsNotInvoicedPurchAdvLetter@39(PurchOrderNo@1170000000 : Code[30]) : Boolean;VARPurchAdvLetterHeader@1001 : Record 26587;PurchAdvLetterLine@1002 : Record 26588;BEGINWITH PurchAdvLetterHeader DO BEGINSETRANGE("Order No.",PurchOrderNo);IF FIND('-') THENREPEATPurchAdvLetterLine.SETRANGE("Letter No.","No.");IF PurchAdvLetterLine.FIND('-') THENREPEATIF PurchAdvLetterLine."Amount Including VAT" <> PurchAdvLetterLine."Amount Invoiced" THENEXIT(TRUE);UNTIL PurchAdvLetterLine.NEXT = 0;UNTIL NEXT = 0;END;END;

Prerequisites

You must have the Eastern European version of Microsoft Dynamics NAV 2009 R2 installed to apply this hotfix.

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.

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.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.