When Posting a Warehouse Receipt, Which part of the code insert an entry in the Item Ledger entry??

When I post a Warehouse Receipt some how a new entry will be inserted in the Item ledger entry for the received. I canot find which part of the code are responsible for this.
Can any one help? I created anew column in the Item ledger entry and I want to fill it out with some values from the warehouse receipt lines.

I tried to follow he code but I was not able to find the function which insert the lines in Item ledger entry :frowning:

Ps: Version, Nav 2013 R2


I think this should help -
When You Create a warehouse Receipt, You Either Receiving a Transfer Order or a Purchase Order or a Sales Return Order, by using get source document…
When you post the Warehouse Receipt, From the warehouse only the warehouse receipt get posted, but if you look for the code the actual document get posted.

So in case you are receiving a purchase order - Purchase Receipt will be posted (automatically).
and in case of receiving a Transfer Order - Transfer Receipt will be posted (automatically).

and in case of receiving a Sales Return Order - Sales Receipt will be posted (automatically).

Codeunit 90 - Purchase Will be called from the posting routine of warehouse receipt.
Codeunit 5705 - Transfer will be called from the posting routine of Warehouse Receipt.
Codeunit 80 - Sales Return will be called from the posting routine of warehouse Receipt.

All these end up by create a Item ledger for the whse. receipt.

Does it make sense, or you need more inputs.

Hi , First thanks a lot for your time. Iam receiving some items in my warehouse due o a Purchase order which I made. Now lets say I received 1 item. For this received Item a new Item ledger entry line will be inserted. -----> Is CU 90 is my target?


You Nailed it but how CD 90 get called from the warehouse receipt, is the catch…

Take some time at least next 30 min, and let me know if you don’t get the catch… will tell you where it is.

Hint - look in Codeunit 5760 which does the posting of warehouse receipts.

** Trying to help you, Hope you understand… See you in next 30 min.

Thanks I will keep searching. see you in few

So here it is -
Codeunit 5760 call a function - PostSourceDocument Which in turn call SetWhseRcptHeader for Purchase Order (Source Type). After That it Runs Codeunit 90.

When This Happens, In codeunit 90 - TempWhseRcptHeader is set and that in turn set the WhseReceive.


  1. Add that custom field in Item Journal Line and Item Ledger Entries.
  2. In Codeunit 90, Function - PostItemJnlLine (Item Journal Line is Created & Posted to ILE).
  3. Within That function, you can get the Receipt Line using - WhseRcptLine.GetWhseRcptLine(
    ** You can find this function in Codeunit 90.
  4. This function return you the Receipt Line. Get the Line, get the value from line and transfer to item journal line.
  5. Then in Codeunit 22, in Function InitItemLedgEntry, You need to transfer value from Journal Line to ILE.

I will try this tomorrow and I will tell you about the results :slight_smile: