Hi all I have written a report to automatically register some lines through the General Ledger. As a safety measure, before doing any job, the report checks that the G/L Journal Batch is empty. And here comes the problem. After registering, the report leaves behind an almost empty (just Posting Date and Document Nº are filled) record. So, second time you run it, it fails. I’ve added some logic to perform a cleanup to try to delete it, to no avail. When I contacted my Navision consultant, she could run the report without any trouble (she runs a local copy of our prod. server), so I suspect there is a problem with our testing machine. With all this happening, I don’t dare to put the report into production. So I don’t know whether the report would run fine on it. Any ideas? Santiago
perhaps you set a ‘Repeating Time’ ?
It’s standard Navision behaviour to leave an “empty” record in the General Journal after posting. You can either delete this record or make sure you overwrite it from your report. If you chose to delete it, the code might look like this: GenJournalLine.RESET; GenJournalLine.SETRANGE("Journal Template Name", GenJnlBatch."Journal Template Name"); GenJournalLine.SETRANGE("Journal Batch Name", GenJnlBatch.Name); IF (GenJournalLine.COUNT > 1) THEN ERROR('General Journal must be empty.') ELSE IF GenJournalLine.FIND('-') THEN BEGIN IF (GenJournalLine."Account No." <> '') OR (GenJournalLine.Amount <> 0) THEN ERROR(General Journal must be empty.) ELSE GenJournalLine.DELETE; END;
quote:
Originally posted by Steffen Voel
It’s standard Navision behaviour to leave an “empty” record in the General Journal after posting. You can either delete this record or make sure you overwrite it from your report.
Actually, I cleanup the General Journal in the OnPostRecord event, but the record “somehow” remains there. Anyway, if I understand it correctly, you suggest that instead of cleaning up after execution, I test and clean before running, isn’t it? What puzzles me most is that the report runs fine (no garbage left behind) in my consultant’s testing machine, but not on MY testing machine. TIA
quote:
Originally posted by iammicky
perhaps you set a ‘Repeating Time’ ?
Sorry if this is a dumb question but, what do you mean by “Repeating Time”? TIA