Seeking VLE updating Codeunit

KisuKisu Member Posts: 381
Hey

I'm Adding a voucher number(code) field to Sales Order (header section) and its data is stored in Sales Header.
What I'd need is to get that field data to Vendor Ledger Entry table too.

Any help which codeunit updates vendor ledger entries? And would that codeunit be right place to add the code for it?
K.S.

Answers

  • BBlueBBlue Member Posts: 90
    Hello,

    First of all, I think you are reffering to Purchase Order and Purchase Header table (not Sales Header) where this field information should be taked from.

    You always have to follow NAV's standards when doing such customizations. First, you must define this field in all involved tables and I recommend to keep the same field ID in these tables: Purhase Header, Gen. Journal Line, Vendor Ledger Entry.
    Then, look in CU 90 where the Gen. Journal Line table is filled with info from Purchase Header table when posting vendor entries (search the CU for "Post vendor entries" and add a line there like:
    GenJnlLine."voucher number" := "voucher number";
    

    Then in CU 12 in function PostVend add:
    VendLedgEntry."voucher number" := "voucher number";
    

    If you also need this field in the history tables e.g. Purch. Rcpt. Header or Purch. Inv. Header you just have to define the field in the table structure (with the same ID!) and it will automatically be filled (because of the TRANSFERFIELDS in CU 90).

    I hope these will help you.

    Regards.
    //Bogdan
  • KisuKisu Member Posts: 381
    BBlue wrote:
    Hello,

    First of all, I think you are reffering to Purchase Order and Purchase Header table (not Sales Header) where this field information should be taked from.

    You always have to follow NAV's standards when doing such customizations. First, you must define this field in all involved tables and I recommend to keep the same field ID in these tables: Purhase Header, Gen. Journal Line, Vendor Ledger Entry.
    Then, look in CU 90 where the Gen. Journal Line table is filled with info from Purchase Header table when posting vendor entries (search the CU for "Post vendor entries" and add a line there like:
    GenJnlLine."voucher number" := "voucher number";
    

    Then in CU 12 in function PostVend add:
    VendLedgEntry."voucher number" := "voucher number";
    

    If you also need this field in the history tables e.g. Purch. Rcpt. Header or Purch. Inv. Header you just have to define the field in the table structure (with the same ID!) and it will automatically be filled (because of the TRANSFERFIELDS in CU 90).

    I hope these will help you.

    Regards.

    Ah lol me youre right, sorry I was meaning purchase side. Me and my sloppy english.
    The Voucher customization is on the purchase invoice, and posting that it updates the ledger.
    There is a custom raport of the vendors purchase invoices and it would need the voucher no.
    K.S.
  • KisuKisu Member Posts: 381
    There we go, got it working. Thanks alot :)
    K.S.
Sign In or Register to comment.