IF Rec.FINDFIRST THEN;
REPEAT
JournalLine.INIT;
JournalLine."Journal Template Name":='TEMP1';
JournalLine.VALIDATE("Journal Template Name");
JournalLine."Journal Batch Name" := 'TEMPBATCH';
JournalLine.VALIDATE("Journal Batch Name");
JournalLine."Account Type":= 0;
JournalLine.VALIDATE("Account Type");
JournalLine."Account No.":="G/L Account No.";
JournalLine.VALIDATE("Account No.");
JournalLine."Posting Date":= "Posting Date";
JournalLine.VALIDATE("Posting Date");
JournalLine."Credit Amount":=Amount;
JournalLine.VALIDATE("Credit Amount");
JournalLine."Bal. Account Type" := 3;
JournalLine.VALIDATE("Bal. Account Type");
JournalLine."Bal. Account No." := BankAccount."No.";
JournalLine.VALIDATE("Bal. Account No.");
JournalLine.INSERT;
UNTIL Rec.NEXT = 0;
Answers
you have to insert line no for each record like..
GenJnlLine."Line No." := GenJnlLine."Line No." + 10000;
because line no is also part of PK..
Vijay Gupta
Thanks Vijay.
This is a MUST KNOW for all developers...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.