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?
Thanks
Thomas
function module NUMBER_GET_NEXT
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.
Standard Material - BAPI_STDMATERIAL_GETINTNUMBER
Retail Material - BAPI_MATERIAL_GETINTNUMBERRET
Both calls NUMBER_GET_NEXT internally
Thanks guys, Thomas
I have another question related the number ranges.
Are there any way to "unreserve" or "unblock" numbers returned by BAPI_STDMATERIAL_GETINTNUMBER?
Sorry , I did not understand the term Unreserve/ Unblock. Could you please put it in technical terms ![]()
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?
These functions just returns the next number in the series but it does not create a material. Once the number is given then we cant do nothing about it( This is what I know ). The previous no cannot be retrieved back.
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
Thanks
Hi,
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.
Regards Clemens
good to know :-)
Thanks Thomas