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

Changing the number range

Former Member
0 Likes
3,923

Hello all,

I have an object zpalnum and have defined number range for the object.

Now when the user prints the number(barcode), the current number(in tcode SNRO) should get updated by the last printed number. For this i need to update table NRIV-NRLEVEL .

I used a function module NUMBER_RANGE_INTERVAL_UPDATE.

But the NRIV table is not getting updated.

How can i do it?

Hello all,

I have an object zpalnum and have defined number range for the object.

Now when the user prints the number(barcode), the current number(in tcode SNRO) should get updated by the last printed number. For this i need to update table NRIV-NRLEVEL .

I used a function module NUMBER_RANGE_INTERVAL_UPDATE.

But the NRIV table is not getting updated.

How can i do it?

4 REPLIES 4
Read only

former_member404244
Active Contributor
0 Likes
2,064

Hi,

see the belwo sample code and try

Example ABAP program to update number range

&----


*& Report Z0RANGENO *

*& *

&----


*& *

*& *

&----


REPORT z0rangeno.

DATA: wnorange LIKE inri-nrrangenr, "number range,

wobject LIKE inri-object, "object

wsubobj LIKE inri-subobject, "sub object

wtoyear LIKE inri-toyear,

wdocno(12).

wnorange = '01'.

wobject = 'Z0TEST'.

wtoyear = '2006'.

CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'

EXPORTING

object = wobject

EXCEPTIONS

foreign_lock = 1

object_not_found = 2

system_failure = 3

OTHERS = 4.

IF sy-subrc NE 0.

  • message e086 with 'Lock error' sy-subrc.

ENDIF.

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = wnorange

object = wobject

subobject = wsubobj

toyear = wtoyear

IMPORTING

number = wdocno "Number generated by SAP

EXCEPTIONS

interval_not_found = 1

number_range_not_intern = 2

object_not_found = 3

quantity_is_0 = 4

quantity_is_not_1 = 5

internal_overflow = 6

OTHERS = 7.

IF sy-subrc NE 0.

  • message e086 with 'Number Range' sy-subrc.

ENDIF.

CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'

EXPORTING

object = wobject.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Regards,

Nagaraj

Read only

0 Likes
2,064

Thanks for the prompt reply.

Actually i dont need to generate the next number. I have the number to be updated in the current number field of tcode snro.

I have to update NRIV table(field NRLEVEL).

Read only

0 Likes
2,064

Hi,

Check the FM "NUMBER_RANGE_OBJECT_UPDATE".

Regards,

Nagaraj

Read only

Former Member
0 Likes
2,064

To update the number range interval or "currently used" number in tcode SNRO I used the function module NUMBER_RANGE_INTERVAL_UPDATE.

The changes are not written directly

to the database but included in local memory first. By calling up the function module NUMBER_RANGE_UPDATE_CLOSE, the contents of the local memory is written to the database.