Posting a Gen. Journal Line in a Code Unit

WaldoWaldo Member Posts: 3,412
edited 2003-01-22 in Navision Attain
I have problems posting a Gen. Journal Line through a Code Unit.

Here is my code:
WITH recGenJournalLine DO BEGIN
  recGenJournalLine.INIT;

  VALIDATE("Journal Template Name", 'DIVERSEN');
  VALIDATE("Journal Batch Name", 'WAARBORG');
  VALIDATE("Document Type", "Document Type"::Payment);
  VALIDATE("Posting Date", WORKDATE);
  VALIDATE("Document No.", '1');
  VALIDATE("Account Type", "Account Type"::"G/L Account");
  VALIDATE("Account No.",'449000');
  VALIDATE(Amount,60);
  VALIDATE("Bal. Account Type", "Bal. Account Type"::Customer);
  VALIDATE("Bal. Account No.",'10000');

  recGenJournalLine.INSERT(TRUE);

  CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post Line",recGenJournalLine);
END;

Altough I VALIDATE everything, it has problems with the Dimensions (I should select a dimension value code for the dimension code 'AREA' for customer '10000')

How can I fix this? :cry:

Eric Wauters
MVP - Microsoft Dynamics NAV
My blog

Comments

  • daliuskdaliusk Member Posts: 4
    It must work correctly only with global dimension 1 and 2. To post all dimensions correctly you must use:

    GenJnlPostLine.RunWithCheck(recGenJournalLine, TempJnlLineDim);

    TempJnlLineDim contains all dimension values.
  • WaldoWaldo Member Posts: 3,412
    Thanks for the reply!!

    Actually, all I needed to do was to insert the Line Nos myself, zo that the DimensionMgt could refer to those.

    stupid me ... :oops:

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
Sign In or Register to comment.