Hi there,
Number ranges can often be difficult to understand. Let's start with a definition of what is a number range and what is a material number.
Number ranges are a generic functionality in SAP which is used by material master. For every material that your company uses you must create a material master record for it. This record is uniquely identified by a material number.
If you want to read more about material number definition and the difference between internal and external number assignment, please refer to the following documentation Help SAP - Material Numbers
If you have any of the following questions, this post should help you
- How do I set a number range which included specific values?
- Why am I getting an overlap error on number ranges?
- How ordering works on number ranges?
- How can lower-case letters be taken into account in product numbering?
- Can leading zeros be used on number ranges?
Material Number storage
Material numbers in our system are stored in two different ways, depending if they are numeric only or if it has nonnumeric characters:
Numeric only material numbers are padded with leading zeros and stored right-justified.
Here's an example for better understanding:
- Defined length: 18 characters
Internally/externally assigned number | "123" |
Stored number | "000000000000000123" |
Material numbers containing at least one nonnumeric character are stored left-justified. Here's an example:
- Defined length: 18 characters
Internally/externally assigned number | "1A3" |
Stored number | "1A3 " |
After storing the value, the system performs lexicographical ordering, which is the same ordering used on dictionaries worldwide (it is also known as lexical order or dictionary order).
To simplify, the system reads and compare the values of the characters from left to right. If they are the same value/character, the test is done again for the next character until it finds a higher or lower value/character. For numeric material numbers the system completes the number with 0s on left until the defined length is reached. If the value has a nonnumeric character, it is filled with blank spaces on the right until the defined length is reached.
Let's understand how the system would handle some example values:
# | Value Input | Stored Value |
1 | "abc.DEF01-233" | "ABC.DEF01-233 " |
2 | "123" | "000000000000000123" |
3 | " 456 " | "000000000000000456" |
4 | "0A123" | "0A123 " |
5 | "0 0123" | "0 0123 " |
6 | "0123456789123456" | "000123456789123456" |
7 | "abcDEF01+233" | Invalid: Error NR585 |
8 | "-abcDEF01233" | Invalid: Error NR586 |
The ascending order for the valid values above would be:
- "0 0123 "
- "000000000000000123"
- "000000000000000456"
- "000123456789123456"
- "0A123 "
- "ABC.DEF01-233 "
Note: If you didn't understand the first value on the order, note that the space character has a lower value than 0.
Order of characters:
The characters are ordered by their Unicode value. Here is an ordered list of the most commonly used characters.
!"#$%&'(),-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~
Note that the first value is the space character.
FAQ
- Which special characters are allowed in product numbering?
The only invalid characters are '*' and '+'.
Every character other than the invalid characters above are supported. Characters other than '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' are considered special characters. Special characters are ordered by their Unicode value.
- How can lower-case letters be taken into account in product numbering?
Every lower-case letter is set to uppercase. Only uppercase letters are stored on the system.
Note: The uppercase function also works for other alphabets.
- Are spaces allowed?
Yes, they are considered an nonnumeric value.
Note: if they are located on the start (leading spaces) or the end of any of the ranges, they will not be considered.
- How must the number range interval be defined?
The narrower or smaller possible number range for some values that would be valid for would be:
From Number: <LowerValue> - The first on an ordered ascending list.
To Number: <UpperValue> - The last on an ordered ascending list.
- How prefix can be used?
It can be used to avoid overlapping issues.
Using the value "01-" as an example of a prefix and setting the number ranges:
From Number: "01-000000000000000"
To Number: "01-ZZZZZZZZZZZZZZZ"
They can be named with multiple lengths until the limit of the defined length (standard: 18).
Examples: "01-ABC123", "01-MATERIALNAME".
You can change the prefix "01-" to any other value.
- How to deal with numeric starting on external number range?
The larger number range including number and letters would be "000000000000000000" to "ZZZZZZZZZZZZZZZZZZ". Since there is a need for an internal number range with numeric only values, the larger number range possible for this purpose would be to use the upper value ("To Number" field) of the internal number range e.g. "000000000099999999" plus one as the start of the external number range. It would look like this:
From Number: "000000000100000000"
To Number: "ZZZZZZZZZZZZZZZZZZ"Please be aware that large number ranges can cause overlap with other number ranges.
- Can number ranges overlap if they are not overlapping in all of the characters?
No, it is not possible to have an overlapping value in any of the characters.
Since the overlap test is done character by character, left to right, when the system identifies an overlap, it does not consider any of the characters ahead.
For example, 1. "T001" to "T049"; and 2. "T01A" to "T09Z". Since the ordering is done character by character, the ordering for these values would be T001 > T01A > T049 > T09Z, resulting in an overlap.
Common Errors
- Error: "Specify numeric interval limits"
Internal number ranges are numeric only. External number ranges can be alphanumeric.
- Error: "Interval & overlaps with interval &"
Please consider the number ranges mentioned. The number ranges can not overlap with any other range, either internal or external.
- Error NR585: "Interval limit contains invalid character. Interval &"
As the characters '*' and '+' are often used as masking characters for generic searches in the SAP system, they can not be used in number range intervals. Please replace the invalid(s) character(s).
- Error NR586: "Interval limit starts with a special character."
The interval limit cannot start with special character. Special character are anything other than '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
Note: Letters from other alphabets that are identical to Latin alphabet letters, like the Greek letter 'Α', are still special characters.
Conclusion
I hope this blog post has helped you to understand the system behavior better.
Note: This article talks about the non-lexicographical storage type. If your system is set to a lexicographical storage type, please consider this article with every value as it would have a nonnumerical character.
If you found this blog post useful, please leave a like/kudos, it is located on the top of the post.
Feel free to leave a comment if you notice any behavior that is not presented in this post, or any questions related to this topic, and I will answer and update the post as soon as possible.
Kind Regards,
Ícaro Farias
Sources
[1] KBA 3487269 - Product could not be created due to error message M3318 - "Number & not defined for ma...
[2] Material Numbers - Help SAP Documentation