Dimensions

Hi everybody. I’m trying to write a procedure that inserts several lines into the General Journal. The problem is I can’t get the dimension thing work right. What I’m doing is this:


IF GenJnlLine.INSERT THEN BEGIN
   DefaultDim.RESET;
   DefaultDim.SETRANGE("Table ID", DATABASE::Vendor);
   DefaultDim.SETRANGE("No.", Vendor."No.");
   IF DefaultDim.FIND('-') THEN
    REPEAT
     JnlLineDim.INIT;
     JnlLineDim."Table ID"              := DATABASE::"Gen. Journal Line";
     JnlLineDim."Journal Template Name" := GenJnlLine."Journal Template Name";
     JnlLineDim."Journal Batch Name"    := GenJnlLine."Journal Batch Name";
     JnlLineDim."Journal Line No."      := GenJnlLine."Line No.";
     JnlLineDim."Dimension Code"        := DefaultDim."Dimension Code";
     JnlLineDim."Dimension Value Code"  := DefaultDim."Dimension Value Code";
     JnlLineDim.INSERT;
   UNTIL DefaultDim.NEXT = 0;
END;

The procedure inserts the lines all right, and you can see the dimensions attached to each line (Shift + Ctrl +D), but when I post the lines, there’s no dimensions attached to the posted lines. What am I doing wrong? And how can I fix it?

Hi, Perhaps this will help? JnlLineDim.VALIDATE(“Dimension Code”, DefaultDim.“Dimension.Code”); JnlLineDim.VALIDATE(“Dimension Value Code”, DefaultDim.“Dimension Value Code”); JnlLineDim.INSERT(TRUE);