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

Symptoms

Assume that you apply hotfix 2525331 in Microsoft Dynamics NAV 2009. When you create a purchase order for a special sales order, the Ship-to Address value is incorrect on the purchase order.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2525331 The drop shipment and the special order do not consider the defined information on the sales order when you use the requisition worksheet to create a purchase order or when you manually create a purchase order in Microsoft Dynamics NAV This problem occurs in the following products:

  • Microsoft Dynamics NAV 2009 R2

  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)


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 Purchase Header table (38) as follows:
    Existing code 1

    ...
    IF PurchSetup."Calc. Inv. Discount" THEN
    PurchaseInvDisc.CalculateIncDiscForHeader(Rec);
    END;

    // Delete the following line.
    PROCEDURE CheckAndAddShipToAdd@46(SalesHeader@1000 : Record 36;ShowError@1001 : Boolean) : Boolean;
    // End of the deleted line.

    VAR
    PurchLine2@1002 : Record 39;
    BEGIN
    IF ShowError THEN BEGIN
    ...

    Replacement code 1

    ...
    IF PurchSetup."Calc. Inv. Discount" THEN
    PurchaseInvDisc.CalculateIncDiscForHeader(Rec);
    END;

    // Add the following line.
    PROCEDURE AddShipToAddress@46(SalesHeader@1000 : Record 36;ShowError@1001 : Boolean);
    // End of the added line.

    VAR
    PurchLine2@1002 : Record 39;
    BEGIN
    IF ShowError THEN BEGIN
    ...

    Existing code 2

    ...
    "Ship-to Address 2" := SalesHeader."Ship-to Address 2";
    "Ship-to Post Code" := SalesHeader."Ship-to Post Code";
    "Ship-to City" := SalesHeader."Ship-to City";
    "Ship-to Contact" := SalesHeader."Ship-to Contact";
    END;

    // Delete the following lines.
    END ELSE BEGIN
    NameAddressDetails :=
    SalesHeader."Ship-to Name" + SalesHeader."Ship-to Name 2" +
    SalesHeader."Ship-to Address" + SalesHeader."Ship-to Address 2" +
    SalesHeader."Ship-to Post Code" + SalesHeader."Ship-to City" +
    SalesHeader."Ship-to Contact";
    IF NameAddressDetails2 = '' THEN
    NameAddressDetails2 := NameAddressDetails;
    EXIT(NameAddressDetails2 = NameAddressDetails);
    // End of the deleted lines.

    END;
    END;

    Replacement code 2

    ...
    "Ship-to Address 2" := SalesHeader."Ship-to Address 2";
    "Ship-to Post Code" := SalesHeader."Ship-to Post Code";
    "Ship-to City" := SalesHeader."Ship-to City";
    "Ship-to Contact" := SalesHeader."Ship-to Contact";
    END;
    END;
    END;
    ...

    Existing code 3

    ...
    END;
    END;

    // Delete the following line.
    PROCEDURE DropShptSplOrderExists@48(SalesHeader@1000 : Record 36) : Boolean;
    // End of the deleted line.

    VAR
    SalesLine2@1001 : Record 37;

    // Delete the following line.
    DropShptSplOrderExists@1002 : Boolean;
    // End of the deleted line.

    BEGIN
    SalesLine2.RESET;
    SalesLine2.SETRANGE("Document Type",SalesLine2."Document Type"::Order);
    SalesLine2.SETRANGE("Document No.",SalesHeader."No.");
    SalesLine2.SETRANGE("Drop Shipment",TRUE);

    // Delete the following lines.
    DropShptSplOrderExists := NOT SalesLine2.ISEMPTY;
    IF NOT DropShptSplOrderExists THEN BEGIN
    SalesLine2.SETRANGE("Drop Shipment");
    SalesLine2.SETRANGE("Special Order",TRUE);
    DropShptSplOrderExists := NOT SalesLine2.ISEMPTY;
    END;
    EXIT(DropShptSplOrderExists);
    // End of the deleted lines.

    END;
    PROCEDURE UpdtPriceInclVAT@76();
    ...

    Replacement code 3

    ...
    END;
    END;

    // Add the following line.
    PROCEDURE DropShptOrderExists@48(SalesHeader@1000 : Record 36) : Boolean;
    // End of the added line.

    VAR
    SalesLine2@1001 : Record 37;
    BEGIN
    SalesLine2.RESET;
    SalesLine2.SETRANGE("Document Type",SalesLine2."Document Type"::Order);
    SalesLine2.SETRANGE("Document No.",SalesHeader."No.");
    SalesLine2.SETRANGE("Drop Shipment",TRUE);
    EXIT(NOT SalesLine2.ISEMPTY);
    END;

    // Add the following lines.
    PROCEDURE SpecialOrderExists@81(SalesHeader@1000 : Record 36) : Boolean;
    VAR
    SalesLine3@1001 : Record 37;
    BEGIN
    SalesLine3.RESET;
    SalesLine3.SETRANGE("Document Type",SalesLine3."Document Type"::Order);
    SalesLine3.SETRANGE("Document No.",SalesHeader."No.");
    SalesLine3.SETRANGE("Special Order",TRUE);
    EXIT(NOT SalesLine3.ISEMPTY);
    END;
    // End of the added lines.

    PROCEDURE UpdtPriceInclVAT@76();
    ...

    Existing code 4

    ...
    END;
    END;
    PurchLine.MODIFY;
    UNTIL PurchLine.NEXT = 0;
    END;
    END;

    BEGIN
    END.
    ...

    Replacement code 4

    ...
    END;
    END;
    PurchLine.MODIFY;
    UNTIL PurchLine.NEXT = 0;
    END;
    END;

    // Add the following lines.
    PROCEDURE CheckAddressDetails@79(SalesHeader@1000 : Record 36) : Boolean;
    BEGIN
    NameAddressDetails :=
    SalesHeader."Ship-to Name" + SalesHeader."Ship-to Name 2" +
    SalesHeader."Ship-to Address" + SalesHeader."Ship-to Address 2" +
    SalesHeader."Ship-to Post Code" + SalesHeader."Ship-to City" +
    SalesHeader."Ship-to Contact";
    IF NameAddressDetails2 = '' THEN
    NameAddressDetails2 := NameAddressDetails;
    EXIT(NameAddressDetails2 = NameAddressDetails);
    END;

    PROCEDURE AddSpecialOrderToAddress@80(SalesHeader@1000 : Record 36;ShowError@1001 : Boolean);
    VAR
    PurchLine3@1003 : Record 39;
    LocationCode@1004 : Record 14;
    BEGIN
    IF ShowError THEN BEGIN
    PurchLine3.RESET;
    PurchLine3.SETRANGE("Document Type","Document Type"::Order);
    PurchLine3.SETRANGE("Document No.","No.");
    IF NOT PurchLine3.ISEMPTY THEN BEGIN
    LocationCode.GET("Location Code");
    IF "Ship-to Name" <> LocationCode.Name THEN
    ERROR(Text051,FIELDCAPTION("Ship-to Name"),"No.",SalesHeader."No.");
    IF "Ship-to Name 2" <> LocationCode."Name 2" THEN
    ERROR(Text051,FIELDCAPTION("Ship-to Name 2"),"No.",SalesHeader."No.");
    IF ("Ship-to Address" <> LocationCode.Address) THEN
    ERROR(Text051,FIELDCAPTION("Ship-to Address"),"No.",SalesHeader."No.");
    IF ("Ship-to Address 2" <> LocationCode."Address 2") THEN
    ERROR(Text051,FIELDCAPTION("Ship-to Address 2"),"No.",SalesHeader."No.");
    IF ("Ship-to Post Code" <> LocationCode."Post Code") THEN
    ERROR(Text051,FIELDCAPTION("Ship-to Post Code"),"No.",SalesHeader."No.");
    IF ("Ship-to City" <> LocationCode.City) THEN
    ERROR(Text051,FIELDCAPTION("Ship-to City"),"No.",SalesHeader."No.");
    IF ("Ship-to Contact" <> LocationCode.Contact) THEN
    ERROR(Text051,FIELDCAPTION("Ship-to Contact"),"No.",SalesHeader."No.");
    END ELSE BEGIN
    LocationCode.GET("Location Code");
    "Ship-to Name" := LocationCode.Name;
    "Ship-to Name 2" := LocationCode."Name 2";
    "Ship-to Address" := LocationCode.Address;
    "Ship-to Address 2" := LocationCode."Address 2";
    "Ship-to Post Code" := LocationCode."Post Code";
    "Ship-to City" := LocationCode.City;
    "Ship-to Contact" := LocationCode.Contact;
    END;
    END;
    END;
    // End of the added lines.

    BEGIN
    END.
    ...
  2. Change the code in the Purch.-Get Drop Shpt. codeunit (76) as follows:
    Existing code

    ...
    IF RECORDLEVELLOCKING THEN
    LOCKTABLE;
    SalesHeader.TESTFIELD("Document Type",SalesHeader."Document Type"::Order);
    TESTFIELD("Sell-to Customer No.",SalesHeader."Sell-to Customer No.");
    TESTFIELD("Ship-to Code",SalesHeader."Ship-to Code");

    // Delete the following lines.
    IF DropShptSplOrderExists(SalesHeader) THEN
    CheckAndAddShipToAdd(SalesHeader,TRUE);
    // End of the deleted lines.

    PurchLine.LOCKTABLE;
    IF NOT RECORDLEVELLOCKING THEN
    ...

    Replacement code

    ...
    IF RECORDLEVELLOCKING THEN
    LOCKTABLE;
    SalesHeader.TESTFIELD("Document Type",SalesHeader."Document Type"::Order);
    TESTFIELD("Sell-to Customer No.",SalesHeader."Sell-to Customer No.");
    TESTFIELD("Ship-to Code",SalesHeader."Ship-to Code");

    // Add the following lines.
    IF DropShptOrderExists(SalesHeader) THEN
    AddShipToAddress(SalesHeader,TRUE);
    // End of the added lines.

    PurchLine.LOCKTABLE;
    IF NOT RECORDLEVELLOCKING THEN
    ...
  3. Change the code in the Req. Wksh.-Make Order codeunit (333) as follows:
    Existing code

    ...
    CounterFailed@1052 : Integer;
    PrevPurchCode@1047 : Code[10];
    PrevShipToCode@1017 : Code[10];
    "0DF"@1048 : DateFormula;
    Text010@1049 : TextConst 'ENU=must match %1 on Sales Order %2, Line %3';

    // Delete the following line.
    DropShptSpecialOrderExists@1056 : Boolean;
    // End of the delete line.

    ...
    LOCAL PROCEDURE InsertPurchOrderLine@3(VAR ReqLine2@1000 : Record 246;VAR PurchOrderHeader@1001 : Record 38);
    ...
    DropShptSplOrderDiffAddress@1006 : Boolean;
    BEGIN
    WITH ReqLine2 DO BEGIN
    IF ("No." = '') OR ("Vendor No." = '') OR (Quantity = 0) THEN
    EXIT;

    // Delete the following line.
    DropShptSpecialOrderExists := FALSE;
    // End of the deleted line.

    ...
    IF SalesHeader.GET(SalesHeader."Document Type"::Order,"Sales Order No.") THEN BEGIN

    // Delete the following lines.
    DropShptSpecialOrderExists := PurchOrderHeader.DropShptSplOrderExists(SalesHeader);
    IF DropShptSpecialOrderExists THEN
    // End of the deleted lines.

    ...
    DropShptSplOrderDiffAddress :=

    // Delete the following line.
    NOT PurchOrderHeader.CheckAndAddShipToAdd(SalesHeader,FALSE);
    // End of the deleted line.

    ...
    LOCAL PROCEDURE InsertHeader@4(VAR ReqLine2@1000 : Record 246);
    ...
    PurchOrderHeader.VALIDATE("Location Code",ReqLine2."Location Code");
    END ELSE BEGIN
    PurchOrderHeader.VALIDATE("Location Code",ReqLine2."Location Code");
    PurchOrderHeader.SetShipToForSpecOrder;
    END;

    // Delete the following line.
    IF DropShptSpecialOrderExists THEN
    // End of the deleted line.

    ...
    PurchOrderHeader."Ship-to Address 2" := SalesHeader."Ship-to Address 2";
    PurchOrderHeader."Ship-to Post Code" := SalesHeader."Ship-to Post Code";
    PurchOrderHeader."Ship-to City" := SalesHeader."Ship-to City";
    PurchOrderHeader."Ship-to Contact" := SalesHeader."Ship-to Contact";
    END;

    // Delete the following line.
    IF SpecialOrder THEN
    // End of the deleted line.

    ...

    Replacement code

    ...
    CounterFailed@1052 : Integer;
    PrevPurchCode@1047 : Code[10];
    PrevShipToCode@1017 : Code[10];
    "0DF"@1048 : DateFormula;
    Text010@1049 : TextConst 'ENU=must match %1 on Sales Order %2, Line %3';
    ...
    LOCAL PROCEDURE InsertPurchOrderLine@3(VAR ReqLine2@1000 : Record 246;VAR PurchOrderHeader@1001 : Record 38);
    ...
    DropShptSplOrderDiffAddress@1006 : Boolean;
    BEGIN
    WITH ReqLine2 DO BEGIN
    IF ("No." = '') OR ("Vendor No." = '') OR (Quantity = 0) THEN
    EXIT;
    ...
    IF SalesHeader.GET(SalesHeader."Document Type"::Order,"Sales Order No.") THEN BEGIN

    // Add the following lines.
    IF PurchOrderHeader.DropShptOrderExists(SalesHeader) OR
    PurchOrderHeader.SpecialOrderExists(SalesHeader)
    THEN
    // End of the added lines.

    ...
    DropShptSplOrderDiffAddress :=

    // Add the following line.
    NOT PurchOrderHeader.CheckAddressDetails(SalesHeader);
    // End of the added line.

    ...
    LOCAL PROCEDURE InsertHeader@4(VAR ReqLine2@1000 : Record 246);
    ...
    PurchOrderHeader.VALIDATE("Location Code",ReqLine2."Location Code");
    END ELSE BEGIN
    PurchOrderHeader.VALIDATE("Location Code",ReqLine2."Location Code");
    PurchOrderHeader.SetShipToForSpecOrder;
    END;

    // Add the following line.
    IF NOT SpecialOrder THEN BEGIN
    // End of the added line.

    ...
    PurchOrderHeader."Ship-to Address 2" := SalesHeader."Ship-to Address 2";
    PurchOrderHeader."Ship-to Post Code" := SalesHeader."Ship-to Post Code";
    PurchOrderHeader."Ship-to City" := SalesHeader."Ship-to City";
    PurchOrderHeader."Ship-to Contact" := SalesHeader."Ship-to Contact";
    END;

    // Add the following line.
    END ELSE
    // End of the added line.

    ...
  4. Change the code in the Dist. Integration codeunit (5702) as follows:
    Existing code

    ...
    PROCEDURE GetSpecialOrders@5(VAR PurchHeader@1000 : Record 38);
    ...
    IF RECORDLEVELLOCKING THEN
    LOCKTABLE;
    SalesHeader.TESTFIELD("Document Type",SalesHeader."Document Type"::Order);
    TESTFIELD("Sell-to Customer No.",SalesHeader."Sell-to Customer No.");
    TESTFIELD("Ship-to Code",SalesHeader."Ship-to Code");

    // Delete the following lines.
    IF DropShptSplOrderExists(SalesHeader) THEN
    CheckAndAddShipToAdd(SalesHeader,TRUE);
    // End of the deleted lines.

    ...

    Replacement code

    ...
    PROCEDURE GetSpecialOrders@5(VAR PurchHeader@1000 : Record 38);
    ...
    IF RECORDLEVELLOCKING THEN
    LOCKTABLE;
    SalesHeader.TESTFIELD("Document Type",SalesHeader."Document Type"::Order);
    TESTFIELD("Sell-to Customer No.",SalesHeader."Sell-to Customer No.");
    TESTFIELD("Ship-to Code",SalesHeader."Ship-to Code");

    // Add the following lines.
    IF SpecialOrderExists(SalesHeader) THEN
    AddSpecialOrderToAddress(SalesHeader,TRUE);
    // End of the added lines.

    ...


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 Usefor 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!

×