I create new material via the function module BAPI_MATERIAL_SAVEDATA. This works in case I know a free material number. The companies uses usually specific number ranges, the next free number is created in this case from SAP (I guess, I'm not a SAP expert)
Anybody knows a function module which return the next free material number?
SNRO is the transaction you have to refer for understanding number ranges, for Material master the number range is MATERIALNR, then use the NUMBER_GET_NEXT function module by required parameters, the function module documentation is the best place to understand how to use this function module, the next place to look at will be a where used list.
I call BAPI_STDMATERIAL_GETINTNUMBER and require 5 numbers and get for example the numbers: 10,11,12,13,14.
But I never use these numbers. The next day I call BAPI_STDMATERIAL_GETINTNUMBER again and get the numbers: 15,16,17,18,19
It is fine that SAP "blocks" or "locks" these numbers so the no other user can reuse the same numbers. But it can occure that I locked the nummbers by error.
Are there any way to unlock these numbers again?
SAP uses the standard buffer logic, it writes e.g. 10 numbers into a buffer and updates the number range just once. and next time it takes it from buffer except, precondition the buffer still exist. An unused number from the buffer will be lost if the buffer gets deleted.
Only option you have is to change the buffers for your material number in SNUM object MATERIALNR
as far as I remember, unused numbers from the buffers are returned but I don't know exactly when. I worked in a project some years ago where the number range buffer was increased to 1000 to enable fast parallel IDoc processing (number range object is locked when a number is drawn).
I wondered why on one day numbers bigger than 1000 where drawn in the development system and the next day it was like numbers below 20.
One of the guys explained to me that the buffers are freed from time to time and then the numbers are available again.
Probably not really essential but still interesting and important: Too many numbers might get lost when working with large buffers.