Business Numbers

Business Number Rules control how OTM generates IDs for business objects such as Order Bases, Order Releases, Shipments, and Invoices. OTM provides default XID sequences for all objects, but you can create custom rules when business requirements call for a specific format or numbering range.

Business Process Automation > Power Data > Business Numbers > Business Number Rule

Every rule definition consists of one or more instructions enclosed in braces { }. Literal text, if any, appears outside the braces. For example, the default rule for the invoice ID is:

{dddddddd:id=1}-{nnnn:contexts=1:start=1}

Common expression formats:

{dddddddd:id=1}               — Date in YYYYDDMM format
{nnnn:start=1000:end=4999}    — 4-digit number starting at 1000, ending at 4999

To edit an existing Business Number rule:

  1. Ensure the existing rule is not set as the Default.
  2. Create a new BN rule and set it as the Default.
  3. Specify the rule definition to control how the generated number is formed.
  4. Ensure the BN Type on the new rule matches the BN Type of the original rule — otherwise the system will not generate the number.

Backend Table:

The BN_SEQUENCE table maintains two critical columns — BN_CONTEXT and CURVALUE — both derived from the BN rule.

Example:

The BN Rule for bulk plan ID is:

{dddddddd:id=1}-{nnnn:contexts=1:start=1}

If 10 bulk plans are run for a particular day, the generated IDs look like this:

BN_SEQUENCE maintains CURVALUE with the last or maximum sequence for that context. In the example below, the next bulk plan in that context takes 0010 + 1 = 0011 as the next ID:

SELECT *
FROM BN_SEQUENCE bs
WHERE BN_RULE_GID = 'DOMAIN_NAME.BULK_PLAN_XID.DEFAULT'
AND BN_CONTEXT = '20210126'
ORDER BY insert_date DESC;

A common problem scenario:

If the ORDER_MOVEMENT_XID.DEFAULT rule is defined as:

{r*:id=1:xml=ORDER_RELEASE}-{nnn:contexts=1:start=1}

A 3-digit sequence (nnn) allows a maximum of 999 values. Creation of the 1000th order movement will fail because the generated number would require 4 digits. Increase the digit count in the rule definition before this limit is reached.

Questions & Discussion

Have a question about this topic? Post it below using your GitHub account. Comments are visible to everyone and help other OTM consultants with the same question.