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

Symptoms

Assume that you run the Get Posted Document Lines to Reverse function in the Sales Return Order page in Microsoft Dynamics NAV 2009. When you set a filter for an item, you receive the following error message:

Sales Invoice Line: There is no Sales Invoice Line within the filter. Filters Document No.:X, No:@Y


Note The X placeholder replaces the document number from the line where cursor is, and the Y placeholder replaces the item number that you entered in the filter.

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. 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 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 IsFirstDocLine function in the Get Post.Doc - S.ShptLn Sbfrm page (5851) as follows:
    Existing code

    ...
    RevUnitCostLCY2 := RevUnitCostLCY;
    SalesShptLine2.COPYFILTERS(Rec);
    SalesShptLine2.SETRANGE("Document No.","Document No.");
    SalesShptLine2.FINDSET;
    REPEAT
    ShowRec := IsShowRec(SalesShptLine2);
    IF ShowRec THEN BEGIN
    ...

    Replacement code

    ...
    RevUnitCostLCY2 := RevUnitCostLCY;
    SalesShptLine2.COPYFILTERS(Rec);
    SalesShptLine2.SETRANGE("Document No.","Document No.");
    IF NOT SalesShptLine2.FINDSET THEN
    EXIT(FALSE);
    REPEAT
    ShowRec := IsShowRec(SalesShptLine2);
    IF ShowRec THEN BEGIN
  2. Change the code in the IsFirstDocLine function in the Get Post.Doc - S.InvLn Subform page (5852) as follows:
    Existing code

    ...
    RevUnitCostLCY2 := RevUnitCostLCY;
    SalesInvLine2.COPYFILTERS(Rec);
    SalesInvLine2.SETRANGE("Document No.","Document No.");
    SalesInvLine2.FINDSET;
    REPEAT
    ShowRec := IsShowRec(SalesInvLine2);
    IF ShowRec THEN BEGIN
    ...

    Replacement code

    ...
    RevUnitCostLCY2 := RevUnitCostLCY;
    SalesInvLine2.COPYFILTERS(Rec);
    SalesInvLine2.SETRANGE("Document No.","Document No.");
    IF NOT SalesInvLine2.FINDSET THEN
    EXIT(FALSE);
    REPEAT
    ShowRec := IsShowRec(SalesInvLine2);
    IF ShowRec THEN BEGIN
  3. Change the code in the IsFirstDocLine function in the Get Post.Doc - P.RcptLn Sbfrm page (5856) as follows:
    Existing code

    ...
    RevUnitCostLCY2 := RevUnitCostLCY;
    PurchRcptLine2.COPYFILTERS(Rec);
    PurchRcptLine2.SETRANGE("Document No.","Document No.");
    PurchRcptLine2.FINDSET;
    REPEAT
    ShowRec := IsShowRec(PurchRcptLine2);
    IF ShowRec THEN BEGIN
    ...

    Replacement code

    ...
    RevUnitCostLCY2 := RevUnitCostLCY;
    PurchRcptLine2.COPYFILTERS(Rec);
    PurchRcptLine2.SETRANGE("Document No.","Document No.");
    IF NOT PurchRcptLine2.FINDSET THEN
    EXIT(FALSE);
    REPEAT
    ShowRec := IsShowRec(PurchRcptLine2);
    IF ShowRec THEN BEGIN
  4. Change the code in the IsFirstDocLine function in the Get Post.Doc - P.InvLn Subform page (5857) as follows:
    Existing code

    ...
    RevUnitCostLCY2 := RevUnitCostLCY;
    PurchInvLine2.COPYFILTERS(Rec);
    PurchInvLine2.SETRANGE("Document No.","Document No.");
    PurchInvLine2.FINDSET;
    REPEAT
    ShowRec := IsShowRec(PurchInvLine2);
    IF ShowRec THEN BEGIN
    ...

    Replacement code

    ...
    RevUnitCostLCY2 := RevUnitCostLCY;
    PurchInvLine2.COPYFILTERS(Rec);
    PurchInvLine2.SETRANGE("Document No.","Document No.");
    IF NOT PurchInvLine2.FINDSET THEN
    EXIT(FALSE);
    REPEAT
    ShowRec := IsShowRec(PurchInvLine2);
    IF ShowRec THEN BEGIN
  5. Change the code in the IsFirstDocLine function in the Purch. Receipt Lines form (5806) as follows:
    Existing code

    ...
    FILTERGROUP(2);
    PurchRcptLine.COPYFILTERS(Rec);
    FILTERGROUP(0);
    PurchRcptLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    PurchRcptLine.FIND('-');

    TempPurchRcptLine := PurchRcptLine;
    TempPurchRcptLine.INSERT;
    END;
    IF "Line No." = TempPurchRcptLine."Line No." THEN
    ...

    Replacement code

    ...
    FILTERGROUP(2);
    PurchRcptLine.COPYFILTERS(Rec);
    FILTERGROUP(0);
    PurchRcptLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT PurchRcptLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.

    TempPurchRcptLine := PurchRcptLine;
    TempPurchRcptLine.INSERT;
    END;
    IF "Line No." = TempPurchRcptLine."Line No." THEN
  6. Change the code in the IsFirstDocLine function in the Get Pst.Doc-RtrnRcptLn Subform form (5853) as follows:
    Existing code

    ...
    TempReturnRcptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempReturnRcptLine.FINDFIRST THEN BEGIN
    ReturnRcptLine.COPYFILTERS(Rec);
    ReturnRcptLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ReturnRcptLine.FINDSET;

    TempReturnRcptLine := ReturnRcptLine;
    TempReturnRcptLine.INSERT;
    END;
    ...

    Replacement code

    ...
    TempReturnRcptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempReturnRcptLine.FINDFIRST THEN BEGIN
    ReturnRcptLine.COPYFILTERS(Rec);
    ReturnRcptLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ReturnRcptLine.FINDSET THEN
    EXIT(FALSE);
    // End of the lines.

    TempReturnRcptLine := ReturnRcptLine;
    TempReturnRcptLine.INSERT;
    END;
  7. Change the code in the IsFirstDocLine function in the Get Post.Doc-S.Cr.MemoLn Sbfrm form (5854) as follows:
    Existing code

    ...
    TempSalesCrMemoLine.SETRANGE("Document No.","Document No.");
    IF NOT TempSalesCrMemoLine.FINDFIRST THEN BEGIN
    SalesCrMemoLine.COPYFILTERS(Rec);
    SalesCrMemoLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    SalesCrMemoLine.FIND('-');

    TempSalesCrMemoLine := SalesCrMemoLine;
    TempSalesCrMemoLine.INSERT;
    END;
    ...

    Replacement code

    ...
    TempSalesCrMemoLine.SETRANGE("Document No.","Document No.");
    IF NOT TempSalesCrMemoLine.FINDFIRST THEN BEGIN
    SalesCrMemoLine.COPYFILTERS(Rec);
    SalesCrMemoLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT SalesCrMemoLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.

    TempSalesCrMemoLine := SalesCrMemoLine;
    TempSalesCrMemoLine.INSERT;
    END;
  8. Change the code in the IsFirstDocLine function in the Get Pst.Doc-RtrnShptLn Subform form (5858) as follows:
    Existing code

    ...
    TempReturnShptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempReturnShptLine.FINDFIRST THEN BEGIN
    ReturnShptLine.COPYFILTERS(Rec);
    ReturnShptLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ReturnShptLine.FINDSET;

    TempReturnShptLine := ReturnShptLine;
    TempReturnShptLine.INSERT;
    END;
    ...

    Replacement code

    ...
    TempReturnShptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempReturnShptLine.FINDFIRST THEN BEGIN
    ReturnShptLine.COPYFILTERS(Rec);
    ReturnShptLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ReturnShptLine.FINDSET THEN
    EXIT(FALSE);
    // End of the lines.

    TempReturnShptLine := ReturnShptLine;
    TempReturnShptLine.INSERT;
    END;
  9. Change the code in the IsFirstDocLine function in the Get Post.Doc-P.Cr.MemoLn Sbfrm form (5859) as follows:
    Existing code

    ...
    TempPurchCrMemoLine.SETRANGE("Document No.","Document No.");
    IF NOT TempPurchCrMemoLine.FINDFIRST THEN BEGIN
    PurchCrMemoLine.COPYFILTERS(Rec);
    PurchCrMemoLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    PurchCrMemoLine.FINDSET;

    TempPurchCrMemoLine := PurchCrMemoLine;
    TempPurchCrMemoLine.INSERT;
    END;
    ...

    Replacement code

    ...
    TempPurchCrMemoLine.SETRANGE("Document No.","Document No.");
    IF NOT TempPurchCrMemoLine.FINDFIRST THEN BEGIN
    PurchCrMemoLine.COPYFILTERS(Rec);
    PurchCrMemoLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT PurchCrMemoLine.FINDSET THEN
    EXIT(FALSE);
    // End of the lines.

    TempPurchCrMemoLine := PurchCrMemoLine;
    TempPurchCrMemoLine.INSERT;
    END;
  10. Change the code in the IsFirstDocLine function in the Get Service Shipment Lines form (5994) as follows:
    Existing code

    ...
    TempServiceShptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempServiceShptLine.FIND('-') THEN BEGIN
    ServiceShptLine.COPYFILTERS(Rec);
    ServiceShptLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ServiceShptLine.FIND('-');

    TempServiceShptLine := ServiceShptLine;
    TempServiceShptLine.INSERT;
    END;
    IF "Line No." = TempServiceShptLine."Line No." THEN
    ...

    Replacement code

    ...
    TempServiceShptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempServiceShptLine.FIND('-') THEN BEGIN
    ServiceShptLine.COPYFILTERS(Rec);
    ServiceShptLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ServiceShptLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.

    TempServiceShptLine := ServiceShptLine;
    TempServiceShptLine.INSERT;
    END;
    IF "Line No." = TempServiceShptLine."Line No." THEN
  11. Change the code in the IsFirstDocLine function in the Service Lines Subform form (6036) as follows:
    Existing code

    ...
    IF NOT TempServLine.FIND('-') THEN BEGIN
    ServLine.COPYFILTERS(Rec);
    ServLine.SETRANGE("Document Type","Document Type");
    ServLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ServLine.FIND('-');

    TempServLine := ServLine;
    TempServLine.INSERT;
    END;
    IF "Line No." = TempServLine."Line No." THEN
    IF "Line No." = TempServiceShptLine."Line No." THEN
    ...

    Replacement code

    ...
    IF NOT TempServLine.FIND('-') THEN BEGIN
    ServLine.COPYFILTERS(Rec);
    ServLine.SETRANGE("Document Type","Document Type");
    ServLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ServLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.

    TempServLine := ServLine;
    TempServLine.INSERT;
    END;
    IF "Line No." = TempServLine."Line No." THEN
  12. Change the code in the IsFirstDocLine function in the Service Shipment Lines Subform form (6037) as follows:
    Existing code

    ...
    TempServShptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempServShptLine.FIND('-') THEN BEGIN
    ServShptLine.COPYFILTERS(Rec);
    ServShptLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ServShptLine.FIND('-');

    TempServShptLine := ServShptLine;
    TempServShptLine.INSERT;
    END;
    IF "Line No." = TempServShptLine."Line No." THEN
    ...

    Replacement code

    ...
    TempServShptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempServShptLine.FIND('-') THEN BEGIN
    ServShptLine.COPYFILTERS(Rec);
    ServShptLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ServShptLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.
    TempServShptLine := ServShptLine;
    TempServShptLine.INSERT;
    END;
    IF "Line No." = TempServShptLine."Line No." THEN
  13. Change the code in the IsFirstDocLine function in the Service Invoice Lines Subform form (6038) as follows:
    Existing code

    ...
    TempServInvLine.SETRANGE("Document No.","Document No.");
    IF NOT TempServInvLine.FIND('-') THEN BEGIN
    ServInvLine.COPYFILTERS(Rec);
    ServInvLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ServInvLine.FIND('-');

    TempServInvLine := ServInvLine;
    TempServInvLine.INSERT;
    END;
    EXIT("Line No." = TempServInvLine."Line No.");
    ...

    Replacement code

    ...
    TempServInvLine.SETRANGE("Document No.","Document No.");
    IF NOT TempServInvLine.FIND('-') THEN BEGIN
    ServInvLine.COPYFILTERS(Rec);
    ServInvLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ServInvLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.

    TempServInvLine := ServInvLine;
    TempServInvLine.INSERT;
    END;
    EXIT("Line No." = TempServInvLine."Line No.");
  14. Change the code in the IsFirstDocLine function in the Service Cr. Memo Lines Subform form (6039) as follows:
    Existing code

    ...
    TempServCrMemoLine.SETRANGE("Document No.","Document No.");
    IF NOT TempServCrMemoLine.FIND('-') THEN BEGIN
    ServCrMemoLine.COPYFILTERS(Rec);
    ServCrMemoLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ServCrMemoLine.FIND('-');

    TempServCrMemoLine := ServCrMemoLine;
    TempServCrMemoLine.INSERT;
    END;
    EXIT("Line No." = TempServCrMemoLine."Line No.");
    ...

    Replacement code

    ...
    TempServCrMemoLine.SETRANGE("Document No.","Document No.");
    IF NOT TempServCrMemoLine.FIND('-') THEN BEGIN
    ServCrMemoLine.COPYFILTERS(Rec);
    ServCrMemoLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ServCrMemoLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.

    TempServCrMemoLine := ServCrMemoLine;
    TempServCrMemoLine.INSERT;
    END;
    EXIT("Line No." = TempServCrMemoLine."Line No.");
  15. Change the code in the IsFirstDocLine function in the Get Return Receipt Lines form (6638) as follows:
    Existing code

    ...
    TempReturnRcptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempReturnRcptLine.FIND('-') THEN BEGIN
    ReturnRcptLine.COPYFILTERS(Rec);
    ReturnRcptLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ReturnRcptLine.FIND('-');

    TempReturnRcptLine := ReturnRcptLine;
    TempReturnRcptLine.INSERT;
    END;
    IF "Line No." = TempReturnRcptLine."Line No." THEN
    ...

    Replacement code

    ...
    TempReturnRcptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempReturnRcptLine.FIND('-') THEN BEGIN
    ReturnRcptLine.COPYFILTERS(Rec);
    ReturnRcptLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ReturnRcptLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.

    TempReturnRcptLine := ReturnRcptLine;
    TempReturnRcptLine.INSERT;
    END;
    IF "Line No." = TempReturnRcptLine."Line No." THEN
  16. Change the code in the IsFirstDocLine function in the Get Return Shipment Lines form (6648) as follows:
    Existing code

    ...
    TempReturnShptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempReturnShptLine.FIND('-') THEN BEGIN
    ReturnShptLine.COPYFILTERS(Rec);
    ReturnShptLine.SETRANGE("Document No.","Document No.");

    // Delete the following line.
    ReturnShptLine.FIND('-');

    TempReturnShptLine := ReturnShptLine;
    TempReturnShptLine.INSERT;
    END;
    IF "Line No." = TempReturnShptLine."Line No." THEN
    ...

    Replacement code

    ...
    TempReturnShptLine.SETRANGE("Document No.","Document No.");
    IF NOT TempReturnShptLine.FIND('-') THEN BEGIN
    ReturnShptLine.COPYFILTERS(Rec);
    ReturnShptLine.SETRANGE("Document No.","Document No.");

    // Add the following lines.
    IF NOT ReturnShptLine.FINDFIRST THEN
    EXIT(FALSE);
    // End of the lines.

    TempReturnShptLine := ReturnShptLine;
    TempReturnShptLine.INSERT;
    END;
    IF "Line No." = TempReturnShptLine."Line No." THEN

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!

×