web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Job to get average unit cost of item through X++ code in D365

dasdasd Profile Picture dasdasd 841
Recently I have encounter a scenario in which I want to get the average unit cost price of the item in D365FO. For that I have created a job to get the cost. Please follow below screenshots.

You can see the average unit cost price for item through this navigation Cost management -> Inventory accounting -> Released products -> Manage Costs (Tab) -> Costing (Section) -> Cost Object (Option).






















Source Code Explanation (1.1):
  • Initialize and declare objects.
  • Set Item Id = 'F-001' (in my case).
  • Get invent sum buffer through item id.
  • Check inventory dimension, in case of not found created one.

























Source Code Explanation (1.2):
  • Create an object of invent cost price cache class.
  • Get invent table buffer from invent sum.
  • Get from & to unit of measurement.
    • Construct secondary to invent unit converter buffer.
    • Get the convert value.
  • Get the OOTB cost price pieces method from cache class that will return average unit cost price of the item.










Result:




This was originally posted here.

Comments

*This post is locked for comments