NNM1 table in SAP Business One (Document Numbering Series)
NNM1 is the SAP Business One table of numbering series: one row per series of a document or master data object, with the object code, series number, name, next number, last number allowed, prefix, suffix and period indicator. Documents store the series in Series, so NNM1 explains where a DocNum comes from and what prefix it prints with.
NNM1 key fields
| Field | What it holds |
|---|---|
ObjectCode | Object the series belongs to, for example 13 for A/R invoices and 17 for sales orders. |
Series | Series number, the key. OINV.Series and ORDR.Series point to it. |
SeriesName | Series name. |
InitialNum | Initial number. |
NextNumber | Next number for use. |
LastNum | Last number allowed. |
BeginStr / EndStr | Prefix and suffix strings. |
Indicator | Period indicator (OPID). |
Locked | Y = locked, N = not locked. |
SeriesType | D = document, B = business partner, I = item, R = resource, W = withholding certificates. |
IsManual | Y = manual series. |
BPLId | Assigned branch (OBPL). |
DocSubType | Document sub-type. |
How NNM1 relates to other tables
NNM1 holds the series rows of each object listed in ONNM. Document headers (OINV.Series, ORDR.Series and the others) and business partners (OCRD.Series) point to NNM1.Series. The pair ObjectCode plus Series identifies the series, and DocNum is unique within a series, not across series.
Common joins
OINV T0 INNER JOIN NNM1 T1 ON T1.Series = T0.Series (series of the invoice)ORDR T2 INNER JOIN NNM1 T1 ON T1.Series = T2.Series (series of the order)NNM1 T1 WHERE T1.ObjectCode = '13' (all A/R invoice series)
When you use the NNM1 table
Use NNM1 to print document numbers with their prefix, to see which series is close to its last number before year end, and to list the series per period indicator or branch.
Example query: invoice numbers with series name and prefix
SQL Server
SELECT T1.SeriesName, ISNULL(T1.BeginStr, '') + CAST(T0.DocNum AS varchar(20)) + ISNULL(T1.EndStr, '') AS PrintedNumber, T0.DocDate, T0.CardCode, T0.DocTotal FROM OINV T0 INNER JOIN NNM1 T1 ON T1.Series = T0.Series WHERE T0.DocDate >= DATEADD(day, -30, GETDATE()) ORDER BY T1.SeriesName, T0.DocNum
SAP HANA (column names in double quotes)
SELECT T1."SeriesName", IFNULL(T1."BeginStr", '') + CAST(T0."DocNum" AS varchar(20)) + IFNULL(T1."EndStr", '') AS "PrintedNumber", T0."DocDate", T0."CardCode", T0."DocTotal" FROM OINV T0 INNER JOIN NNM1 T1 ON T1."Series" = T0."Series" WHERE T0."DocDate" >= ADD_DAYS(CURRENT_TIMESTAMP, -30) ORDER BY T1."SeriesName", T0."DocNum"
Paste either version in Tools → Queries → Query Generator. Need the other dialect for your own query? Use the SQL to HANA converter.
Common pitfall: Treating DocNum as unique
With several numbering series (per year, per branch or per document type) two invoices can have the same DocNum in different series. Use DocEntry as the key, or DocNum together with Series. Also compare NextNumber with LastNum before the year ends, or posting stops when a series runs out. See OINV table (A/R invoice header).
Ready-made queries that use NNM1
- Invoices created per user today: How many A/R invoices each SAP B1 user created today, with the total value.
Questions about the NNM1 table
Which table holds the next document number in SAP Business One?
NNM1.NextNumber, per series. The document stores its series in Series.
Is DocNum unique in SAP Business One?
Only within a numbering series. DocEntry is the unique key of a document.
Where is the prefix of a document number?
In NNM1.BeginStr (prefix) and NNM1.EndStr (suffix).
Related tables
OINV (A/R Invoice (header)) · ORDR (Sales Order (header)) · OCRD (Business Partners) · search all SAP Business One tables
Sources: SAP Business One documentation and SDK (DI API database tables reference), SAP Help Portal.
Ready to get started?
Tell us what you need. You get a clear technical answer, a fixed scope and a price, usually within 24 hours.
