Get Serial Number Count and Length in Microsoft Dynamics GP

Microsoft Dynamics GPI needed to check how many serial numbers were assigned to sales transactions and the cumulative length of them. I’m not aware of any function in Microsoft Dynamics GP which would give me this information, so I wrote the below SQL statement to return both values along with the transaction type and document number.

It selects from the Sales Serial/Lot Work and History (SOP10201) table which, allowing for a simple statement, includes both the work and history data (SOP transactions don’t have a status of open).

/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
SELECT SOP.SOPNUMBE AS 'SOP Number' ,SOP.SOPTYPE AS 'SOP Type' ,SOP.LNITMSEQ AS 'Line Item Sequence' ,COUNT(1) AS 'Serial Number Count' ,SUM(LEN(SOP.SERLTNUM)) AS 'Serial Number Length' FROM SOP10201 AS SOP -- Sales Serial/Lot Work and History (SOP10201) GROUP BY SOP.SOPNUMBE ,SOP.SOPTYPE ,SOP.LNITMSEQ ORDER BY SUM(LEN(SOP.SERLTNUM)) DESC

What should we write about next?

If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.

Your Name

Your Email

Suggested Topic

Suggestion Details

Looking for support or consultancy with Microsoft Dynamics GP?

I no longer work with Microsoft Dynamics GP, but the last company I worked for was ISC Software in the UK; if you’re looking for support or consultancy services with Microsoft Dynamics GP you can contact them here.

Leave a Reply

Your email address will not be published. Required fields are marked *