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”.

CodeDataType.png

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

CustomReuseLib.png

which has as an input parameter the order type.

GetOrderNumber.png

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.

code!.png

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

Code2.png

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

Code3.png

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.

Code4.png

Similar are the Order and Invoice:

/wp-content/uploads/2014/06/code5_489267.png

/wp-content/uploads/2014/06/code6_489268.png

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.

/wp-content/uploads/2014/06/code7_489269.png

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.

/wp-content/uploads/2014/06/code8_489272.png

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.

/wp-content/uploads/2014/06/code9_489273.png

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.

/wp-content/uploads/2014/06/code10_489274.png

That’s all, folks.

Horst

To report this post you need to login first.

11 Comments

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

  1. Daniel Gegenheimer

    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,

    Daniel

    (0) 
      1. Daniel Gegenheimer

        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,

        Daniel

        (0) 
  2. Fred K

    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

    Fred.

    (0) 
    1. Horst Schaude Post author

      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.  😀

      Bye,

         Horst

      (0) 
      1. Fred K

        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

        Fred

        (0) 
        1. Horst Schaude Post author

          Hello Fred,

          That’s nothing you are doing direct. 😀

          It the system, stupid. 😉

          So, create the incident.

          Sorry,

             Horst

          (0) 
  3. Puneet Mittal

    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.

    Regards,

    Puneet Mittal

    (0) 

Leave a Reply