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

Steps to create a Number Range.

Former Member
0 Likes
4,693

Can anyone please send me the steps to create a Number Range..Thanks in Advance

4 REPLIES 4
Read only

Former Member
0 Likes
2,745

Hi!

Defining number ranges can be performed always in customizing (SPRO).

For example customer orders, somehow like these, but not exactly (VA01)

- SPRO - Sales and distribution - Sales orders - Header data - Defining number ranges.

Here you can define and maintain the existing number ranges.

- SPRO - Sales and distribution - Sales orders - Header data - Defining document header.

Here you can assign the defined number range to the relevant document type.

Regards

Tamá

Read only

Former Member
0 Likes
2,745

Hi,

excample:

CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'

EXPORTING

object = 'ZRECAUDIT'

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 = 'ZRECAUDIT'

IMPORTING

number = last_id

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 = 'ZRECAUDIT'

EXCEPTIONS

object_not_found = 1

OTHERS = 2.

Otherwise you can do it with transaction SNUM for each object. Maybe Customer is object DEBITOR.....

This needs to be done in each system, is not allowed to transport

Regards

Nicole

Message was edited by:

Nicole Lorenz

Read only

Former Member
0 Likes
2,745

Hi,

1) Goto Tcode SNRO

2) select ur concerned OBJECT there.

3) Click on Number Ranges Push Button.

4) then click on Display Interval Button over there.

*****************************************************Other code

Create number range object using OYSN.

Then call the following function modules.

FORM get_next_id CHANGING p_discrep.

DATA: last_id LIKE zrecaudit-discrep,

quant LIKE inri-quantity, "dummy

code LIKE inri-returncode. "returncode

CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'

EXPORTING

object = 'ZRECAUDIT'

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 = 'ZRECAUDIT'

IMPORTING

number = last_id

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 = 'ZRECAUDIT'

EXCEPTIONS

object_not_found = 1

OTHERS = 2.

ENDIF.

ENDFORM. " get_next_id

Don't forget to reward if useful..

Read only

former_member196299
Active Contributor
2,745

HI SAI ,

here you go with the step by step procedure to create a number range !

go to transaction SNRO --> then give the name for the number range object Starting with Y or Z. give a short and long text .

provide the domain for Number length domain field ....

In length filed provide the length of the domain wht you mentioned earlier .

provide waining as 20% .

. save it and go back .

Here you will see an option in the application tool bar for INTERVALS . Click on that push button .

you can see 3 options . click on the one for creating intervals . onmce you click that you can see a small table kind of screen where you have fields like, Interval number , from and to ... and current number ...

to fill in the values cl;ick on the +interval pushbutton on your screen .

then provide the from and to number there ..

Thats all ...next save , check and activate this number range ...

n you can use this number range anywhere in your code ....

while using it in the program , to get the next number , use the FM NUMBER_GET_NEXT for getting the next number in the number range .

I hope it clears all your doubts ...

Reward if helpful !

Thanks

Ranjita