Options

problem with Document No. in general journal

yekedeyekede Member Posts: 96
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?

Comments

  • Options
    epernstepernst Member Posts: 20
    Hi Yekede,
    What type of code are you using? DataPorts, XMLPorts or?
    Best regards,
    Erik P. Ernst - Microsoft MVP - Dynamics NAV
    Dynamics User Group
  • Options
    reijermolenaarreijermolenaar Member Posts: 256
    Hi Yekede,

    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
    Reijer Molenaar
    Object Manager
  • Options
    yekedeyekede Member Posts: 96
    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
  • Options
    jannestigjannestig Member Posts: 999
    edited 2009-06-30
    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

    That could be your solution
  • Options
    reijermolenaarreijermolenaar Member Posts: 256
    Is the "Bal. Account No." valid in you "Gen. Journal Batch"?
    What is the errormessage?
    Reijer Molenaar
    Object Manager
  • Options
    yekedeyekede Member Posts: 96
    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));
Sign In or Register to comment.