SyteLine Material Transaction History Query Generator (matltran)
This generator writes SQL Server queries over the SyteLine material transaction table matltran_mst for SyteLine 9.x and CSI 10.x. You get transaction detail, monthly usage by item and a decoder query that shows which transaction codes your data actually uses.
Fill in
Example values only. Run block 3 first and use the codes you confirm in your data.
Example value only. Confirm which codes are issues in your database with block 3.
-1 if issues are stored as negative qty in your data, 1 if positive. Block 3 shows negative row counts per code.
1. Transaction detail
DECLARE @Site SiteType = N'MAIN';
DECLARE @From DATE = '2026-01-01';
DECLARE @To DATE = '2026-09-30';
DECLARE @Item NVARCHAR(60) = N'PN-%';
DECLARE @Whse NVARCHAR(10) = N'MAIN';
SELECT m.trans_num, m.trans_date, m.trans_type, m.ref_type,
m.ref_num, m.ref_line_suf, m.ref_release,
m.item, m.whse, m.loc, m.lot, m.qty, m.cost
FROM matltran_mst AS m
WHERE m.site_ref = @Site
AND m.trans_date >= @From
AND m.trans_date < DATEADD(day, 1, @To)
AND m.item LIKE @Item
AND (@Whse = N'' OR m.whse = @Whse)
AND m.trans_type IN ('R', 'I')
ORDER BY m.trans_date, m.trans_num;2. Monthly usage by item
DECLARE @Site SiteType = N'MAIN';
DECLARE @From DATE = '2026-01-01';
DECLARE @To DATE = '2026-09-30';
DECLARE @Item NVARCHAR(60) = N'PN-%';
DECLARE @Whse NVARCHAR(10) = N'MAIN';
SELECT m.item,
DATEFROMPARTS(YEAR(m.trans_date), MONTH(m.trans_date), 1) AS month_start,
SUM(-1 * m.qty) AS qty_used,
COUNT(*) AS txn_count
FROM matltran_mst AS m
WHERE m.site_ref = @Site
AND m.trans_date >= @From
AND m.trans_date < DATEADD(day, 1, @To)
AND m.item LIKE @Item
AND (@Whse = N'' OR m.whse = @Whse)
AND m.trans_type IN ('I')
GROUP BY m.item, DATEFROMPARTS(YEAR(m.trans_date), MONTH(m.trans_date), 1)
ORDER BY m.item, month_start;
-- Usage by item and code instead of month: group by m.item, m.trans_type.3. Decode the codes in your data
DECLARE @Site SiteType = N'MAIN';
SELECT m.trans_type, m.ref_type,
COUNT(*) AS row_count,
SUM(CASE WHEN m.qty < 0 THEN 1 ELSE 0 END) AS negative_qty_rows,
MIN(m.trans_date) AS first_seen,
MAX(m.trans_date) AS last_seen
FROM matltran_mst AS m
WHERE m.site_ref = @Site
AND m.trans_date >= DATEADD(month, -12, GETDATE())
GROUP BY m.trans_type, m.ref_type
ORDER BY row_count DESC;
-- Compare a few rows per code with the Material Transactions form to name each code
-- before you put it in the usage list.Confirm on your SyteLine 9/10 database that matltran_mst has the columns used here and how qty is signed for each transaction type; block 3 helps. Run against a reporting copy or a read-only replica where possible. Inside an application session you can query the matltran view (no _mst) instead, which filters to the session site.
Have your usage query checked
Send the codes block 3 returned and your version; we will help confirm which ones belong in usage and receipts.
Optional. The tool and every export work without this. No spam.
How to use it
Run block 3 first. It lists every trans_type and ref_type combination in the last twelve months for the site, with counts, date ranges and how many rows have negative quantities. Compare a few rows per code with the Material Transactions form so you know which codes are receipts, issues and adjustments in your system. Then set the detail and usage code lists and the sign multiplier from what you found, and run block 1 for history or block 2 for monthly usage. Results paste straight into Excel from SSMS.
- Codes go in quoted and comma separated, for example 'I', 'W'.
- Leave warehouse blank to include all warehouses.
- The date filter is a half-open range, so the To date is fully included.
Where this lives in SyteLine
Every inventory movement posts a row to matltran: receipts, issues to jobs, shipments, moves and adjustments. Each row carries the transaction number and date, the transaction type, the reference type and number, line and release of the source document, the item, warehouse, location, lot, quantity and cost. In SyteLine 9 and later, the _mst table holds all sites with a site_ref column, while the view without the suffix shows only the current session site. Queries from SSMS should use the _mst table with an explicit site_ref filter, as these do.
Worked example: item usage report
A planner wants monthly usage of PN- items in MAIN for January to September 2026. Block 3 shows the issue code has mostly negative quantities, so the sign multiplier stays at -1. Block 2 then returns one row per item per month: PN-48213 shows 420 in March, 380 in April and 510 in May, with the transaction count beside it. That table feeds a reorder point or a min-max review. If one month spikes, run block 1 for that item and month to see the job or order numbers behind it.
Gotchas
Do not assume a code means the same thing in every database: check it with block 3. Reversals post as separate rows, so usage nets them out only if their code is in the usage list. Filtering on trans_date with a range rather than a function on the column keeps the query able to use an index. Large date ranges on busy sites return millions of rows; start narrow. Never update matltran directly; it is the audit trail for inventory and costing.
Frequently Asked Questions
How do I get an item usage report from SyteLine?
Sum issue-type material transactions by item and period from matltran_mst, using the issue codes confirmed in your data and the right sign. Block 2 does exactly this by month. Standard SyteLine reports and forms also show usage, but a query is easier to filter and to export to Excel.
What is the difference between matltran and matltran_mst?
In multi-site SyteLine 9 and later, matltran_mst is the physical table holding every site, identified by site_ref. The matltran view filters to the site of the current application session. From SSMS without a session site, use the _mst table and filter site_ref yourself.
How do I export SyteLine report data to Excel?
Run the query in SSMS and copy results with headers, or save as CSV. For repeated use, put the query in a view or stored procedure on a reporting copy and connect Excel through Data, Get Data, From SQL Server. Keep the connection read-only.
Why do my usage totals look negative?
Issues are commonly stored with the opposite sign to receipts. Block 3 shows the count of negative rows per code. If issues are negative, keep the sign multiplier at -1 so usage reads as a positive number; if they are positive in your data, set it to 1.
If planners want to ask SyteLine for item usage in plain English instead of running SQL, we can set up a private, read-only assistant on your own servers.
Related Tools
SyteLine Inventory Aging Query Generator
Build a SQL Server inventory aging report for SyteLine 9/10 with your own day buckets, valued at item unit cost, plus a lot-based option.
Developer ToolsSyteLine SQL Query Generator for Item, Job and Order Tables
Fill in site, item prefix, job status and date to produce read-only SQL for item master, jobs and open customer order lines.
Infor SyteLineSyteLine Database Tables Reference
Searchable lookup of the main SyteLine SQL tables, what each holds and its usual business key, for writing queries and reports.
Infor SyteLineSyteLine Reorder Point and Safety Stock Calculator
Work out statistically sound safety stock and reorder point values for SyteLine items from demand variability, lead time and service level.
More Developer Tools tools
See all- SyteLine IDO REST Request Generator
- SyteLine SQL Blocking and Long Running Query Script Generator
- SyteLine Custom Table CREATE Script Generator
- SyteLine Mongoose Framework Events Reference
- SyteLine Event Action Types Reference
- SyteLine Event Action Parameter Functions Reference
- SyteLine WinStudio Standard Form Events Reference
- SyteLine Mongoose API Options Reference
- SyteLine SQL User-Defined Data Types Reference
Keep exploring
Free tools
- SyteLine Material Transaction and Reference Types ReferenceThe transaction and reference types behind SyteLine material transactions, with where each comes from and whether it counts as usage, so you can build reliable usage and aging reports.
- SyteLine Background Task History Query GeneratorWrites read-only SQL against BGTaskHistory and ActiveBGTasks to find failed reports and tasks, slow tasks, stuck queue entries and submissions that never got a history record.
- SQL Monthly Demand History Query GeneratorGenerate SQL that turns order or shipment lines into a clean monthly demand history per item, with gap months filled with zero.
ERP fixes and how-tos
- SyteLine item usage report: get item consumption historyHow to get item usage history in SyteLine for reorder points and MRP tuning: standard transaction reports, a SQL pull from matltran and an Excel pivot.
- How to Build SQL Views for Custom SyteLine ReportingWhy custom SyteLine reports should read from purpose-built SQL views, not core tables directly, and how to build and place those views safely.
Guides
- SyteLine SQL Server Maintenance GuideSyteLine SQL Server maintenance guide covering backups and recovery model, index and statistics jobs, integrity checks, and purging history tables safely.
- How to Set Up Database Backup Automation in SyteLineAutomate SyteLine database backups with SQL Server maintenance plans, transaction log management, and disaster recovery procedures for Infor CloudSuite Industrial.
- Performance Optimization for SyteLine IDO QueriesOptimize SyteLine IDO query performance with indexing strategies, caching patterns, and request tuning. Reduce response times in Infor CloudSuite Industrial environments.