Skip to Content

ExternalNumber Range

Is it possible to have both figure and letter in one material number? Is it possible to
restrict manual number entering into each letter or figure? Do you ever have this kind
of doubt?

This article would like to give a description about the external number range logic in
SAP system. Maybe this is a very general topic which can be applied to not only CRM
area. Along with the theoretic discussion, I will use the real life coding from SAP systems to demonstrate in detail. Codings might be from material master data in ECC system (component LO-MD-MM) and business partner master data in CRM system (component CRM-MD-BP).

And to make the analyzing simplified, I will exclude special characters in the iscussion, for example – / * .

 

*Number range requirement </p><p>As a consultant, maybe you have met the following requirement about the master data or transaction numbering. Here master data might include customer/business partner, material/product, etc. Transaction might include sales order, marketing plan, etc. That is instead of giving an incremental internal ordering number, customer would like to have more complex numbering. </p><p>For example, use year and date as part of the number, with one or two letters to identify the higher classification, and then with maybe about three digits with incremental number to differentiate more than one objects within one day. Customer requirement might vary with even more complex requirement. But as a summary, there are several features of the possible number range requirement:</p><ul><li><p>number is not pure numeric, it might be a combination of figure and letter;</p></li><li><p>the sequence of the sub-part might differ, either start with figure or letter, for <br />example 123abc or abc123;</p></li><li><p>part of the number should apply to some kind of logic, for example, date or <br />incremental number;</p></li></ul><p>Given the above requirement, I proceed to investigate into SAP systems to see the <br />possibilities to realize this.</p><p>Firstly let me use a small formula to summarize the possible number range format. <br />Due to the different combination and sequence of the figure and letter, we get 4 formats. And as each format can be required as fixed or not fixed length, we get 8 formats.</p><table border=”1″ cellspacing=”0″ cellpadding=”0″><tbody><tr><td width=”137″ valign=”top”><pre> </pre></td><td width=”137″ valign=”top”><pre>Description</pre></td><td width=”157″ valign=”top”><pre>Example</pre></td><td width=”137″ valign=”top”><pre>Fixed length?</pre></td></tr><tr><td width=”137″ valign=”top”><pre>Format1</pre></td><td width=”137″ valign=”top”><pre>Only figure </pre></td><td width=”157″ valign=”top”><pre>1, 2, 11, 12, 101, 102, <br />100000, 100013</pre></td><td width=”137″ valign=”top”><pre>Y or N</pre></td></tr><tr><td width=”137″ valign=”top”><pre>Format2</pre></td><td width=”137″ valign=”top”><pre>Only letter</pre></td><td width=”157″ valign=”top”><pre>TRUCKA, BUSC</pre></td><td width=”137″ valign=”top”><pre>Y or N</pre></td></tr><tr><td width=”137″ valign=”top”><pre>Format3</pre></td><td width=”137″ valign=”top”><pre>combination of figure and <br />letter, start with letter</pre></td><td width=”157″ valign=”top”><pre>PHONE850, PHONE850i</pre></td><td width=”137″ valign=”top”><pre>Y or N</pre></td></tr><tr><td width=”137″ valign=”top”><pre>Format4</pre></td><td width=”137″ valign=”top”><pre>combination of figure and <br />letter, start with figure</pre></td><td width=”157″ valign=”top”><pre>20081202ORDER001</pre></td><td width=”137″ valign=”top”><pre>Y or N</pre></td></tr></tbody></table><p>In the following parts, we will use abbreviation to name each format. For example, <br />Format1Y will indicate only figure number range and with fixed length.</p><p> </p><p>Standard number range example</p><p>Let’s take a look at those standard number range SAP system provided, the most <br />common example might be like the following:</p><p>ID 01 with range 1000000 to 1999999, which is internal number range;<br />ID AB with range A to ZZZZZZZ, which is external number range;</p><p>These are actually very well designed number range with the following advantages. <br />For internal number range 01:</p><ul><li><p>It will be strictly incremental, which lead to good database index. </p></li><li><p>It will always start with figure 1, with different number range defined with <br />different first figure, it can help to identify a higher classification. For example, <br />1 for standard sales order, and 2 for cash order.</p></li><li><p>It is length fixed.</p></li><li><p>It can be used for about one million objects.</p></li><li><p>It can realize Format1Y.</p></li></ul><p>For external number range AB:</p><ul><li><p>It makes one easily to tell whether manual interfere was involved for one <br />object numbering, compared with internal number range 01.</p></li><li><p>It not only allows only letter format, but allow combination of figure and <br />letter, but has to start with letter. (reason will be detailed in the next part)</p></li><li><p>It is length not fixed.</p></li><li><p>It can realize Format2N and Format3N.</p></li></ul><p>Then how to realize other possible number range format? Before discussing one by <br />one, it is necessary to analyze the number range logic firstly.</p><p> </p><p>Number range logic in SAP system</p><p>Number range customizing defines the higher and lower number range limit. SAP system will use the two limits to judge whether a given number is allowed for this number range or not. Depends on the format of the number range limit, the logic can be classified into two types, one is for numeric number, the other is for string number.</p><p>Numeric number is relatively straight forward. As long as the number given is between <br />the number range limit, it will be an allowed number.</p><p>String number will be judged differently. Strings will be transformed into numeric number before compare. The transformation is based on ASCII. For example upper case “A” equals 41 (HEX), character zero “0” equals 30 (HEX). Then system will link all the ASCII in sequence making a long numeric number. Then use numeric comparison to judge whether a number is allowed or not.</p><p>In CRM system transaction BP, system uses the following coding to judge the validity of the manually entered number:</p><p>Include LBUDNF00<br />Form    NUMBER_CHECK_EXTERN </p><p>—— Nummer prüfen –


range has to be defined as . Give number as 2008OR1,

      Lower        0000000          3030303030303020202020202020202020202020
      Higher        ZZZZZZZ         5A5A5A5A5A5A5A20202020202020202020202020
      Number      2008OR1         323030384F5231202020

Thus this is an allowed number.

 

Realize 8 formats

With the logic described above, we can define different number range to realize 8
formats as following:

 

Example

Number range example

Format1Y

100000, ...100013, ...

[100000, 99999]

Format1N

1, 2, ..., 11, 12, ..., 101, 102, ...

[1, 99999]

Format2Y

TRUCKA, TRUCKB

[AAAAAA, ZZZZZZ]

Format2N

TRUCKA, BUSC

[A, ZZZZZZ]

Format3Y

PHONE80, PHONE85

[A, ZZZZZZZ]

Format3N

PHONE80, PHONE80i

[A, ZZZZZZZZ]

Format4Y

2008OR1, 2008OR2

[0000000, ZZZZZZZ]

Format4N

2008OR1, 2008OR2i

[00000000, ZZZZZZZZ]

We can find that some of the number range might be the same while realize different
format. This reveals that we might need extra control to make the number range strictly follow the requirement. As the number range itself only offer higher and lower limit for the control, it is not enough for more complex numbering requirement. We will try to investigate into this in the next part.

 

Open questions

One of the more complex numbering requirement. Number range defined as
[A0000C0000, A9999C9999]. This number range would like to fix the first position as a letter A, and the sixth position as a letter C. And for all others use figures.

But when using it, you will find it cannot achieve the requirements.

* Give number as A0000C000A

  Let’s transform it into ASCII

      Lower        A0000C0000   4130303030433030303020202020202020202020
      Higher       A9999C9999   4139393939433939393920202020202020202020
      Number     A0000C000A   41303030304330303041

   As “0” < “9”, start from the second position of the number given, it fulfils requirements higher than the lower limit, and lower than the higher limit. But this given number is out of my numbering requirements.

Within this article we didn’t find a good solution for this case. We have to consider enhanced number range control to realize this.

 

Enhancing number range control

Take Format3Y and Format3N for example, their number ranges are defined in the same pattern. We might have to use extra control to fix the length for example.

In ECC system, material master data, enhancement MGA00003 in transaction SMOD is provided to enable more complex external number range control.

In CRM system, business partner data, we can use event handler to enhance the control. Transaction is BUPA_EVENTS, under event BPNUM or BPNEX, you may define your own function module and add the logic needed.

In CRM2007 system, web ui, we have badi BADI_CRM_BP_UIU_DEFAULTS, which can be used to default number ranges, by using this we can enable external number range to be used as internal number range. As internal number range is always numeric, figure letter combined number has to be defined using external number range. By using badi BADI_CRM_BP_UIU_DEFAULTS, we may use coding to auto pop up the next number, for example numbering like this:

       20081208TA001

        -date-type-sequence number-

 

Ending

The above discussion might not cover all the possible business requirement for numbering. It tried to present the logic and enhancement interface. Hope these could help to shed some light in your next project regarding number range. And welcome to input your commends on all the above. Thanks.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Community User
    All this is well known. Why do you repeat these facts in a new blog entry? A quick SDN search will reveal many articles on this topic. What is the new point?
    (0) 
    1. Hongyan Shao Post author
      Hi, thanks a lot for the comment.
      Yes, the external number range itself is well known, maybe it is more than well known.
      But have you ever found an article talking about how to define a number range, if you want to use an external number starting with figure and combined with letter?
      And this article would like to make a summary for some of the number range format, instead of only talking about the starting with figure and combined with letter scenario.
      And how about the “Enhancing” part? Is it also can be easily found?
      🙂 but anyway, please feel free to shoot me with more comments, I am more than happy to receive comments. Thanks.
      (0) 
  2. Hongyan Shao Post author
    Hi All,
    Thanks for reading this blog. This is a blog which present an ‘easy topic’ to some extend.
    But I am trying to list out some possible complex requirement and realization method hidden in this ‘easy topic’.
    Comments welcomed.
    Thanks a lot.
    Hongyan
    (0) 

Leave a Reply