Application Development 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: 

New number range to match with production number

Former Member
0 Kudos

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.

Thanks,

Mahesh

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

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.

Regards,

Raymond

2 REPLIES 2

Private_Member_5521
Participant
0 Kudos

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.

regards

AJ

raymond_giuseppi
Active Contributor
0 Kudos

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.

Regards,

Raymond