We couldn’t sign you in
Select the account you want to use.

This article applies to Microsoft for all countries and all language locales.

Symptoms

Assume that you post an invoice for a purchase order in Microsoft Dynamics NAV 2009. Then you invoice an item charge line that has a quantity value specified for the purchase order. In this situation, when you view the item ledger entry for the purchase order, the quantity value for the item charge line is not registered. This problem occurs in the following products:

  • Microsoft Dynamics NAV 2009 R2

  • Microsoft Dynamics NAV 2009 Service Pack 1


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 OnRun trigger in the Sales-Post codeunit (80) as follows:
    Existing code 1

    ...
    TempPrePmtAmtToDeduct@1003 : Decimal;
    TransactionLogEntryNo@1024 : Integer;
    BEGIN
    IF PostingDateExists AND (ReplacePostingDate OR ("Posting Date" = 0D)) THEN BEGIN
    ...

    Replacement code 1

    ...
    TempPrePmtAmtToDeduct@1003 : Decimal;
    TransactionLogEntryNo@1024 : Integer;

    // Add the following line.
    SalesLineForCharge@1025 : Record 37;

    BEGIN
    IF PostingDateExists AND (ReplacePostingDate OR ("Posting Date" = 0D)) THEN BEGIN
    ...

    Existing code 2

    ...
    ClearItemChargeAssgntFilter;
    TempItemChargeAssgntSales.SETCURRENTKEY("Applies-to Doc. Type");

    // Delete the following line.
    TempItemChargeAssgntSales.SETFILTER("Applies-to Doc. Type",'<>%1',"Document Type");

    TempItemChargeAssgntSales.SETRANGE("Document Line No.",SalesLine."Line No.");
    IF TempItemChargeAssgntSales.FINDSET THEN
    ...

    Replacement code 2

    ...
    ClearItemChargeAssgntFilter;
    TempItemChargeAssgntSales.SETCURRENTKEY("Applies-to Doc. Type");
    TempItemChargeAssgntSales.SETRANGE("Document Line No.",SalesLine."Line No.");
    IF TempItemChargeAssgntSales.FINDSET THEN
    ...

    Existing code 3

    ...
    CASE TempItemChargeAssgntSales."Applies-to Doc. Type" OF
    TempItemChargeAssgntSales."Applies-to Doc. Type"::Shipment:

    // Delete the following lines.
    PostItemChargePerShpt(SalesLine);
    TempItemChargeAssgntSales."Applies-to Doc. Type"::"Return Receipt":
    PostItemChargePerRetRcpt(SalesLine);
    END;
    TempItemChargeAssgntSales.MARK(TRUE);
    // End of the lines.

    UNTIL TempItemChargeAssgntSales.NEXT = 0;
    END;
    END;
    ...

    Replacement code 3

    ...
    CASE TempItemChargeAssgntSales."Applies-to Doc. Type" OF
    TempItemChargeAssgntSales."Applies-to Doc. Type"::Shipment:

    // Add the following line
    BEGIN
    PostItemChargePerShpt(SalesLine);
    TempItemChargeAssgntSales.MARK(TRUE);
    END;
    TempItemChargeAssgntSales."Applies-to Doc. Type"::"Return Receipt":
    BEGIN
    PostItemChargePerRetRcpt(SalesLine);
    TempItemChargeAssgntSales.MARK(TRUE);
    END;
    TempItemChargeAssgntSales."Applies-to Doc. Type"::Order,
    TempItemChargeAssgntSales."Applies-to Doc. Type"::Invoice:
    BEGIN
    IF SalesLineForCharge.GET(
    TempItemChargeAssgntSales."Applies-to Doc. Type",
    TempItemChargeAssgntSales."Applies-to Doc. No.",
    TempItemChargeAssgntSales."Applies-to Doc. Line No.")
    THEN
    IF (SalesLineForCharge."Qty. to Ship (Base)" = 0) AND
    (SalesLineForCharge."Qty. to Invoice (Base)" = 0)
    THEN
    ERROR(Text054);
    END;
    TempItemChargeAssgntSales."Applies-to Doc. Type"::"Return Order",
    TempItemChargeAssgntSales."Applies-to Doc. Type"::"Credit Memo":
    BEGIN
    IF SalesLineForCharge.GET(
    TempItemChargeAssgntSales."Applies-to Doc. Type",
    TempItemChargeAssgntSales."Applies-to Doc. No.",
    TempItemChargeAssgntSales."Applies-to Doc. Line No.")
    THEN
    IF (SalesLineForCharge."Return Qty. to Receive (Base)" = 0) AND
    (SalesLineForCharge."Qty. to Invoice (Base)" = 0)
    THEN
    ERROR(Text054);
    END;
    END;
    // End of the lines.

    UNTIL TempItemChargeAssgntSales.NEXT = 0;
    END;
    END;
    ...

    Existing code 4

    ...
    Text052@1102601000 : TextConst 'ENU=You must assign item charge %1 if you want to invoice it.';
    Text053@1102601001 : TextConst 'ENU=You can not invoice item charge %1 because there is no item ledger entry to assign it to.';
    PROCEDURE SetPostingDate@1(NewReplacePostingDate@1000 : Boolean;NewReplaceDocumentDate@1001 : Boolean;NewPostingDate@1002 : Date);
    BEGIN
    ...

    Replacement code 4

    ...
    Text052@1102601000 : TextConst 'ENU=You must assign item charge %1 if you want to invoice it.';
    Text053@1102601001 : TextConst 'ENU=You can not invoice item charge %1 because there is no item ledger entry to assign it to.';

    // Add the following line.
    Text054@1102601002 : TextConst 'ENU=The order line that the item charge has originally been assigned to has been partially or fully posted. You must reassign the item charge to the posted receipt or shipment instead.';

    PROCEDURE SetPostingDate@1(NewReplacePostingDate@1000 : Boolean;NewReplaceDocumentDate@1001 : Boolean;NewPostingDate@1002 : Date);
    BEGIN
    ...
  2. Change the code in the OnRun trigger in the Purch.-Post codeunit (90) as follows:
    Existing code 1

    ...
    ICInboxPurchHdr@1012 : Record 436;
    SalesHeader@1041 : Record 36;
    UpdateAnalysisView@1002 : Codeunit 410;
    UpdateItemAnalysisView@1008 : Codeunit 7150;
    ...

    Replacement code 1

    ...
    ICInboxPurchHdr@1012 : Record 436;
    SalesHeader@1041 : Record 36;

    // Add the following line.
    PurchLineForCharge@1042 : Record 39;

    UpdateAnalysisView@1002 : Codeunit 410;
    UpdateItemAnalysisView@1008 : Codeunit 7150;
    ...

    Existing code 2

    ...
    ClearItemChargeAssgntFilter;
    TempItemChargeAssgntPurch.SETCURRENTKEY("Applies-to Doc. Type");

    // Delete the following line.
    TempItemChargeAssgntPurch.SETFILTER("Applies-to Doc. Type",'<>%1',"Document Type");

    TempItemChargeAssgntPurch.SETRANGE("Document Line No.",PurchLine."Line No.");
    IF TempItemChargeAssgntPurch.FINDSET THEN
    ...

    Replacement code 2

    ...
    ClearItemChargeAssgntFilter;
    TempItemChargeAssgntPurch.SETCURRENTKEY("Applies-to Doc. Type");
    TempItemChargeAssgntPurch.SETRANGE("Document Line No.",PurchLine."Line No.");
    IF TempItemChargeAssgntPurch.FINDSET THEN
    ...

    Existing code 3

    ...
    CASE TempItemChargeAssgntPurch."Applies-to Doc. Type" OF
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::Receipt:

    // Delete the following lines.
    PostItemChargePerRcpt(PurchLine);
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Transfer Receipt":
    PostItemChargePerTransfer(PurchLine);
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Return Shipment":
    PostItemChargePerRetShpt(PurchLine);
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Sales Shipment":
    PostItemChargePerSalesShpt(PurchLine);
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Return Receipt":
    PostItemChargePerRetRcpt(PurchLine);
    END;
    TempItemChargeAssgntPurch.MARK(TRUE);
    // End of the lines.


    UNTIL TempItemChargeAssgntPurch.NEXT = 0;
    END;
    END;
    ...

    Replacement code 3

    ...
    CASE TempItemChargeAssgntPurch."Applies-to Doc. Type" OF
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::Receipt:

    // Add the following lines.
    BEGIN
    PostItemChargePerRcpt(PurchLine);
    TempItemChargeAssgntPurch.MARK(TRUE);
    END;
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Transfer Receipt":
    BEGIN
    PostItemChargePerTransfer(PurchLine);
    TempItemChargeAssgntPurch.MARK(TRUE);
    END;
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Return Shipment":
    BEGIN
    PostItemChargePerRetShpt(PurchLine);
    TempItemChargeAssgntPurch.MARK(TRUE);
    END;
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Sales Shipment":
    BEGIN
    PostItemChargePerSalesShpt(PurchLine);
    TempItemChargeAssgntPurch.MARK(TRUE);
    END;
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Return Receipt":
    BEGIN
    PostItemChargePerRetRcpt(PurchLine);
    TempItemChargeAssgntPurch.MARK(TRUE);
    END;
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::Order,
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::Invoice:
    BEGIN
    IF PurchLineForCharge.GET(
    TempItemChargeAssgntPurch."Applies-to Doc. Type",
    TempItemChargeAssgntPurch."Applies-to Doc. No.",
    TempItemChargeAssgntPurch."Applies-to Doc. Line No.")
    THEN
    IF (PurchLineForCharge."Qty. to Receive (Base)" = 0) AND
    (PurchLineForCharge."Qty. to Invoice (Base)" = 0)
    THEN
    ERROR(Text061);
    END;
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Return Order",
    TempItemChargeAssgntPurch."Applies-to Doc. Type"::"Credit Memo":
    BEGIN
    IF PurchLineForCharge.GET(
    TempItemChargeAssgntPurch."Applies-to Doc. Type",
    TempItemChargeAssgntPurch."Applies-to Doc. No.",
    TempItemChargeAssgntPurch."Applies-to Doc. Line No.")
    THEN
    IF (PurchLineForCharge."Return Qty. to Ship (Base)" = 0) AND
    (PurchLineForCharge."Qty. to Invoice (Base)" = 0)
    THEN
    ERROR(Text061);
    END;
    END;
    // End of the lines.

    UNTIL TempItemChargeAssgntPurch.NEXT = 0;
    END;
    END;
    ...

    Existing code 4

    ...
    Text059@1102601000 : TextConst 'ENU=You must assign item charge %1 if you want to invoice it.';
    Text060@1102601001 : TextConst 'ENU=You can not invoice item charge %1 because there is no item ledger entry to assign it to.';
    PROCEDURE SetPostingDate@1(NewReplacePostingDate@1000 : Boolean;NewReplaceDocumentDate@1001 : Boolean;NewPostingDate@1002 : Date);
    ...

    Replacement code 4

    ...
    Text059@1102601000 : TextConst 'ENU=You must assign item charge %1 if you want to invoice it.';
    Text060@1102601001 : TextConst 'ENU=You can not invoice item charge %1 because there is no item ledger entry to assign it to.';

    // Add the following line.
    Text061@1102601002 : TextConst 'ENU=The order line that the item charge has originally been assigned to has been partially or fully posted. You must reassign the item charge to the posted receipt or shipment instead.';

    PROCEDURE SetPostingDate@1(NewReplacePostingDate@1000 : Boolean;NewReplaceDocumentDate@1001 : Boolean;NewPostingDate@1002 : Date);
    ...


Prerequisites

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

  • Microsoft Dynamics NAV 2009 R2

  • Microsoft Dynamics NAV 2009 Service Pack 1

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?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×