Skip to Content

How to Use the Reuse Library NumberRange

In nearly every solution there is the need to have a unique numbering of the Custom Business Object instances.

Until now in most cases a special Custom Business Object is “misused” for this functionally.
With the release 1405 we finally provide a reuse library which does the job.

Here I want to describe how this reuse library can be used and explain it with some examples.

Use Case “Quote, Order, Invoice Numbering”

You are using quotes, orders, and invoices and need to number them in separate intervals.

Step 1: Create a own Code Data Type

As we are working with quotes, orders, and invoices, I created a own code data
type and named it “OrderType”.


Step 2: Custom Reuse Library

The reason to create a Custom Reuse Library is that you can centralize the creation
of the numbers and reuse this.

This Custom Reuse Library should contain a function to derive the numbers


which has as an input parameter the order type.


Step 3: Code the Function in the Custom Reuse Library

In the resp. ABSL code the Reuse Library NumberRange is called to draw a new number for the order type from the input. We use the order type as so called Number Range Object to separate between different number ranges.


As we want to separate the number between the order types a switch statement follows in which the formatting takes place.


The result is convert to string and assigned to the return parameter


Step 4: Call of the Function in the Custom Business Object Script

In the ABSL coding of the Custom Business Object Quote the drawing of the invoice number looks like this.


Similar are the Order and Invoice:



Use Case “Special Format for Records”

You need to format the identification of a record in a distinct manner; especially you want to include the current year.

Step 1: Call the Reuse Library

Call the Reuse Library to draw a new number for the record. Use the string “RECORD” for the Number Range Object.


Step 2: Format the Number

We want to prefix each and every number with the letter “R”, have the current year, and the number with 4 digits. Each part is separated by a minus sign.


As the length of the return value of the DrawNumber function of the Reuse Library is char 60 we use Substring 56.

Step 3: Call of the Function in the Custom Business Object Script

The call in the ABLS code is very simple.


Step 4: Reset the Number Range Object

As we include the current year we want the numbers to restart each year. Therefore we need to reset the Number Range Object by calling this code.


That’s all, folks.


You must be Logged on to comment or reply to a post.
  • Hi Horst,

    thanks for your blogpost.

    I have a question, as the above mentioned way doesn't work and we are getting dumps in ByD.

    We have created a Codelist with an entry of our own created bo (ABCNumber). We are handling this Codelist value in the parameter of the created custom reuse library.

    In the reuse library we draw the number from the NumberRange as you mentioned above. Unfortunately we are getting a dump when we are exectuing this.

    The call is: var number = NumberRange.drawNumber("ABCNumber")

    Could you maybe help us here?

    Best Regards,


      • Hi Horst,

        thanks for your respond.

        We have tried to get a solution for this issue and we now found one. If we are using the following code, there will be a number drawn from the number range:


        var numberRange : ID = "Record";

        var number = NumberRange.DrawNumber(numberRange);

        var aktID = (100000 + number).ToString();


        We don't know, why we got a dump, but finally it works.

        Best Regards,


  • Hi Horst,

    I am getting "0" when I use NumberRange.GetNumber function in another instance.

    BeforeSave for instance 1

        var rec : ID="ORDER";

        var num=NumberRange.DrawNumber(rec);             // is 3.

        var currentNum=NumberRange.DrawNubmer(rec);  // is 3

    BeforeSave for instance 2

       var rec : ID="ORDER";

        var current=NumberRange.GetNumber(rec);     // always gives "0".

    with a warning "Invalid Importing Parameter Namespace".

    Best Regards


    • Hello Fred,

      Because of this message you will get the "0" back.

      The message is raised because the namespace of your solution was not handed over.

      Any special for the second instance?

      Otherwise you need to raise a incident.

      You can ask the processor to put it direct on my name.  😀



      • Hi Horst,

               Thanks .

               "Not handed over"? I dont understand what you mean. 🙂

                How can I make it handed over? 🙂

                I think there is nothing special in the second instance.

        Best Regards


  • Hi Horst,

    Thanks for sharing such type of blog!!!!

    I go through this blog , Firstly i have created code list data type with order only then create reuse library.

    When i have written code in GetOrderNumber.absl then it gives dump.  I am not accessing Code list name directly .

    Can you help me on this.


    Puneet Mittal

  • Hi Horst,

    I am new to SDK and have below question on reuse library.

    Can we create one generic SDK solution with custom BO and reuse library with function to get that custom BO instance and then use that library function in other custom solution with custom BO action script?

    I did same like created one generic custom solution with custom BO and then custom library for example ‘MyCustomLib’ with function. But when I try to reuse that custom created library in other custom solution BO action script, it am getting error like "identifier ‘MyCustomLib’ does not exist". Anything I need to declare to use that library or we can not use since that library is not in the same solution.



    Harshad Patel



      Hello Patel,

      The "generic SDK solution" must simply be a "Solution Template", not a "Customer-Specific Solution".

      If you are done with our development of the CRL and all other stuff, simply import that Solution Template into your current solution and you can use the CRL.



  • /
    • Hello Harish,

      Did you ensure that "RECORD" and "AutoNumbersList" is the same?

      Maybe you should first define a variable for the NumberRange name and then re-use it to ensure it is the same everywhere.

      .    Horst

  • Hi Horst Schaude,

    What could to be the approach if we want to use the number range functionality in offline mode.


    Since NumberRange.Drawnumber not supported in offline absl


    Kindly pass the inputs.


    thanks in advance


    Best Regards,


    • Hello Vinutha,

      As in offline there may be several parallel running instances which do not know from each other (due to being offline) this may not feasible.

      You will only be able to draw valid & unique numbers after going online.