Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

You unexpectedly receive a stockout warning when you create a warehouse shipment from a sales order in Microsoft Dynamics NAV 2009 SP1


View products that this article applies to.

Rapidly Published articles provide information directly from within the Microsoft support organization. The information that is contained herein is created in response to emerging or unique topics, or is intended to supplement other Knowledge Base information.

↑ Back to the top


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

↑ Back to the top


Symptoms

Assume that the availability stockout warning is enabled in Microsoft Dynamics NAV 2009 SP1. When you create a warehouse shipment from a sales order, although the item is available for the sales order, you unexpectedly receive the following stockout warning:
The warehouse shipment was not created because the Shipping Advice field is set to Complete, and item no. 1000 is not available in location code Location_code.

You can create the warehouse shipment by either changing Shipping Advice field to Partial in sales order no. Order_number, or filling in the warehouse shipment document manually.

Note In this warning message, the Location_code placeholder represents an actual location code. The Order_number placeholder represents an actual sales order number.

This problem occurs when the shipping advice is complete for items that are already present, but the item has zero availability because of other gross requirements.

↑ Back to the top


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 service pack or the next 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.


↑ Back to the top




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 install this hotfix, change the code in the "Get Source Doc. Outbound" codeunit (5752) and in the "Create Invt. Put-away / Pick" report (7323).

To do this, follow these steps:
  1. Add the following global variables in the "Get Source Doc. Outbound" codeunit (5752):
        Text001@1000 : TextConst 'ENU=If %1 is %2 in %3 no. %4, then all associated lines where type is %5 must use the same location.';
    Text002@1001 : TextConst 'ENU=The warehouse shipment was not created because the Shipping Advice field is set to Complete, and item no. %1 is not available in location code %2.\\You can create the warehouse shipment by either changing the Shipping Advice field to Partial in %3 no. %4, or filling in the warehouse shipment document manually.';
    ...
  2. Change the code in the CreateFromSalesOrder precedure and the CreateFromOutbndTransferOrder precedure in the "Get Source Doc. Outbound" codeunit (5752) as follows:
    Existing code
     ...
    PROCEDURE CreateFromSalesOrder@3(SalesHeader@1000 : Record 36);
    WITH SalesHeader DO BEGIN
    TESTFIELD(Status,Status::Released);
    CheckLocation(TRUE); // Delete this line.

    WhseRqst.SETRANGE(Type,WhseRqst.Type::Outbound);
    ...
    PROCEDURE CreateFromOutbndTransferOrder@4(TransHeader@1000 : Record 5740);
    WITH TransHeader DO BEGIN
    TESTFIELD(Status,Status::Released);

    WhseRqst.SETRANGE(Type,WhseRqst.Type::Outbound);
    WhseRqst.SETRANGE("Source Type",DATABASE::"Transfer Line");
    ...
    Replacement code
    ...
    PROCEDURE CreateFromSalesOrder@3(SalesHeader@1000 : Record 36);
    WITH SalesHeader DO BEGIN
    TESTFIELD(Status,Status::Released);

    CheckSalesHeader(SalesHeader,TRUE); // Add this line.
    WhseRqst.SETRANGE(Type,WhseRqst.Type::Outbound);
    ...
    PROCEDURE CreateFromOutbndTransferOrder@4(TransHeader@1000 : Record 5740);
    WITH TransHeader DO BEGIN
    TESTFIELD(Status,Status::Released);
    CheckTransferHeader(TransHeader,TRUE); // Add this line.
    WhseRqst.SETRANGE(Type,WhseRqst.Type::Outbound);
    WhseRqst.SETRANGE("Source Type",DATABASE::"Transfer Line");
    ...
  3. Add the following precedures in the "Get Source Doc. Outbound" codeunit (5752):
      PROCEDURE CheckSalesHeader@7(SalesHeader@1000 : Record 36;ShowError@1001 : Boolean) : Boolean;
    VAR
    SalesLine@1002 : Record 37;
    SalesLine2@1003 : Record 37;
    SalesOrder@1004 : Form 42;
    CurrItemNo@1005 : Code[20];
    QtyOutstandingBase@1006 : Decimal;
    RecordNo@1007 : Integer;
    TotalNoOfRecords@1008 : Integer;
    BEGIN
    WITH SalesHeader DO BEGIN
    IF NOT ("Shipping Advice" = "Shipping Advice"::Complete) THEN
    EXIT(FALSE);

    SalesLine.SETCURRENTKEY("Document Type",Type,"No.");
    SalesLine.SETRANGE("Document Type","Document Type");
    SalesLine.SETRANGE("Document No.","No.");
    SalesLine.SETRANGE(Type,SalesLine.Type::Item);
    IF SalesLine.FINDSET THEN BEGIN
    SalesLine2.COPYFILTERS(SalesLine);
    SalesLine2.SETCURRENTKEY("Document Type","Document No.","Location Code");
    SalesLine2.SETFILTER("Location Code",'<> %1',SalesLine."Location Code");
    IF NOT SalesLine2.ISEMPTY THEN BEGIN
    IF ShowError THEN
    ERROR(Text001,FIELDCAPTION("Shipping Advice"),"Shipping Advice",
    SalesOrder.CAPTION,"No.",SalesLine.Type);
    EXIT(TRUE);
    END;

    CurrItemNo := SalesLine."No.";
    TotalNoOfRecords := SalesLine.COUNT;
    REPEAT
    RecordNo = 1;
    IF SalesLine."No." = CurrItemNo THEN
    QtyOutstandingBase = SalesLine."Outstanding Qty. (Base)"
    ELSE BEGIN
    IF CheckAvailability(CurrItemNo,QtyOutstandingBase,SalesLine."Location Code",
    SalesOrder.CAPTION,DATABASE::"Sales Line","Document Type","No.",ShowError) THEN
    EXIT(TRUE);
    CurrItemNo := SalesLine."No.";
    QtyOutstandingBase := SalesLine."Outstanding Qty. (Base)";
    END;
    IF RecordNo = TotalNoOfRecords THEN BEGIN // last record
    IF CheckAvailability(CurrItemNo,QtyOutstandingBase,SalesLine."Location Code",
    SalesOrder.CAPTION,DATABASE::"Sales Line","Document Type","No.",ShowError) THEN
    EXIT(TRUE);
    END;
    UNTIL SalesLine.NEXT = 0; // sorted by item
    END;
    END;
    END;

    PROCEDURE CheckTransferHeader@8(TransferHeader@1000 : Record 5740;ShowError@1001 : Boolean) : Boolean;
    VAR
    TransferLine@1002 : Record 5741;
    TransferOrder@1003 : Form 5740;
    CurrItemNo@1004 : Code[20];
    QtyOutstandingBase@1005 : Decimal;
    RecordNo@1006 : Integer;
    TotalNoOfRecords@1007 : Integer;
    BEGIN
    WITH TransferHeader DO BEGIN
    IF NOT ("Shipping Advice" = "Shipping Advice"::Complete) THEN
    EXIT(FALSE);

    TransferLine.SETCURRENTKEY("Item No.");
    TransferLine.SETRANGE("Document No.","No.");
    IF TransferLine.FINDSET THEN BEGIN
    CurrItemNo := TransferLine."Item No.";
    TotalNoOfRecords := TransferLine.COUNT;
    REPEAT
    RecordNo = 1;
    IF TransferLine."Item No." = CurrItemNo THEN
    QtyOutstandingBase = TransferLine."Outstanding Qty. (Base)"
    ELSE BEGIN
    IF CheckAvailability(CurrItemNo,QtyOutstandingBase,TransferLine."Transfer-from Code",
    TransferOrder.CAPTION,DATABASE::"Transfer Line",0,"No.",ShowError) THEN // outbound
    EXIT(TRUE);
    CurrItemNo := TransferLine."Item No.";
    QtyOutstandingBase := TransferLine."Outstanding Qty. (Base)";
    END;
    IF RecordNo = TotalNoOfRecords THEN BEGIN // last record
    IF CheckAvailability(CurrItemNo,QtyOutstandingBase,TransferLine."Transfer-from Code",
    TransferOrder.CAPTION,DATABASE::"Transfer Line",0,"No.",ShowError) THEN // outbound
    EXIT(TRUE);
    END;
    UNTIL TransferLine.NEXT = 0; // sorted by item
    END;
    END;
    END;

    PROCEDURE CheckAvailability@9(ItemNo@1000 : Code[20];QtyBaseNeeded@1001 : Decimal;LocationCode@1002 : Code[10];FormCaption@1003 : Text[1024];SourceType@1004 : Integer;SourceSubType@1005 : Integer;SourceID@1006 : Code[20];ShowError@1007 : Boolean) : Boolean;
    VAR
    Item@1008 : Record 27;
    ReservEntry@1009 : Record 337;
    ReservEntry2@1010 : Record 337;
    QtyReservedForOrder@1011 : Decimal;
    BEGIN
    WITH Item DO BEGIN
    GET(ItemNo);
    SETRANGE("Location Filter",LocationCode);
    CALCFIELDS(Inventory,"Reserved Qty. on Inventory");

    // find qty reserved for this order
    ReservEntry.SETCURRENTKEY("Source ID","Source Ref. No.","Source Type","Source Subtype");
    ReservEntry.SETRANGE("Item No.",ItemNo);
    ReservEntry.SETRANGE("Location Code",LocationCode);
    ReservEntry.SETRANGE("Reservation Status",ReservEntry."Reservation Status"::Reservation);
    ReservEntry.SETRANGE("Source Type",SourceType);
    ReservEntry.SETRANGE("Source Subtype",SourceSubType);
    ReservEntry.SETRANGE("Source ID",SourceID);
    IF ReservEntry.FINDSET THEN
    REPEAT
    ReservEntry2.GET(ReservEntry."Entry No.",NOT ReservEntry.Positive);
    QtyReservedForOrder = ReservEntry2."Quantity (Base)";
    UNTIL ReservEntry.NEXT = 0;

    IF Inventory - ("Reserved Qty. on Inventory" - QtyReservedForOrder) < QtyBaseNeeded THEN BEGIN
    IF ShowError THEN
    ERROR(Text002,ItemNo,LocationCode,FormCaption,SourceID);
    EXIT(TRUE);
    END;
    END;
    END;
  4. Change the code in the "Create Invt. Put-away / Pick" report (7323) as follows:
    Existing code
    ...
    CODE
    {
    VAR
    ...
    SalesHeader@1023 : Record 36; // Delete this line.
    ...
    PROCEDURE CheckWhseRequest@3(WhseRequest@1000 : Record 5765) : Boolean; // This precedure will be changed to a local precedure.

    BEGIN
    IF WhseRequest."Document Status" <> WhseRequest."Document Status"::Released THEN
    EXIT(TRUE);
    IF (WhseRequest.Type = WhseRequest.Type::Outbound) AND
    (WhseRequest."Shipping Advice" = WhseRequest."Shipping Advice"::Complete) AND // Delete this line.

    // Delete the following lines
    (WhseRequest."Source Type" = DATABASE::"Sales Line") AND
    (WhseRequest."Source Subtype" = WhseRequest."Source Subtype"::"1")
    THEN BEGIN
    IF WhseRequest."Source No." <> SalesHeader."No." THEN
    // The end of the lines.

    SalesHeader.GET(SalesHeader."Document Type"::Order,WhseRequest."Source No.");
    EXIT(SalesHeader.CheckLocation(ShowError)); // Delete this line.

    END;
    END;
    Replacement code
    ...
    CODE
    {
    VAR
    ...

    ...

    LOCAL PROCEDURE CheckWhseRequest@3(WhseRequest@1000 : Record 5765) : Boolean; // The precedure is changed to a local precedure.
    // Add the following variables.
    VAR
    SalesHeader@1001 : Record 36;
    TransferHeader@1002 : Record 5740;
    GetSrcDocOutbound@1003 : Codeunit 5752;
    // The end.
    BEGIN
    IF WhseRequest."Document Status" <> WhseRequest."Document Status"::Released THEN
    EXIT(TRUE);
    IF (WhseRequest.Type = WhseRequest.Type::Outbound) AND

    (WhseRequest."Shipping Advice" = WhseRequest."Shipping Advice"::Complete) THEN // Add this line.
    // Add the following lines.
    CASE WhseRequest."Source Type" OF
    DATABASE::"Sales Line":
    BEGIN
    IF WhseRequest."Source Subtype" = WhseRequest."Source Subtype"::"1" THEN BEGIN

    SalesHeader.GET(SalesHeader."Document Type"::Order,WhseRequest."Source No.");
    // Add the following lines.
    EXIT(GetSrcDocOutbound.CheckSalesHeader(SalesHeader,ShowError));
    END;
    END;
    DATABASE::"Transfer Line":
    BEGIN
    TransferHeader.GET(WhseRequest."Source No.");
    EXIT(GetSrcDocOutbound.CheckTransferHeader(TransferHeader,ShowError));
    END;

    END;
    END;

Prerequisites

You must have Microsoft Dynamics NAV 2009 Service Pack 1 installed to apply this hotfix.

Removal information

You cannot remove this hotfix.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, THE RELIABILITY OR THE ACCURACY OF THE INFORMATION THAT IS CONTAINED IN THE DOCUMENTS AND THE RELATED GRAPHICS PUBLISHED ON THIS WEB SITE (THE “MATERIALS”) FOR ANY PURPOSE.

THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON-INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

↑ Back to the top


Keywords: kbmbsquickpub, kbnoloc, kbmbscodefix, kbqfe, kbnotautohotfix, kbmbspartner, kbsurveynew, kb, kbmbswarehousemanagement, kbmbsmigrate

↑ Back to the top

Article Info
Article ID : 979254
Revision : 2
Created on : 9/25/2018
Published on : 9/25/2018
Exists online : False
Views : 215