Line No. in Journal

Hello, I designed add-on for posting some items based on Attain principles (journal template, batch, lines, ledger. + Codeunits: check line, post line, post batch etc.). It really works but there’s a problem with Line No. field in journal table. When the line is being posted to the ledger there’s a message: “There’s nothing to post” but lines are posted ok. If we look on the code, we’ll see: IF “Line No.” = 0 THEN MESSAGE(Text002) //Text002=There’s nothing to post That means that my code works wrong with journal lines numbers. Please, if you have any experience with Navision Attain posting routines, tell me something about journal lines behaviour and how should it work. Thank you.

In the Navision Posting routines, the Post Batch is meant to run against a set of records. If there are no records passed to this routine, then it sets line no. = 0 to let the calling routine know that nothing was processed. In general, the Post routine calls the Post Batch routine which calls the Post Line routine. The error you are talking about occurs in the Post routine. You might want to make sure you are using Line numbers. If you are posting a number of lines from a form, you want to call the Post routine. If you are just posting one line through code, the you want to call the Post Line routine directly. Hope this makes sense. Chris.

We have written similar front-ends to the Attain posting routines. We found that the best way to work out what you should write to the journal batch and line tables, is to enter journals manually (using the standard Navision menu options), then see with Tools/Zoom or Run/Table, what has been created. Make your program fill in the same fields. We are having problems with running these front-ends and posts in a multi-user environment. The standard posting routines seem to run serially, and the users are waiting a lot in the factory. You can also get an error from the standard posting routine saying that the Document Number you have used (next one from the number series) is wrong. Do you have any experience of this?

Please check how you do handle the line No. in your code. These line No. are populated automatically when user enters records in the Journal forms because the form propertu AutoSplitKey is set to yes.

Just for example REPEAT; lrec_ItemJournalLine.INIT; lrec_ItemJournalLine.VALIDATE(lrec_ItemJournalLine.“Journal Template Name”,‘TRANSFER’); lrec_ItemJournalLine.VALIDATE(lrec_ItemJournalLine.“Journal Batch Name”,‘DEFAULT’); lrec_ItemJournalLine.VALIDATE(lrec_ItemJournalLine.“Posting Date”,TODAY); COMMIT; lrec_ItemJnlBatch.GET(lrec_ItemJournalLine.“Journal Template Name”,lrec_ItemJournalLine.“Journal Batch Name”); lrec_ItemJournalLine.“Document No.”:=lcu_NoSeriesMgt.TryGetNextNo(lrec_ItemJnlBatch.“No. Series”, lrec_ItemJournalLine.“Posting Date”); lint_LineNo:=lint_LineNo+10000; lrec_ItemJournalLine.“Line No.”:=lint_LineNo; until …