Hi,
I'm trying to insert lines into the general journal through code. My problem is that when the lines are inserted the Document No. is not set automatically (it is empty). What do i do to solve that?
Hi
Thanks for your reply
Erick: I'm using a processing only report.
Reijer:I've tried that but it's giving an error message due to the Onvalidate trigger code of "Balance Account No". this trigger code is called in the function
The Doc no is not always filled in Due to some entries require a manual number entry.
Help Says
If the No. Series field on the journal batch is filled in, the program automatically enters the next number in the series in this field. If the program does not automatically assigns the document number, you must redefine the number series in question.
So check that your Journal has a No series setup so it knows what to insert then add code to your routine to add Doc no from this number series.
** forget to mention your batch should have á balancing account in its setup to work
Thanks for your reply
The No. Series field is set on the Journal Batch
The Balancing Account field is set on the Journal Batch
When I use the SetupNewLine Function the Document No is filled according to the No Series on Journal Batch Ex:G00011. But when i try to post the journal lines the error message is : 'Document No must be G00010 in Gen. Journal Templte Name.....'
I used the debugger the error is due to the Code() function in Codeunit 13
The Line is: TESTFIELD("Document No.",NoSeriesMgt.GetNextNo(GenJnlBatch."No. Series","Posting Date",FALSE));
Comments
What type of code are you using? DataPorts, XMLPorts or?
Erik P. Ernst - Microsoft MVP - Dynamics NAV
Dynamics User Group
Take a look at the function SetUpNewLine in the "Gen. Journal Line" table.
You can use this function to get a new "Document No".
Regards,
Reijer
Object Manager
Thanks for your reply
Erick: I'm using a processing only report.
Reijer:I've tried that but it's giving an error message due to the Onvalidate trigger code of "Balance Account No". this trigger code is called in the function
Help Says
If the No. Series field on the journal batch is filled in, the program automatically enters the next number in the series in this field. If the program does not automatically assigns the document number, you must redefine the number series in question.
So check that your Journal has a No series setup so it knows what to insert then add code to your routine to add Doc no from this number series.
** forget to mention your batch should have á balancing account in its setup to work
That could be your solution
What is the errormessage?
Object Manager
The No. Series field is set on the Journal Batch
The Balancing Account field is set on the Journal Batch
When I use the SetupNewLine Function the Document No is filled according to the No Series on Journal Batch Ex:G00011. But when i try to post the journal lines the error message is : 'Document No must be G00010 in Gen. Journal Templte Name.....'
I used the debugger the error is due to the Code() function in Codeunit 13
The Line is: TESTFIELD("Document No.",NoSeriesMgt.GetNextNo(GenJnlBatch."No. Series","Posting Date",FALSE));