Skip to Content
avatar image
Former Member

New number range to match with production number

Hi Experts,

We have a requirement from the customer as below-

BDENR field in the BLPK table get updated every time the production posting happens. The problem here is that if multiple users are accessing the same transaction at the same time, the BDENR number gets duplicated as currently we are using "last entry+1" logic in the z-program which is incorrect.

The requirement now is to use the SAP number range object to achieve the locking mechanism to avoid the duplication.

Now our problem is how the newly created number range should be in sync with the existing numbers in the production as the numbers gets updated on daily basis.

For eg. New number range will be from 1000 to 9999

The latest BDENR in production is for eg. 5000

Using this number range, next number to be updated in BDENR should be 5001 after moving changes to production.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 28, 2015 at 01:58 PM

    After transport ( Interval -> Transport) number ranges are overwritten with transported values, you have usually to manually set the current number in SNRO transaction or transport a value with a safety value (here not 5001, but 6000 or 5100 to prevent duplicate keys, accepting gaps in number range)

    Hint: you could consider creating a small report that will update NRIV and be executed during import, transport an entry  of type XPRA PROG <program_name> so it will execute in mandt 000 during import, you may use CLIENT SPECIFIED options in it.



    Add comment
    10|10000 characters needed characters exceeded

  • Oct 28, 2015 at 01:48 PM

    HI Mahesh

    When you need to create sequential numbers in Z custom programs, the best way to do it is by creating a Number range Object in transaction SNRO.

    If you have already identified field BDENR as the data element type that you want to use, then define a new number object with that data type.

    Within the Z program, just invoke the function module NUMBER_GET_NEXT to acquire a non-duplicated ID, using the above tools you will easily avoid having any issues from concurrent users using your application.



    Add comment
    10|10000 characters needed characters exceeded