How to post?

raja123raja123 Member Posts: 50
edited 2019-05-08 in NAV Tips & Tricks
Created a field in sales order and I want to post its value to customer ledger entry and item ledger entry. I'm using nav 2017. Which code units are used to do this?and explain me how to achieve this?

Best Answers

Answers

  • Developer101Developer101 Member Posts: 407
    It is recommended to do posting entries though journal lines. The codeunits you will be using Gen Jnl Post Line and Item Jnl Post Line, you might be need to add code in the gen jnl line or item jnl line tables as well as new NAV versions such as NAV 2017 some functions have been moved to the tables which is good.
    United Kingdom
  • raja123raja123 Member Posts: 50
    Thanks for your reply Developer101. Can you explain a bit detail.
  • Developer101Developer101 Member Posts: 407
    I presume you have a field on sales header. You need to create same type of field in the table 81 and 83.
    also in tables 21 and 32 (ledger entries tables)

    When posting happens first the value from field in sales header is copied to journal tables which are 81 and 83 then move to 21 and 32.

    You need to place your code in Gen Jnl Post Line and Item Jnl Post Line codeunits.
    United Kingdom
  • raja123raja123 Member Posts: 50
    But in codeunit 12 and codeunit 22, there is no Examplefield. from which tables i can get that field?

    thanks in advance.
  • Developer101Developer101 Member Posts: 407
    i am only calling it examplefield just to give an example, you need creating your own. This makes me think that you are just starting development?
    United Kingdom
  • raja123raja123 Member Posts: 50
    Yeah you are right! I'm just starting ,



    "In the codeunit 12 in the PostCust function place code

    CustLedgEntry.Examplefield := Examplefield

    In the codeunit 22 in the function InitItemLedgEntry place code

    ItemLedgEntry.Examplefield := Examplefield"



    where can i get that ' Eaxamplefield' in codeunits??
    you want me to create a variable 'Eaxmplefield' In codeunit 12 and 22 ??
    or
    from which tables i can get that field?
  • Developer101Developer101 Member Posts: 407
    from Item journal line and gen journal line tables where you will need to create fields in these tables.

    so basically CustLedgEntry.Examplefield := GenJnlline.examplefield (dont need mention genjnline as its already there)

    sames goes for ItemLedgEntry.Examplefield := Examplefield
    United Kingdom
  • raja123raja123 Member Posts: 50
    Thank you Developer101 for your early and quick response.
Sign In or Register to comment.