Item Journal Line Dimensions

Toddy_BoyToddy_Boy Member Posts: 231
There are two short dimension codes 4 OVEN and 5 OPERATIVE which are assigned to an item journal line. The codes are validated as such where Rec is "Item Journal Line"

Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]);
Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]);

The values returned into the dimension code array are perfectly valid as I can see in the debugger, however only the OPERATIVE (dimension code 5) is actually written to the Ledger Entry Dimension table when posting the journal line. The OVEN code is ignored :-k

Is there something that tells Navision to write the value of a dimension code to the Ledger Entry Dimension table or could I be looking in the wrong place for the other dimension code? ](*,) ](*,) ](*,)

Cheers
Life is for enjoying ... if you find yourself frowning you're doing something wrong

Comments

  • ara3nara3n Member Posts: 9,256
    Could you pate the code on how you are populating the journal line and how you are posting it. Calling Cu 22.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Toddy_BoyToddy_Boy Member Posts: 231
    Here you go
    ProdOrderLine.SETRANGE("Prod. Order No.", OrderNo);
    ProdOrderLine.SETRANGE("Item No.", No);
    
    IF ProdOrderLine.FINDSET(FALSE, FALSE) THEN BEGIN
      // create a journal line
      Rec.SetUpNewLine(xRec);
      Rec.VALIDATE("Line No.",10000);         //CP002
      Rec.VALIDATE("Entry Type","Entry Type"::Output);
      Rec.VALIDATE("Prod. Order No.", OrderNo);
      Rec.INSERT(TRUE);
      Rec.VALIDATE("Item No.", "CP General Procs".RoutingLineItem(OrderNo,No,OperationNo));
      Rec.VALIDATE("Operation No.", OperationNo);
      Rec.VALIDATE("Output Quantity", OutputQuantity);
      Rec."Prod. Order Line No." := ProdOrderLine."Line No.";
    
      Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]);
      Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]);
    
      Rec.Finished := JobFinished;
      Rec.MODIFY(TRUE);
    
      ClearDown();
      CurrForm.txtBarCodeID.ACTIVATE();
    
    END ELSE
      ERROR('Cannot find the Item %1 in Production Order %2.',No, OrderNo);
    
    [/code]
    Life is for enjoying ... if you find yourself frowning you're doing something wrong
  • ara3nara3n Member Posts: 9,256
    This is an example code I did based on yours and it works.
    xItemJnlLine.GET('ITEM','DEFAULT',10000);
    
    ItemJnlLine."Journal Template Name" := 'item';
    ItemJnlLine."Journal Batch Name" := 'DEFAULT';
    ItemJnlLine.VALIDATE("Line No.",20000);         //CP002
    ItemJnlLine.VALIDATE("Entry Type",ItemJnlLine."Entry Type"::Output);
    ItemJnlLine.INSERT(TRUE);
    ItemJnlLine.SetUpNewLine(xItemJnlLine);
    ShortcutDimCode[5] := 'HOME';
    ShortcutDimCode[4] := '70';
    ItemJnlLine.ValidateShortcutDimCode(5, ShortcutDimCode[5]);
    ItemJnlLine.ValidateShortcutDimCode(4, ShortcutDimCode[4]);
    ItemJnlLine.MODIFY(TRUE);
    

    Make sure you change your sequence of code based on above sample and make sure shortcutdimcode is populated.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Toddy_BoyToddy_Boy Member Posts: 231
    Thanks for the reply but I'm still having trouble

    I get an error 'There is nothing to post', I have reapplied various lines to get the output quantity (did I mention I'm trying to perform an Output Journal :-k ), then the production order number, operation number and item number (I seem to be back at square one with the code) but still no dimension 4 (OVENS) appearing in the Ledger Entry Dimension - is this the correct table to be looking in.

    I am using CU 22 to post the journal line.

    I have tried to do a standard output journal and that is NOT storing the OVENS dimension code. Which leads me to believe something is not set up correctly with this dimension. Any ideas where I can check?
    [/b]
    Life is for enjoying ... if you find yourself frowning you're doing something wrong
  • ara3nara3n Member Posts: 9,256
    How are you calling CU 22. I don't see the code, you need to call it

    CU22.runwithcheck(ItemJournal,JournalDim);

    JournalDim would be your dimension,

    Also you do not need to insert the Item Journal.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Toddy_BoyToddy_Boy Member Posts: 231
    What about the fact the dimension code 4 doesn't post when using the default screen?
    CU 22 is called by CODEUNIT.RUN(CODEUNIT::"Item Jnl.-Post",Rec);
    

    Would I call CU22.runwithcheck(ItemJournal,JournalDim); instead of the code above
    Life is for enjoying ... if you find yourself frowning you're doing something wrong
  • ara3nara3n Member Posts: 9,256
    Yes, you need to call run with check and pass the Dimension.
    Also you do not need to insert or modify the Item Journal you are creating. So comment those out. Create a temporary JournalDim record variable and populate it with dimensions and pass it to runwithcheck
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Toddy_BoyToddy_Boy Member Posts: 231
    Hi Ara3n thanks for your continued help but not quite there yet.

    This has had a little extra work done because I was getting invalid production routing line but it is essentially the same as the sample code you provided. Instead of one problem I now have 2 problems

    The OPERATIVES dimension 5 now posts a blank value
    The OVENS dimension 4 still does not post at all - no value, no code, no entry in the Ledger Entry Dimension table, nothing.

    ](*,) ](*,)
      IF xItemJnlLine.GET('OUTPUT','CNC1',10000) THEN ;
      ItemJnlLine.INIT;
      ItemJnlLine."Journal Template Name" := 'OUTPUT';
      ItemJnlLine."Journal Batch Name" := CurrentJnlBatchName;
      ItemJnlMgt.SetName(CurrentJnlBatchName,ItemJnlLine);
      ItemJnlLine.SetUpNewLine(xItemJnlLine);
      ItemJnlLine.VALIDATE("Line No.",100000);
      ItemJnlLine.VALIDATE("Entry Type", ItemJnlLine."Entry Type"::Output);
      ItemJnlLine.VALIDATE("Prod. Order No.", OrderNo);
      ItemJnlMgt.GetOutput(ItemJnlLine,ProdOrderDescription,OperationName);
      ItemJnlLine.VALIDATE("Item No.", "CP General Procs".RoutingLineItem(OrderNo,No,OperationNo));
      ItemJnlMgt.OnAfterInputItemNo(No);
      ItemJnlLine.VALIDATE("Operation No.", OperationNo);
      ItemJnlMgt.GetOutput(ItemJnlLine,ProdOrderDescription,OperationName);
      ItemJnlLine.VALIDATE("Output Quantity", OutputQuantity);
      ItemJnlLine.ValidateShortcutDimCode(5, ShortcutDimCode[5]);
      ItemJnlLine.ValidateShortcutDimCode(4, ShortcutDimCode[4]);
      ItemJnlLine.Finished := JobFinished;
    
      JournalDimension.RESET;
      JournalDimension.DELETEALL;
    
      JournalDimension.INIT;
      JournalDimension."Table ID" := 83;
      JournalDimension."Journal Template Name" := 'OUTPUT';
      JournalDimension."Journal Batch Name" := CurrentJnlBatchName;
      JournalDimension."Journal Line No." := ItemJnlLine."Line No.";
      JournalDimension."Dimension Code" := 'OVENS';
      JournalDimension."New Dimension Value Code" := ShortcutDimCode[4];
      JournalDimension.INSERT;
    
      JournalDimension.INIT;
      JournalDimension."Table ID" := 83;
      JournalDimension."Journal Template Name" := 'OUTPUT';
      JournalDimension."Journal Batch Name" := CurrentJnlBatchName;
      JournalDimension."Journal Line No." := ItemJnlLine."Line No.";
      JournalDimension."Dimension Code" := 'OPERATIVES';
      JournalDimension."New Dimension Value Code" := ShortcutDimCode[5];
      JournalDimension.INSERT;
    
      "Item Jnl.-Post Line".RunWithCheck(ItemJnlLine,JournalDimension);
    
    ]
    Life is for enjoying ... if you find yourself frowning you're doing something wrong
  • ar4ijsar4ijs Member Posts: 24
    I don't see where do you assign values to ShortcutDimCode[5] and ShortcutDimCode[4]? :-k
  • JedrzejTJedrzejT Member Posts: 267
    I use
    JournalDimension."Dimension Value Code" := ShortcutDimCode[4];
    instead of
    JournalDimension."New Dimension Value Code" := ShortcutDimCode[4];

    Regards
  • Toddy_BoyToddy_Boy Member Posts: 231
    Guys thanks for the suggestion but still no further along. :(

    ar4ijs - The ShortcutDimCode[4] and ShortcutDimCode[5] are global variables assigned on a card

    JedrzejT - no change

    I'm still confused why the dimension code 4 will not post through the standard Output Journal card 99000823. Can anyone shed some light on why this would not happen?

    Do all dimensions post to the Ledger Entry Dimension table? :-k
    Life is for enjoying ... if you find yourself frowning you're doing something wrong
  • ar4ijsar4ijs Member Posts: 24
    Few more tips:
    1. Remove
    ItemJnlLine.ValidateShortcutDimCode(5, ShortcutDimCode[5]); 
      ItemJnlLine.ValidateShortcutDimCode(4, ShortcutDimCode[4]);
    
    2. Put ItemJnlLine.INSERT(TRUE); before inserting dims.

    3. Use JournalDimension."Dimension Value Code" instead of JournalDimension."New Dimension Value Code", and try to insert it with TRUE.
  • Toddy_BoyToddy_Boy Member Posts: 231
    Close but no cigar.

    The OPERATIVES dimension 5 populates but the OVENS dimension does not appear in the Ledger Entry Dimension table. I think this is either a bug or a setup issue as previously in this post I mentioned this does not work from the default card.

    Any ideas where I can check if it is a setup issue?

    I am using UK Dynamics NAV 5 if thats any help.[/b]
    Life is for enjoying ... if you find yourself frowning you're doing something wrong
  • ar4ijsar4ijs Member Posts: 24
    It must work. If you send me the .fob to msn e-mail, I will take a closer look :shock: .
Sign In or Register to comment.