‎2011 Sep 07 2:46 PM
We would like to generate a unique numeric value to represent an external invoice number. This number begins with the current date followed by the next number in the sequence 0-9999 e.g. 201109070001. The sequence needs to be reset to 1 at the start of each day.
We currently use a program to select and update a database table which stores the date and next number in the sequence for a given day and finally reset the number at the start of each day. Unfortunately we sometime experience duplications of the invoice numbers.
I've tried using a SAP number range object (transaction SNRO) but I can't find a function to reset the number.
Is there a function to reset a SAP number range object or an alternate method to obtain the required results?
Thanks,
Nicholas
‎2011 Sep 07 3:08 PM
‎2011 Sep 07 3:08 PM
‎2011 Sep 07 3:21 PM
‎2011 Sep 07 3:35 PM
At first, sorry if i sound any harsh or what, thats in no way intended. I´m just a technician.
What i dont get is, why you dont just do that yourself. either create a table or make use of a TVARVC variable where you store your last number, along with the date where it was created/used.
you can easily write a FM which does what NUMBER_GET_NEXT does. Means if a number is requested, goto your table or TVARVC variables (yeah two, one for number, one for the date), and check what number you got there.
If date = sy-datum then increment number by one, store it to your table/TVARVC variable, and return that number as an exporting parameter.
elseif date # sy-datum then store 1 and your new date in your table/TVARVC variables and return it as exporting parameter.
As it would be a FM of your own, soleley for this purpose you can even return a concatenated value of sy-datum and your number, instead of just the number.
I would estimate a maximum workload of one hour for such a solution, and it would exactly do what you need.
hope you got my drift.
‎2011 Sep 07 3:50 PM
Florian, your suggestion is what we currently have in place and for the most part it is works. However, every once an a while we find orders with the same invoice number. This number is suppose to be unique for each external invoice.
I'm trying to eliminate all chances of duplicated invoice numbers and using a number range object seems to be my best bet.
‎2011 Sep 07 3:56 PM
Are you locking your number range table while you get the next number and update it?
Rob
‎2011 Sep 07 7:34 PM
The table isn't locked. How do I go about locking?
Please note it is frequently accessed.
‎2011 Sep 07 7:45 PM
Locking tables is pretty basic. Please search the forums for ideas.
Rob