outra9e
7th January 2002, 17:18
Can anyone tell me the domain for an autonumber?
As records are added I want the record to have an automatic, sequential number allocated.
Any ideas as to the domain I need to be allocating this field?
Cheers guys
evesely
7th January 2002, 17:44
How large do you want this number to get? If you want certain constraints on the number, then tcsern or tcorno (or something similar might be appropriate). If not, you could use long (also tcmcs.long) or even a double if you want to get really big (even though you might have to dance around some floating point issues there). The burden really falls on your code to find the next number and enforce limits, although there are some Baan functions that could help in this regard.
Was that vague enough? :cool:
svrahul
16th January 2002, 07:47
Hi,
Regardless of the domain to be used for the auto number, the
'first free number' dll (tcmcsdll0004) is most often used, for auto number generation. The library contains code to generate a sequence number, based on the previous number being used, the series being used for a certain kind of documents.
One maintains the series to be used in the table tcmcs0147 and this can be done thru the session tcmcs0147m000 (Maintain first free numbers).
I will be glad to provide more information if required.
Regards
Rahul
outra9e
21st January 2002, 18:37
This sounds very promising.
So I need to use a subsession of first free number?
I am not sure how u mean to do this.
Can u elaborate please? Im a bit of a rookie unfortunately!!!
Cheers
evesely
21st January 2002, 19:06
You need to get your "Type of number" and "Series" into table tcmcs047. You can (1) use an existing "Type of Number" and create a new series via the tcmcs0147m000 session (this may get confusing if your type of number doesn't really fit an existing choice), (2) Modify the domain tcckon to add a new "Type of Number" that fits your needs (you might want to try a large enumeration constant so that Baan doesn't use your in some future update) and then create the series and first number in tcmcs0147m000, or (3) Enter your tcmcs047 data via General Table Maintenance (Dangerous precedent :eek: ).
Once the data is in table tcmcs047, you can make a call to the tcmcsdll0004 library to get the next number (and automatically update the table). This is done via:
tcmcs.dll0004.read.default.number(series, output_number, type_of_number, max_number_length,
series_length, batch_active, batch_error_number)
Example for sales order series 12:
tcmcs.dll0004.read.default.number(12, output_number, tcckon.act.sls, 6, 2, 0, 0)
svrahul
22nd January 2002, 13:30
Hi,
Let me get a bit further illustrative. Take this example:
In the distribution module, when purchase orders are to be created, the parameter "series in order numbering" can be set to one digit, two digit or None, via session tdpur4100m000. (I must confess that I dont know the usefullness of such a classification based on the number of digits). But once you set this field tdpur000.serp.4 to "two digits", you can use 99 different series of purchase orders (with numbers from 01 to 99), allowing you to group your purchase orders in 99 criteria. More often than not this must be sufficient to meet any business requirements.
But to be able to use all these series, they must be entered in the tcmcs047 table (by hook---session Maintain First free numbers tcmcs0147m000) or by crook (General table maintenance) :p . The reason why you call this session the first free number session is, that you can give the number at which orders in a particular series start. Thereafter, the system regularly updates the first free number and gives you the next number and updates the first free number for the series in question. All that you must be able to do to use this functionality is to understand the first free number dll.
I tried to be very clear. If I were not so somewhere, please shoot your question. I will try to find out the answer.