Generate Document No In Gen Journal Lines 81

Hi

Gen. Journal Line - OnAfterImportRecord()

"Journal Template Name":='GENERAL';
"Journal Batch Name":='TEST';
"Source Code":='GENJNL';
"Posting No. Series":='JV';
"Line No.":="LineNo."+1000;

Below is the Data. I want if 2 rows no is same then same Document No should be generated . For e.g 2&3 in below case. Is it possible or Document No generated is different for each row.

08.06.2017 Invoice 1 Vendor V000001
08.06.2017 Invoice 2 Vendor V000001
08.06.2017 Invoice 2 Vendor V000001
08.06.2017 Invoice 3 Vendor V000002
08.06.2017 Invoice 3 Vendor V000002
08.06.2017 Invoice 4 Vendor V000003

Thanks

Answers

  • ErictPErictP Posts: 156Member
    In my case the Invoicenumber is transfered to the field "External Document No."
    In the next lines this field is checked.
      IF GenJnlBatch."No. Series" <> '' THEN BEGIN
        GenJnlLine.RESET;
        GenJnlLine.SETRANGE("Journal Template Name","Journal Template Name");
        GenJnlLine.SETRANGE("Journal Batch Name","Journal Batch Name");
        GenJnlLine.SETRANGE("External Document No.", "Invoice No.");
        IF NOT GenJnlLine.FINDFIRST THEN
          DocumentNo := NoSeriesMgt.GetNextNo(GenJnlBatch."No. Series", "Posting Date",FALSE);
        ELSE
          DocumentNo := GenJnlLine."Document No.";
    
  • jsshivalikjsshivalik Posts: 43Member
    edited 2018-03-13
    Hi

    This code should be written under which Trigger. In the above code Document No will be Generated before Post. Can Vendor have same External Document No for more han 1 record.

    I am Uploading Data for Gen Journal Lines table 81.

    What is GenJnlBatch."No. Series"

    Thanks
  • ErictPErictP Posts: 156Member
    Trigger is OnAfterImportRecord.
    If PurchSetup."Ext. Doc. No. Mandatory" = FALSE then the vendor can have multiple times the same "External Document No."

    In your case the GenJnlBatch."No. Series" is the same as "Posting No. Series":='JV';
  • jsshivalikjsshivalik Posts: 43Member
    edited 2018-03-13
    Hi

    I have written like this . Is it ok It is generation Document no for each line

    "Journal Template Name":='GENERAL';
    "Journal Batch Name":='test';
    "Posting No. Series":='JV';
    "Line No.":=GetLineNumber;
    "Document No.":= NoSeriesMgt.GetNextNo("Posting No. Series", "Posting Date",FALSE);

    How does this works
    NoSeriesMgt.GetNextNo("Posting No. Series", "Posting Date",FALSE);

    Can u pls help according to my data . What changes i need to do in above code
    08.06.2017 Invoice 1 Vendor V000001
    08.06.2017 Invoice 2 Vendor V000001
    08.06.2017 Invoice 2 Vendor V000001
    08.06.2017 Invoice 3 Vendor V000002
    08.06.2017 Invoice 3 Vendor V000002
    08.06.2017 Invoice 4 Vendor V000003

    2,3 should have same Document No . In Dataport this field is Document No

    Thanks
Sign In or Register to comment.