Alphanumeric number for HU
Extract from SAP NOTE "1930424 - How to get External Handling Unit number as
alphanumerical type" indicates the following:
CAUSE
In SAP standard, it's not possible to get HU identifications with letters.
Alphanumerical numbers are not allowed. You have to use numerical numbers because
the field HU is a numeric field which is hard coded.
All programs in R/3 are designed to read HU with this data format.
Number Length Domain is NUMC20
RESOLUTION
External Alpha Numeric ID is not possible in the HU.
However, you can implement your own coding to get EXIDV with letters in user-exit
EXIT_SAPLV51S_001 (called in V51S_CREATE_HU_HEADER).
Ensure that changing the number range should not lead to further problems.
--------------------------------
OUR RESEARCH:
Approach - 1: SAP’s mentioned advice as per SAP NOTE 1930424
Implemented the change in the user exit, by passing the value into the field. But when we
tested the result the following happened:
When the user enters the alphanumeric value on the screen then SAP checks for the
validity of the external HU before executing the code in the user exit. Since the SAP
standard number range does not accept alphanumeric values it fails and errors out.
Approach - 2: Creating a custom number range and using it instead of the SAP standard
We created a custom number range ZHU_VEKP and defined it exactly same as the SAP
standard number range (HU_VEKP) with the difference in the "Number Length Domain".
We defined it as CHAR20 (HU_VEKP had it as NUMC20).
We then changed the "NR Transaction" (found in the "Customizing" section) for
ZHU_VEKP to HUEX. This is what is also maintained for HU_VEKP. At any given time
there can be only 1-1 mapping between the number range object and the NR transaction.
Thus to be able to do this you will have to remove it from HU_VEKP and then add it to
ZHU_VEKP.
After this, whenever you go to (in transaction SPRO) Logistics General --> Handling Unit
Management --> External Identification --> Number Range Maintenance for HU
identification, you will notice that it will refer to ZHU_VEKP object instead of HU_VEKP.
The above ensures that a user can maintain ranges in ZHU_VEKP directly from SPRO.
But when it comes to assigning it to a Packaging Material Type, it’s a puzzle. To be able
to use a number range one needs to assign it to the Packaging Material Type which is
available at Logistics General --> Handling Unit Management --> External Identification --
> Define Number Assignment for Each Packaging Material Type. Over here, one should
be able to assign it under the column "Number Assignment" against the particular
Packaging Material Type. But on F4 one notices that there are only the following options
(thus clearly indicating that ZHU_VEKP is not available to assign):
A
SSCC18 already at creation of handling unit
Number range interval 'HU_VEKP'
Any external number can be entered (no HU functionality)
CONCLUSION:
The only way which we believe we can achieve the requirement is by directly changing the
Number Length Domain from NUMC20 to CHAR20. But this would mean changing the SAP
Standard.
SAP Number Range Shenanigans
053,759
The shenanigans of alphanumeric SAP Number Ranges are a surprise even to
seasoned experts.
You’re likely well aquatinted with the mundane task of maintaining numeric number
ranges for most business objects. The behavior is easily understood because the SAP
system straightforwardly considers them as, well … numbers. Adding alpha
characters to the mix is less common, and the resultant behavior is significantly less
intuitive.
Let’s have a detailed look at the behavior of alpha characters in external number
ranges, the published rules, and some technical details behind system behavior,
perhaps with an eye towards breaking the strictest of rules once they’re understood.
As an example, I’ll use number ranges commonly configured for ERP Vendors that
support SAP Retail Site Masters. The use case exposes interesting number range
behaviors.
In SAP Retail, the Best Practice for Site Numbers is that the 4-character Site number,
Site Business Partner number, Site ERP Customer number, and Site ERP Vendor
number are all the same number. For this reason, 4-character number ranges are
typically reserved for all those related objects for Site Masters. To that end, Site ERP
Vendors may have external number ranges defined like this example:
Example number ranges for ERP Vendor.
While this number range configuration may be common, and necessary, it probably
doesn’t have the exactly intended result! In the case of A to ZZZZ, the number range
doesn’t satisfy the intention of reserving only 4-character numbers.
To illustrate the system behavior, let’s consider a real-world example: adding
another external number range for 5-character numbers:
Z3 number range can’t be created. It overlaps. Why?
The Z3 number range VN000 to VN999 can’t be added because it overlaps.
To understand why, let’s begin with a quick look at the F1 help available when
maintaining a number range.
SAP Help for “From Number” field when maintaining a number range.
The strict declared dependency is: “External intervals can only contain either letters
or numbers, as sorting can differ between platforms (Code page).”
If we are to believe this admonition, then a number range such as VN000 to VN999
cannot be created simply because any mixture of letters and numbers is verboten,
never mind any overlap error. Fortunately, the system is a bit more flexible than
suggested by the Help screen.
But before breaking any rules, let’s understand how the system stores and evaluates
number ranges that include letters.
Storing Numbers
Let’s use Vendor Number (LIFNR) to illustrate the example of storing numbers, with
and without letters.
Data Element LIFNR is defined as 10 characters.
Numeric entries, such as 1000, are stored as 10 characters, with leading zeros (this
is the unconverted value).
Non-numeric entries, such as R120, are also stored as 10 characters, with trailing
spaces.
The system evaluates number range entries while number ranges are being
maintained, and it separately evaluates number-range-relevant numbers – in the
context of defined number ranges – when entered in a transaction, such as the entry
of a Business Partner number during creation of a Business Partner.
The evaluation of the number is a comparison. For example, is the Business Partner
number entry greater than the From Number of the number range, and is the
Business Partner number entry less than the To Number of the number range. For
example:
Here’s the code that compares.
SAP ABAP Keyword Documentation explains that when the comparison type is one of
the character-like data types, the content is compared from left to right. Based on
the internal binary representation in the code page used, the first differing character
from the left determines which operand is greater.
Data Element LIFNR, for example, is defined as 10 characters, and all 10 characters
are evaluated, beginning from left to right, until a differing character is determined.
Unexpected Numbers
The number range A to ZZZZ is evaluated as “A “ (1 character and 9 trailing spaces)
to “ZZZZ “ (4 characters and 6 trailing spaces).
The number range A to ZZZZ isn’t a 4-character number range after all; it won’t
constrain entries to 4 characters!
Surprising Examples
Numbers are “smaller” than letters.
This is demonstrated as A to 1 results in an error:
This is also demonstrated as 1 to A is a valid range:
Only external ranges permit non-numeric characters.
This is demonstrated as A to ZZZZ for an internal number range results in an error:
Alpha ranges include numbers.
These number ranges are typically maintained for Sites.
Z1 permits numeric only Site Vendor numbers from 1 to 9999.
But consider example Range Z2: A to ZZZZ.
Because numbers are “smaller” than letters, Range Z2 (A to ZZZZ) achieves the
following scenario:
Must begin with a letter (From Number is A, thus a number is not permitted as
the first character).
Numbers are allowed following the first character (To Number is ZZZZ, and
R123 is permitted because 123 is “smaller” than ZZZ).
To illustrate, let’s create a Vendor:
And Vendor number R123 is a permitted value:
Because numbers are “smaller” than letters, Range Z2 (A to ZZZZ) permits numbers
following the first character.
Because numbers are “smaller” than letters, it is not possible to define a strictly
alpha range that spans multiple characters (e.g. 2 or more alpha characters).
Alpha ranges include spaces.
If you have a number range like Range Z2 (A to ZZZZ), you can still create master
data with a number such as R123456789.
If you have a number range like Range Z2 (A to ZZZZ), you probably did not mean to
permit R123456789. But you did!
The reason for this is simply technical: This interval (A – ZZZZ) is understood by the
system like this:
[A ] – [ZZZZ ]
(note the spaces after the characters).
SAP stores number ranges in ten characters and if you don’t use all ten characters,
then SAP thinks there are spaces there (which is technically true) and unexpected
things could happen.
00000P1000 – 00000P9999
or
P000001000 – P000009999
Reference
SAP Note 2664295 – Error while creation of Business Partner with External
Number range.
SAP Note 2380479 – Unexpected error NR600 “Enter intervals without
overlap” when creating an interval
SAP Note 1076122 – SNUM: Number ranges overlap – NR 600