Posting Purchase Invoice on Job with Analytical Dimension

DidimitchDidimitch Member Posts: 6
Hello,

I am working on Standard NAV 5 (CH version)
I have the following situation:

I set up a job (JJJ) with one Dimension (DDD), one dimension value (VVV) and I put "same code" on the validation tab.

Then I open a Purchase Invoice, specify the job JJJ in the line and I fill the dimension with the same dimension code (XXX) I put above.

When I post the invoice I get this message :
"Select Dimension value Code XXX for the Dimension Code AAA for Job JJJ"

I have checked to see where the poblem is and it seems that the job journal line created from the purchase line has no Dimension set...

Has anyone had the same problem and fixed it ?

Thank you in advance

Comments

  • PureHeartPureHeart Member Posts: 190
    Yes they have forgotten with the new versions of codeunit to get even the dimensions...no comment...i'm fixing it now...just realize yesterday while trying to post an purch. inv. with job and dimensions!
    did you already fix that?
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • PureHeartPureHeart Member Posts: 190
    Ok...just fixed it, you need to add code in codeunit 90 to copy from document dimension to Journal Line Dimension and not as it is from Journal Line Dimension to Journal Line Dimension then in codeunit 1004 add the global 1 and 2 shortcut when the job journal line is created!
    e tutto funziona!
    bye
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • chrisdfchrisdf Member Posts: 82
    Here is the code fix supplied by Microsoft support - they say it will be included in 5.1 service pack. Hope this helps anyone with the same problem.

    Codeuni 90 -
    PROCEDURE OnRun()
    Deleted VAR: TempJnlLineDim2@1021 : TEMPORARY Record 356;

    CASE PurchLine.Type OF
    PurchLine.Type::"G/L Account":
    IF (PurchLine."No." <> '') AND NOT PurchLine."System Created Entry" THEN BEGIN
    GLAcc.GET(PurchLine."No.");
    GLAcc.TESTFIELD("Direct Posting");
    //Old Code Begin
    TempJnlLineDim2.RESET;
    TempJnlLineDim2.DELETEALL;
    DimMgt.CopyJnlLineDimToJnlLineDim (TempJnlLineDim,TempJnlLineDim2);
    IF PurchLine."Job No." <> '' THEN
    JobPostLine.InsertPurchLine(PurchHeader,PurchInvHeader,PurchCrMemoHeader,JobPurchLine,SrcCode,TempJnlLineDim2);
    //Old Code End
    ...

    CASE PurchLine.Type OF
    PurchLine.Type::"G/L Account":
    IF (PurchLine."No." <> '') AND NOT PurchLine."System Created Entry" THEN BEGIN
    GLAcc.GET(PurchLine."No.");
    GLAcc.TESTFIELD("Direct Posting");
    //New code begin
    IF PurchLine."Job No." <> '' THEN BEGIN
    TempDocDim.RESET;
    TempDocDim.SETRANGE("Table ID",DATABASE::"Purchase Line");
    TempDocDim.SETRANGE("Line No.",PurchLine."Line No.");
    DimMgt.CopyDocDimToJnlLineDim(TempDocDim,TempJnlLineDim);
    JobPostLine.InsertPurchLine(PurchHeader,PurchInvHeader,PurchCrMemoHeader,JobPurchLine,SrcCode,TempJnlLineDim);
    END;
    New Code end
    ...
    PROCEDURE PostItemJnlLine@2(PurchLine@1000 : Record 39;QtyToBeReceived@1001 : Decimal;QtyToBeReceivedBase@1002 : Decimal;QtyToBeInvoiced@1003 : Decimal;QtyToBeInvoicedBase@1004 : Decimal;ItemLedgShptEntryNo@1005 : Integer;ItemChargeNo@1006 : Code[20];TrackingSpecification@1010 : Record 336) : Integer;

    Deleted local VAR: TempJnlLineDim2@1021 : TEMPORARY Record 356;
    Added Global VAR: TempJnlLineDim:TEMPORARY Record 356;

    //Old Code Begin

    TempDocDim.RESET;
    TempDocDim.SETRANGE("Table ID",DATABASE::"Purchase Line");
    TempDocDim.SETRANGE("Line No.","Line No.");
    DimMgt.CopyDocDimToJnlLineDim(TempDocDim,TempJnlLineDim);
    OriginalItemJnlLine := ItemJnlLine;

    TempJnlLineDim2.RESET;//deleted line
    TempJnlLineDim2.DELETEALL;//deleted line
    DimMgt.CopyJnlLineDimToJnlLineDim(TempJnlLineDim,TempJnlLineDim2);//deleted line
    ItemJnlPostLine.RunWithCheck(ItemJnlLine,TempJnlLineDim);
    ...
    //Old code end

    //New code begin
    ...
    TempDocDim.RESET;
    TempDocDim.SETRANGE("Table ID",DATABASE::"Purchase Line");
    TempDocDim.SETRANGE("Line No.","Line No.");
    DimMgt.CopyDocDimToJnlLineDim(TempDocDim,TempJnlLineDim);
    OriginalItemJnlLine := ItemJnlLine;

    ItemJnlPostLine.RunWithCheck(ItemJnlLine,TempJnlLineDim);
    ...
    //New Code end

    //Old Code Begin
    ...
    JobPostLine.GetStartItemLedgEntryNo;
    ItemJnlPostLine.RunWithCheck(ItemJnlLine2,TempJnlLineDim);
    JobPostLine.InsertPurchLine(PurchHeader,PurchInvHeader,PurchCrMemoHeader,PurchLine,SrcCode,TempJnlLineDim2);//deleted line
    END;
    ...
    //Old code end

    //New Code begin

    ...
    JobPostLine.GetStartItemLedgEntryNo;
    ItemJnlPostLine.RunWithCheck(ItemJnlLine2,TempJnlLineDim);
    JobPostLine.InsertPurchLine(PurchHeader,PurchInvHeader,PurchCrMemoHeader,PurchLine,SrcCode,TempJnlLineDim); //added line
    END;
    ...
    //New Code end
  • borjaghborjagh Member Posts: 19
    Hello,

    I had the same problem, chrisdf, and applied the code you have told us.
    The problem of "Same Code" dimension value is fixed, but now I have another problem:

    The problem is when I try to Post an order with more than one line, with the same "Job No." and "Job Task No." .

    You can test it and see the error it occurs:

    when it's processing the second line ... we obtain the error:

    "The journal line dimension already exists.
    Identification field and values:
    Table Id='39',Journal Template Name='',Journal Batch Name='',Journal Line No.='0',Dimension Code='DEPARTMENT'

    Am I missing anything?

    Thank you in advance
  • cfvcfv Member Posts: 19
    Hello,
    I've got the same problem as borjagh and i don't know how to solve it.
    Did anybody find a solution ?
    Thank you
  • jannestigjannestig Member Posts: 1,000
    What version of NAV are you using.

    Can you explain your particular scenario more as well
Sign In or Register to comment.