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

FieldWhat it holds
ObjectCodeObject the series belongs to, for example 13 for A/R invoices and 17 for sales orders.
SeriesSeries number, the key. OINV.Series and ORDR.Series point to it.
SeriesNameSeries name.
InitialNumInitial number.
NextNumberNext number for use.
LastNumLast number allowed.
BeginStr / EndStrPrefix and suffix strings.
IndicatorPeriod indicator (OPID).
LockedY = locked, N = not locked.
SeriesTypeD = document, B = business partner, I = item, R = resource, W = withholding certificates.
IsManualY = manual series.
BPLIdAssigned branch (OBPL).
DocSubTypeDocument 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

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.