Number Range Object-2

lightDetails of Number Range Object Creation, Interval Creation, Buffering, Warning

 

 

In the first post Number Range Object  we get to know what is number range in SAP & number range object.  In this post will create a number range object and its intervals and use this in application program to generate next number and other features.

To create a new number range object, go to the Tx- SNRO

1

Provide number range object name as – ZVECH_NUM and select Create button.

2

Provide the short text and long text.

For the field – Number Length Domain – It accepts only either NUM or CHAR type. Either you can enter data element or basic type. Here it is provided as NUM10 indicating that the number generated in a Numeric type with max length as 10.

% Warning – you can maintain a percentage here, so that the system would send a code when you reach that last percentage.

If the interval is from 1 to 100, then when the number range number generation reach at 90, the system send an appropriate code to the application program which can notify the user that the number range interval is about to be exhausted.

3

In the customizing tab, you can maintain the Buffering details.

4

Nothing to maintain here in our demo . Finally select Save.

5

So upto now a number range object is created with its features like its length, warning %, buffering etc. Now we have to create intervals.

6

Select Ranges button.

7

Select Edit Intervals button.

8

The below screen appears.

9

Provide a number range interval number as ’01’ and its range from  1 to 100. To create a new interval, select + button.

10

Provide interval no as ’02’ and its range from 101 to 200. Finally select Save button.

11

So upto now, we have created Number range object and its two intervals numbers 01 & 02.

12

The next part is how to use this in the application program. The FM – NUMBER_GET_NEXT’ can be  used to generated the next number.

The Fm accepts the Number range Object name and the interval number, to generate the next sequential number

13

Execute and here the first number is generated.

14

Execute again and here is the next number.

15

Now if you go to the Tx- SNRO and open the number range object ranges, for the interval ’01’ , the NR status is 10, but actually we generated the last number as ‘0000000002’. This is because of the buffering settings.

16

The buffer says 10 numbers are places in the buffer area.

17

To see the number range object details in the buffer area, execute Tx- SM56

18

From menu  select, Goto->Entries

19

Provide the client and the number range object name and continue.

20

Below are the details. we use the interval number as ’01’ and the current generate number is ‘2’ under column ‘STATUS’, the critical number is ’90’, as we have choose warning as 10%. So when it reaches 90 system sends outs a code to the application program by the FM- NUMBER_GET_NEXT. 

21


The number range generation by the FM, doesn’t always generates the next number always by a +1. This is controlled by the parameter QUANTITY.

22

If you don’t pass any value to it, it considers that the next number  to be generated is +1  of the last generated number.

23

We execute the program 3 times and we get the numbers as 7, next 8 and then 9.

242526

If we need a next number that is always a +10 of the previous number, then we can pass QUANTITY as 10.

27

So the next numbers are generated as 20 , 30 & 40.

282930


So we reached the next number as 93 for the interval 01 .

3132


For interval ’02’ we have reached 103.

3334


The SNRO details of the ranges.

35


The SM56 details of the number range buffer.

36


With the current buffer status, for the interval 01 the critical number range is 90 as we have specified warning % as 10. Now we have reached the number 95 means we are in the critical stage, then how to raise an warning message to the user.

37


The return code usually provide a code that corresponds to the critical stage or the last number of the number range.

Return code- 1  means we are in the critical stage according to the warning %.

Return Code- 2  means that is the last number of the number range interval.

The below program with a little change.

3839


We handle the code in the program and generate a warning/info message to the user.

40

41


Tx- SM56 details of the number range buffer., We already generated number 99, now the interval 01 end at 100.

42


If we execute the program again to generate the last number, then the system send out a return code as 2 and the program shows a proper message to the user.

4344


Tx- SM56 details about number range object buffers.

45


If we execute the program again, then the number range interval starts generating the number again from the start.

46

Tx- SM56 details.

47


 

Leave a Reply