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

number range object

Former Member
0 Likes
3,296

how to use number_get_next using snro .can u tell me briefly

thanks in advance

6 REPLIES 6
Read only

Former Member
Read only

Former Member
0 Likes
2,193

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.

Read only

Former Member
0 Likes
2,193

Hi,

Create a Number range object in SNRO and assign the number ranges.

While saving the custom module pool program, call the FM Number_Get_Next and pass the parameter number range object and number range NR.

number range NR is nothing but the number , that you have given for the range of numbers.

Regards,

Read only

Former Member
0 Likes
2,193

Hi ajay,

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

Read only

Former Member
0 Likes
2,193

Hi,

Let me tell you in brief how to use number_get_next.Pls copy the below code

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = gc_nr

object = gc_nr_obj

IMPORTING

number = lv_obj_id

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.

Before using this code dont forget to declare gc_nr and gc_nr_obj.Now go to snro transaction and create a number range object and specify the intervals.Now onwards every time you invoke the function module the value gets incremented by 1 and will be stored in the variable lv_obj_id.Let me know if you still have doubts.

Pls reward points if found useful.

Thanks

Shyam