Developer ToolsFree generatorPDF, Excel, Word exportInfor SyteLineAll Infor SyteLine (CloudSuite Industrial) tools

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.

Generated code
Download:

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.

Was this tool useful?

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.

ArchRay builder
Design the on-prem AI stack for Infor SyteLine: model, GPUs, RAG pipeline, guardrails
See memory, speed and cost as you swap parts, then export the diagram. Free, in your browser.
Open the builder

Keep exploring

Free tools

ERP fixes and how-tos

Guides