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

Missing numbers in Number Range

Former Member
0 Likes
2,205

Hi all,

I have a requirement like this. When I do a standard process I need to generate batches depending on the cuts in the cable. I'm doing this using Number Range. After I get the batches I may save the document or may not save it. Suppose my first document generated batches 100,101,103,104. At the end if I dont save and exit for the next document the batches are coming as 105,106 ans so on. However since I didnt save earlier I need from 100. How can I do this?

Thanks&Regards,

Manjula.S

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,613

I am afraid this may not be possible as the FM NUMBER_GET_NEXT gets called and it incements the number range...

So this will happen unless you build in a custom logic where u manually count and decmrent that no..

Hi all,

I have a requirement like this. When I do a standard process I need to generate batches depending on the cuts in the cable. I'm doing this using Number Range. After I get the batches I may save the document or may not save it. Suppose my first document generated batches 100,101,103,104. At the end if I dont save and exit for the next document the batches are coming as 105,106 ans so on. However since I didnt save earlier I need from 100. How can I do this?

Thanks&Regards,

Manjula.S

6 REPLIES 6
Read only

Former Member
0 Likes
1,614

I am afraid this may not be possible as the FM NUMBER_GET_NEXT gets called and it incements the number range...

So this will happen unless you build in a custom logic where u manually count and decmrent that no..

Read only

mvoros
Active Contributor
0 Likes
1,613

Hi,

you can not recycle numbers from number range. Once you get it, it's wasted and there is no way how to return it back to number range. You can try to use similar technique which is used in SAP. You can assign temporary numbers to your batches such as $1, $2, $3 .... and during saving document you will replace these numbers by numbers from number range.

Cheers

Read only

Former Member
0 Likes
1,613

Hi Anuradha and Martin,

I Thank you both for the replies. Is there any other function module which can do this functionality?

Thanks&Regards,

Manjula.S

Read only

Former Member
0 Likes
1,613

Unfortunately i couldnt find any Fm to decrement a number range interval...You may need to study the NUMBER_GET_NEXT and develop a similar Z function module...

Read only

mvoros
Active Contributor
0 Likes
1,613

I don't think so. You have to understand that number ranges take care of concurrency. Hence you can have more application servers, more users running same program and SAP guarantees that you will get each number once. So generally implementing number range with possibility of returning number is really tricky thing and you have to be careful about concurrency. As I said, common approach how to avoid wasting numbers from number range is to use temporary numbers and during saving process replace these numbers by real numbers from number range.

Good luck

Read only

Former Member
0 Likes
1,613

Hi,

As I discussed earlier is there any way by which I can avoid gaps in the number range? Any other alternative is possible for number ranges?

Thanks,

Manjula.S