Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create Number range

Former Member
0 Likes
11,055

I have to create a number range for OM ids . OM ids will be assigned to organistion units . OM ids will be unique and cannot be assigned to more then one org units . Please tell me the steps to create Number range which should start with 10000 till 99999.

Waiting for reply.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
9,732

Hi,

Just try this:


1. Run Tcode SNRO
2. Insert Object "Z_OM" and click button Create
3. Insert Short and Long Text ( this is your description for this Number Ranges Object )
4. In field Number length domain, insert: CHAR05.
5. In field Warning %, insert : 95.
6. In field No. of numbers in bufer: 1.
7. Click button Save
8. Click button Number Ranges ( F7 )
9. Click button Change Intervals
10. Click button Inser Interval ( Shift+F1)
11. Insert new interval: 
      No: OM.
      From Number: 10000
      To Number    : 99999
      And Save it (click Enter )
12. Save your interval.  

To get new number, you can use FM: NUMBER_GET_NEXT


  CALL FUNCTION 'NUMBER_GET_NEXT'
    EXPORTING
      NR_RANGE_NR = 'OM'
      OBJECT      = 'Z_OM'
    IMPORTING
      NUMBER      = NUMBER_RESULT.

Regards,

3 REPLIES 3
Read only

Former Member
0 Likes
9,732

Hi

You have to create a Number range object for that first and then define the number range for that object which you wants to use

Use the Transactions <b>SNUM and SNRO</b> for this purpose and create the number range.

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
9,733

Hi,

Just try this:


1. Run Tcode SNRO
2. Insert Object "Z_OM" and click button Create
3. Insert Short and Long Text ( this is your description for this Number Ranges Object )
4. In field Number length domain, insert: CHAR05.
5. In field Warning %, insert : 95.
6. In field No. of numbers in bufer: 1.
7. Click button Save
8. Click button Number Ranges ( F7 )
9. Click button Change Intervals
10. Click button Inser Interval ( Shift+F1)
11. Insert new interval: 
      No: OM.
      From Number: 10000
      To Number    : 99999
      And Save it (click Enter )
12. Save your interval.  

To get new number, you can use FM: NUMBER_GET_NEXT


  CALL FUNCTION 'NUMBER_GET_NEXT'
    EXPORTING
      NR_RANGE_NR = 'OM'
      OBJECT      = 'Z_OM'
    IMPORTING
      NUMBER      = NUMBER_RESULT.

Regards,

Read only

0 Likes
9,732

Thanks Guys

I had already done what 'Jatra Riwayanto ' suggested now . It is better if before getting the next number via FM 'NUMBER_GET_NEXT' we should lock the number range object using FM 'NUMBER_RANGE_ENQUEUE' and after getting the number unlocks the number range ob ject using FM 'NUMBER_RANGE_DEQUEUE' .

<b>Sample code</b>

CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'

EXPORTING

object = 'ZPOMID'

EXCEPTIONS

foreign_lock = 1

object_not_found = 2

system_failure = 3

OTHERS = 4.

IF sy-subrc = 0.

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = '01'

object = 'ZPOMID'

IMPORTING

number = NEXT_NUMBER

quantity = quant

returncode = code

EXCEPTIONS

interval_not_found = 1

number_range_not_intern = 2

object_not_found = 3

quantity_is_0 = 4

quantity_is_not_1 = 5

interval_overflow = 6

buffer_overflow = 7

OTHERS = 8.

CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'

EXPORTING

object = 'ZPOMID'

EXCEPTIONS

object_not_found = 1

OTHERS = 2.

ENDIF.

Thanks Buddies , full points awarded.