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 :
Microsoft Dynamics AX (Archived)

Using SQL to Pull all warehouse locations and show details of what is in the location or if it is empty

(0) ShareShare
ReportReport
Posted on by

Hi Guys I need some help.

I have been having a bit of trouble trying to use SQL to Pull from Microsoft AX I need the report to show all warehouse locations and show details of what is currently in the location or if the location is empty.

Basically a full Inventory / Capacity report.

I have tried joining Inventdim and Inventsum however It seems to return many to 1 with loads of historical Item numbers for a 0 qty?

any ideas please ?

 

 

*This post is locked for comments

I have the same question (0)
  • Rustem Galiamov Profile Picture
    8,072 on at

    Hi!

    The InventSum table contains information about the present and expected on-hand stock of items. Every inventory transaction change this information.

    If you want to build report about full inventory using InventSum and InventDim then you also need to keep in mind that full information of Qty it's information from a few fields (i.e. AvailPhysical, AvailOrdered...)

    If you want to get information about inventory Qty on selected date - InventTrans table also needed.

  • Community Member Profile Picture
    on at

    Hi yes I thought about using the AX built in on hand report but I need to be able to make some calculations and from the data provided, create a capacity report....as to how many locations total, how many of these have stock in and how many are empty.  I need it all to be in a neat report that runs 3 times a day.

  • Community Member Profile Picture
    on at

    I was looking some sql that shows all locations and what is currently in the location. I would need it to return If the location is full or empty and if it is full what is in it.. Then I need to produce a capacity report from that to show how many locations we have in total and of that total how many have stock in them and how many are empty.

  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    I think this is probably a good starting point based on your initial question.

    To your point, it starts with WMSLOCATION and does a LEFT JOIN on the results of INVENTSUM/INVENTDIM.  I used the HAVING to get rid of the quantity 0 records.  I also calculated ONHANDQTY very simply using POSTEDQTY, RECEIVED, and DEDUCTED only, whereas you might also consider PICKED and REGISTERED as per some AX reports.

    Hope this helps.

    WITH s AS (
    
    SELECT s.[PARTITION], s.DATAAREAID, s.ITEMID, d.INVENTLOCATIONID, d.WMSLOCATIONID,
        SUM(s.POSTEDQTY + s.RECEIVED - s.DEDUCTED) AS ONHANDQTY
      FROM INVENTSUM s
      JOIN INVENTDIM d ON d.[PARTITION] = s.[PARTITION] 
                      AND d.DATAAREAID = s.DATAAREAID 
                      AND d.INVENTDIMID = s.INVENTDIMID
      WHERE s.CLOSEDQTY = 0
      GROUP BY s.[PARTITION], s.DATAAREAID, s.ITEMID, d.INVENTLOCATIONID, d.WMSLOCATIONID
      HAVING SUM(s.POSTEDQTY + s.RECEIVED - s.DEDUCTED) <> 0
     
    )
    SELECT l.[PARTITION], l.DATAAREAID, l.INVENTLOCATIONID, l.WMSLOCATIONID, s.ITEMID, s.ONHANDQTY
      FROM WMSLOCATION l
      LEFT JOIN s ON s.[PARTITION] = l.[PARTITION] 
                 AND s.DATAAREAID = l.DATAAREAID 
                 AND s.INVENTLOCATIONID = l.INVENTLOCATIONID 
                 AND s.WMSLOCATIONID = l.WMSLOCATIONID


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans