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.

Warehouse entries are not updated with all item tracking lines in a job journal when you post an item in the job journal to a bin in Microsoft Dynamics NAV 2009


View products that this article applies to.

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

↑ Back to the top


Symptoms

Assume that you have a job journal that has more than one item tracking lines for an item in Microsoft Dynamics NAV 2009. When you post the item in the job journal to a bin, the warehouse entries are only updated with the last item tracking line that is entered. Therefore, there is an imbalance for the item between the warehouse and the item ledger.
This problem occurs in the following products:
  • Microsoft Dynamics NAV 2009 R2
  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)

↑ 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 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.

↑ 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 resolve this problem, follow these steps:Create the following local variables:
  1. Add a new global variable in the Job Journal Line table (210), and then specify the variable as follows:
    • Name: WMSManagement
    • DataType: Codeunit
    • Subtype: WMS Management (7302)
  2. Delete the following code in the TableRelation property of the Bin Code field (5403) in the Job Journal Line table (210):
    Bin.Code WHERE (Location Code=FIELD(Location Code));
  3. Change the code in the OnValidate trigger for Bin Code field (5403) in the Job Journal Line table (210) as follow:
    Existing code
    ...
    // Delete the following lines.
    TESTFIELD("Location Code");
    CheckItemAvailable;
    // End of the lines.
    ...
    Replacement code
    ...
    // Add the following lines.
    TESTFIELD("Location Code");
    IF "Bin Code" <> '' THEN BEGIN
    GetLocation("Location Code");
    Location.TESTFIELD("Bin Mandatory");
    END;
    TESTFIELD(Type,Type::Item);
    CheckItemAvailable;
    WMSManagement.FindBinContent("Location Code","Bin Code","No.","Variant Code",'')
    // End of the lines.
    ...
  4. Add a new local variable in the Bin Code - OnLookup triggerin the Job Journal Line table (210), and then specify the variable as follows:
    • Name: BinCode
    • DataType: Code
    • Length: 20
  5. Add the following code in the Bin Code - OnLookup trigger in the Job Journal Line table (210):
    TESTFIELD("Location Code");
    TESTFIELD(Type,Type::Item);
    BinCode := WMSManagement.BinContentLookUp("Location Code","No.","Variant Code",'',"Bin Code");
    IF BinCode <> '' THEN
    VALIDATE("Bin Code",BinCode);
  6. Change the value in the OptionString property of the Source Document field (25) in the Warehouse Journal Line table (7311) to the following:
    OptionString=,S. Order,S. Invoice,S. Credit Memo,S. Return Order,P. Order,P. Invoice,P. Credit Memo,P. Return Order,Inb. Transfer,Outb. Transfer,Prod. Consumption,Item Jnl.,Phys. Invt. Jnl.,Reclass. Jnl.,Consumption Jnl.,Output Jnl.,BOM Jnl.,Serv Order,Job Jnl.
  7. Change the value in the OptionString property of the Reference Document field (60) in the Warehouse Journal Line table (7311) to the following:
    OptionString= ,Posted Rcpt.,Posted P. Inv.,Posted Rtrn. Rcpt.,Posted P. Cr. Memo,Posted Shipment,Posted S. Inv.,Posted Rtrn. Shipment,Posted S. Cr. Memo,Posted T. Receipt,Posted T. Shipment,Item Journal,Prod.,Put-away,Pick,Movement,BOM Journal,Job Journal
  8. Change the value in the OptionString property of the Source Document field (25) in the Warehouse Entry table (7312) to the following:
    OptionString=,S. Order,S. Invoice,S. Credit Memo,S. Return Order,P. Order,P. Invoice,P. Credit Memo,P. Return Order,Inb. Transfer,Outb. Transfer,Prod. Consumption,Item Jnl.,Phys. Invt. Jnl.,Reclass. Jnl.,Consumption Jnl.,Output Jnl.,BOM Jnl.,Serv. Order,Job Jnl.
  9. Change the value in the OptionString property of the Reference Document field (60) in the Warehouse Entry table (7312) to the following:
    OptionString= ,Posted Rcpt.,Posted P. Inv.,Posted Rtrn. Rcpt.,Posted P. Cr. Memo,Posted Shipment,Posted S. Inv.,Posted Rtrn. Shipment,Posted S. Cr. Memo,Posted T. Receipt,Posted T. Shipment,Item Journal,Prod.,Put-away,Pick,Movement,BOM Journal,Job Journal
  10. Change the Visible property of the Location Code control (60) in the Job Journal form (201) as follows:
    Existing code
    Visible = Yes
    Replacement code
    Visible = No
  11. Add the Bin Code field between the Location Code field and the Work Type Code field in the Job Journal form (201), and then specify the field as follow:
    ...
    { 61 ;Label ;0 ;0 ;0 ;0 ;ParentControl=60;
    InColumnHeading=Yes }

    // Add the following lines.
    { 102 ;TextBox ;35507;1650 ;1700 ;440 ;ParentControl=1;
    InColumn=Yes;
    SourceExpr="Bin Code" }
    { 103 ;Label ;0 ;0 ;0 ;0 ;ParentControl=102;
    InColumnHeading=Yes }
    // End of the lines.

    { 48 ;TextBox ;11430;2530 ;1650 ;440 ;ParentControl=1;
    ...
  12. Add a new global variable in the Job Jnl.-Post Line codeunit (1012), and then specify the variable as follows:
    • Name: Location
    • DataType: Record
    • Subtype: Location (14)
  13. Create a new GetLocation function in the Job Jnl.-Post Line codeunit (1012) as follows:
    LOCAL PROCEDURE GetLocation@25(LocationCode@1000 : Code[10]);
  14. Add the following code in the GetLocation function in the Job Jnl.-Post Line codeunit (1012):
    IF LocationCode = '' THEN
    CLEAR(Location)
    ELSE
    IF Location.Code <> LocationCode THEN
    Location.GET(LocationCode);
  15. Create a new PostWhseJnlLine function in the Job Jnl.-Post Line codeunit (1012) as follows:
    LOCAL PROCEDURE PostWhseJnlLine@24(ItemJnlLine@1000 : Record 83;OriginalQuantity@1001 : Decimal;OriginalQuantityBase@1002 : Decimal;VAR TempTrackingSpecification@1003 : TEMPORARY Record 336);
  16. Create the following local variables in the PostWhseJnlLine function in the Job Jnl.-Post Line codeunit (1012):
    1. Add a local variable in the PostWhseJnlLine function in the Job Jnl.-Post Line codeunit (1012), and then specify the variable as follows:
      • Name: WarehouseJournalLine
      • DataType: Record
      • Subtype: Warehouse Journal Line (7311)
    2. Add a local variable in the PostWhseJnlLine function in the Job Jnl.-Post Line codeunit (1012), and then specify the variable as follows:
      • Name: TempWarehouseJournalLine
      • DataType: TEMPORARY Record
      • Subtype: Warehouse Journal Line (7311)
    3. Add a local variable in the PostWhseJnlLine function in the Job Jnl.-Post Line codeunit (1012), and then specify the variable as follows:
      • Name: ItemTrackingManagement
      • DataType: Codeunit
      • Subtype: Item Tracking Management (6500)
    4. Add a local variable in the PostWhseJnlLine function in the Job Jnl.-Post Line codeunit (1012), and then specify the variable as follows:
      • Name: WMSManagement
      • DataType: Codeunit
      • Subtype: WMS Management (7302)
    5. Add a local variable in the PostWhseJnlLine function in the Job Jnl.-Post Line codeunit (1012), and then specify the variable as follows:
      • Name: WhseJnlRegisterLine
      • DataType: Codeunit
      • Subtype: Whse. Jnl.-Register Line (7301)
  17. Add the following code in the PostWhseJnlLine function in the Job Jnl.-Post Line codeunit (1012) as follows:
    WITH ItemJnlLine DO BEGIN
    IF "Entry Type" IN ["Entry Type"::Consumption,"Entry Type"::Output] THEN
    EXIT;
    Quantity := OriginalQuantity;
    "Quantity (Base)" := OriginalQuantityBase;
    GetLocation("Location Code");
    IF Location."Bin Mandatory" THEN
    IF WMSManagement.CreateWhseJnlLine(ItemJnlLine,0,WarehouseJournalLine,FALSE,FALSE) THEN BEGIN
    TempTrackingSpecification.MODIFYALL("Source Type",DATABASE::"Job Journal Line");
    ItemTrackingManagement.SplitWhseJnlLine(WarehouseJournalLine,TempWarehouseJournalLine,TempTrackingSpecification,FALSE);
    IF TempWarehouseJournalLine.FIND('-') THEN
    REPEAT
    WMSManagement.CheckWhseJnlLine(TempWarehouseJournalLine,1,0,FALSE);
    WhseJnlRegisterLine.RUN(TempWarehouseJournalLine);
    UNTIL TempWarehouseJournalLine.NEXT = 0;
    END;
    END;
  18. Add a new local variable in the Code function in the Job Jnl.-Post Line codeunit (1012), and then specify the variable as follows:
    • Name: TempTrackingSpecification
    • DataType: TEMPORARY Record
    • Subtype: Tracking Specification (336)
  19. Add a new local variable in the Code function in the Job Jnl.-Post Line codeunit (1012), and then specify the variable as follows:
    • Name: ItemJnlLine2
    • DataType: Record
    • Subtype: Item Journal Line (83)
  20. Change the code in the Code function in the Job Jnl.-Post Line codeunit (1012) as follow:
    Existing code 1
    ...
    ItemJnlLine.INIT;
    ItemJnlLine."Item No." := JobJnlLine2."No.";
    ...
    Replacement code 1
    ...
    ItemJnlLine.INIT;

    // Add the following line.
    ItemJnlLine."Line No." := "Line No.";

    ItemJnlLine."Item No." := JobJnlLine2."No.";
    ...
    Existing code 2
    ...
    ItemLedgEntry.LOCKTABLE;
    ItemJnlPostLine.RunWithCheck(ItemJnlLine,TempJnlLineDim);
    END;
    ...
    Replacement code 2
    ...
    ItemLedgEntry.LOCKTABLE;

    // Add the following line.
    ItemJnlLine2 := ItemJnlLine;

    ItemJnlPostLine.RunWithCheck(ItemJnlLine,TempJnlLineDim);

    // Add the following lines.
    ItemJnlPostLine.CollectTrackingSpecification(TempTrackingSpecification);
    PostWhseJnlLine(ItemJnlLine2,ItemJnlLine2.Quantity,ItemJnlLine2."Quantity (Base)",TempTrackingSpecification);
    // End of the lines.
    ...
  21. Change the value in the OptionString property of the Reference Document parameter in the GetSourceDocument function in the Whse. Management codeunit (5775) to the following:
    OptionString=,S. Order,S. Invoice,S. Credit Memo,S. Return Order,P. Order,P. Invoice,P. Credit Memo,P. Return Order,Inb. Transfer,Outb. Transfer,Prod. Consumption,Item Jnl.,Phys. Invt. Jnl.,Reclass. Jnl.,Consumption Jnl.,Output Jnl.,BOM Jnl.,Serv. Order,Job Jnl.
  22. Change the code in the GetSourceDocument function in the Whse. Management codeunit (5775) as follow:
    Existing code
    ...
    EXIT;
    END;
    END;
    ERROR(Text000);
    ...
    Replacement code
    ...
    EXIT;
    END;

    // Add the following lines.
    DATABASE::"Job Journal Line":
    BEGIN
    SourceDocument := SourceDocument::"Job Jnl.";
    EXIT;
    END;
    // End of the lines.

    END;
    ERROR(Text000);
    ...
  23. Change the code in the CreateWhseJnlLine function in the WMS Management codeunit (7302) as follow:
    Existing code
    ...
    WhseJnlLine."Source Line No." := "Line No.";
    END;
    WhseJnlLine."Source Code" := "Source Code";
    WhseJnlLine."Reason Code" := "Reason Code";
    WhseJnlLine."Registering No. Series" := "Posting No. Series";
    WhseJnlLine."Whse. Document Type" := WhseJnlLine."Whse. Document Type"::" ";

    // Delete the following line.
    WhseJnlLine."Reference Document" := WhseJnlLine."Reference Document"::"Item Journal";

    WhseJnlLine."Reference No." := "Document No.";
    ...
    Replacement code
    ...
    WhseJnlLine."Source Line No." := "Line No.";

    // Add the following lines.
    END ELSE
    IF "Job No." <> '' THEN BEGIN
    WhseJnlLine."Source Type" := DATABASE::"Job Journal Line";
    WhseJnlLine."Source Subtype" := ItemJnlTemplateType;
    WhseMgt.GetSourceDocument(WhseJnlLine."Source Document",WhseJnlLine."Source Type",WhseJnlLine."Source Subtype");
    WhseJnlLine."Source No." := "Document No.";
    WhseJnlLine."Source Line No." := "Line No.";
    // End of the lines.
    END;WhseJnlLine."Source Code" := "Source Code";
    WhseJnlLine."Reason Code" := "Reason Code";
    WhseJnlLine."Registering No. Series" := "Posting No. Series";
    WhseJnlLine."Whse. Document Type" := WhseJnlLine."Whse. Document Type"::" ";

    // Add the following lines.
    IF "Job No." = '' THEN
    WhseJnlLine."Reference Document" := WhseJnlLine."Reference Document"::"Item Journal"
    ELSE
    WhseJnlLine."Reference Document" := WhseJnlLine."Reference Document"::"Job Journal";
    // End of the lines.

    WhseJnlLine."Reference No." := "Document No.";
    ...ine."Source Code" := "Source Code";
    WhseJnlLine."Reason Code" := "Reason Code";
    WhseJnlLine."Registering No. Series" := "Posting No. Series";
    WhseJnlLine."Whse. Document Type" := WhseJnlLine."Whse. Document Type"::" ";

    // Add the following lines.
    IF "Job No." = '' THEN
    WhseJnlLine."Reference Document" := WhseJnlLine."Reference Document"::"Item Journal"
    ELSE
    WhseJnlLine."Reference Document" := WhseJnlLine."Reference Document"::"Job Journal";
    // End of the lines.

    WhseJnlLine."Reference No." := "Document No.";
    ...

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 (SP1)

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


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.

↑ Back to the top


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

↑ Back to the top

Article Info
Article ID : 2487667
Revision : 1
Created on : 1/7/2017
Published on : 9/7/2011
Exists online : False
Views : 305