Item Journal Problem

lloydflloydf Member Posts: 73
I have a problem while posting a negative adjustment Item Journal in Navision 3.7.
I have created a dataport to populate the Item Journal Line table.
I am populating the following fields:

Line No.
Journal Template Name
Journal Batch Name
Document No.
Posting Date
Entry Type
Item No.
Lot No.
Quantity
Unit of Measure Code


When I try and post the Journal I am getting an error: "Tracking Specification Is missing"

Any help would be appreciated!

Comments

  • SavatageSavatage Member Posts: 7,142
    if I do something like this - first I import 1 line using the dataport.
    Then a Manually enter a line underneath it.

    I go to the table and compare the two to see all the fields that the manual entry fills is also being filled when using the dataport.

    If not then there are some validates missing (usually)
  • kinekine Member Posts: 12,562
    lloydf wrote:
    I have a problem while posting a negative adjustment Item Journal in Navision 3.7.
    I have created a dataport to populate the Item Journal Line table.
    I am populating the following fields:

    Line No.
    Journal Template Name
    Journal Batch Name
    Document No.
    Posting Date
    Entry Type
    Item No.
    Lot No.
    Quantity
    Unit of Measure Code


    When I try and post the Journal I am getting an error: "Tracking Specification Is missing"

    Any help would be appreciated!

    Problem is, that the field "Lot No. " is just for internal use. You cannot post a line with filled this field. You need to use the Reservation entry table to add the tracking or use another functionality to post the line. Posting line with tracking is much harder than without it.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • lloydflloydf Member Posts: 73
    I need to do a negative adjustment for items with multiple lot numbers. My import file contains the journal entry lines I require to do this, including the Lot No.
    There are around 500 lines in my import file so doing this manually will take for ever. Is there any way I can do this by using dataports?
    Or programatically?
    Thanks
  • kinekine Member Posts: 12,562
    Of course, you can do it through code. But in this case just filling the ItemJnlLine is not enough. You really need to insert the line into database, connect correct reservation entry with the Lot No. or Ser. No. and post this line. I have not found easy way how to post not inserted Item Jnl line with tracking without writing the data into DB before posting... (simulating post of whole batch). There is no simple function for that in the posting codeunit... :cry:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ara3nara3n Member Posts: 9,256
    Hello

    Before posting the item journal call the following function
    CreateReservEntry.SetDates(
      0D, 0D);
    
    CreateReservEntry.CreateReservEntryFor(
      DATABASE::"Item Journal Line",
      ItemJnlLine."Entry Type",
      ItemJnlLine."Journal Template Name",
      ItemJnlLine."Journal Batch Name",
      0,
      ItemJnlLine."Line No.",
      ItemJnlLine."Qty. per Unit of Measure",
      1,
      '',
      'Lot No Put it here!!!');
    
    CreateReservEntry.CreateEntry(
      ItemJnlLine."Item No.",
      ItemJnlLine."Variant Code",
      ItemJnlLine."Location Code",
      ItemJnlLine.Description,
      ItemJnlLine."Posting Date",
      ItemJnlLine."Document Date",
      0,
      2); 
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • lloydflloydf Member Posts: 73
    Rashed
    Please forgive my confusion.
    Where exactly should I call the function? Should I call it on the OnAfterImportRecord of the dataport or the onPush trigger on the Post button?

    thanks

    LLoyd
  • ara3nara3n Member Posts: 9,256
    OnAfterImportRecord of the dataport.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • lloydflloydf Member Posts: 73
    Hi Rashed
    Thanks for getting back to me. I think I am nearly there however I am getting the following error when posting the Item Journal..

    Item Tracking Serial No. Lot No, 42519 for Item No. 1010025 Variant cannot be fully applied.

    The only difference I made to the code was to change the call to the CreateReservEntry function so that I added the actual Quantity instead of the hardcoded quantity of "1"

    My code..

    CreateReservEntry.SetDates(0D, 0D);

    CreateReservEntry.CreateReservEntryFor(
    DATABASE::"Item Journal Line",
    "Item Journal Line"."Entry Type",
    "Item Journal Line"."Journal Template Name",
    "Item Journal Line"."Journal Batch Name",
    0,
    "Item Journal Line"."Line No.",
    "Item Journal Line"."Qty. per Unit of Measure",

    "Item Journal Line".Quantity,

    '', "Item Journal Line"."Lot No.");

    CreateReservEntry.CreateEntry(
    "Item Journal Line"."Item No.",
    "Item Journal Line"."Variant Code",
    "Item Journal Line"."Location Code",
    "Item Journal Line".Description,
    "Item Journal Line"."Posting Date",
    "Item Journal Line"."Document Date",
    0,
    2);
  • ara3nara3n Member Posts: 9,256
    Are you making any negative adjustment in your journal?
    That's why you would get the error, because it cannot find it in inventory.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • lloydflloydf Member Posts: 73
    Yes this Journal is solely ding negative adjustments
  • ara3nara3n Member Posts: 9,256
    Then it means the item is not in inventory for that lot for that quantity.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • lloydflloydf Member Posts: 73
    Rashed
    Thanks you that worked perfectly. Can I use this functionality for possitive adjustments?
  • ara3nara3n Member Posts: 9,256
    Yes you can use it for any entry type. Notice in the function CreateReservEntryFor you are passing "Item Journal Line"."Entry Type"
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • lloydflloydf Member Posts: 73
    Thanks Rashed
    I am experiencing a problem while trying to run my dataport for a Positive adjustment in that I am getting the following error:

    Qty. per Unit of Measure must not be 0 in Item Journal Line Journal Template Name='ITEM' Journal Batch Name='DEFAULT, Line No.='1'

    I am running the following VALIDATE functions onAfterImportRecord which seem to be causing the problem:

    "Item Journal Line".VALIDATE("Item No.");
    "Item Journal Line".VALIDATE("Item Journal Line"."Entry Type");
    "Item Journal Line".VALIDATE("Item Journal Line".Quantity);
  • ara3nara3n Member Posts: 9,256
    Can you tell me what the callstack is?

    to see the callstack, turn on debugger active, and uncheck break on trigger.


    When the error happens the debugger will start and stop at the error.
    You will see one of the button on menu called callstack and inside you'll see the lines.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • lloydflloydf Member Posts: 73
    Rashed See callstack below

    GLSetup <Uninitialised>
    Item <Uninitialised>
    SKU <Uninitialised>
    Vend <Uninitialised>
    ResCost <Uninitialised>
    Currency <Uninitialised>
    TempPurchPrice <Uninitialised>
    TempPurchLineDisc <Uninitialised>
    ResFindUnitCost <Uninitialised>
    LineDiscPerCent <Uninitialised>
    Qty 0
    QtyPerUOM 0
    VATPerCent 0
    PricesInclVAT No
    VATBusPostingGr ""
    PricesInCurrency No
    PriceInSKU No
    CurrencyFactor 0
    ExchRateDate ""
    FoundPurchPrice No
    DateCaption ""
    ItemJnlLine <Uninitialised>
    CalldByFieldNo 0x00000003
  • ara3nara3n Member Posts: 9,256
    That is the variable window. Callstack has the list on how the codeunites were triggered and how it arrived at the error. It's another window.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • lloydflloydf Member Posts: 73
    Sorry about that!
    Hopfully this is it.

    Codeunit 7010 Purch. Price Calc. Mgt.\FindItemJnlLinePrice(ItemJnlLine,CalledByFieldNo)
    Table 83 Item Journal Line\Item No. - OnValidate()
    Dataport 50004 Item Pos Adjustment\Item Journal Line - OnAfterImportRecord()
  • ara3nara3n Member Posts: 9,256
    What entry type are you entering?
    If it's sales or purchase, make sure On the Item card
    "Purch. Unit of Measure"
    "Sales Unit of Measure"

    are set to a value.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.