How to Restart document sequece every month for document type?
hi kiendxvn1984 (a real name would be better),
this requires code modification.
In the window Document Sequence you can theoretically define to restart the sequence every year by activating the field StartNewYear. Practically, this is not implemented, as the call hierarchy of the field within class X_AD_Sequence shows.
Though there is a process called UpdateSequenceNo, which expectedly would update the sequence once a year, it has to be called manually and moreover it doesn't update the table AD_Sequence, but AD_Sequence_No (other opinions?).
So IMO the easiest way would be to add a field (e.g. StartNewMonth) at window/table AD_Sequence, and create a process similar to UpdateSequenceNo, which changes the sequence once a month.
I didn't understand Mario,
Does this function "Restart sequence every Year" works or not? After I check this field it asks to put value in "Date Coloumn" field ( what shoud be entered here? ). I was thinking that I was doing something wrong?
I wrote the post looking in the code for StartNewYear just as an object, not as a string.
After reading your post, I looked for it as a string: it is used in MSequence.getDocumentNo(); also in MSequence.getPreliminaryNoByYear(), which uses the entry of table MSequence_No. This table is the one used in the process UpdateSequenceNo. So the renumbering every year seems to work after all, if you call the process manually, though I haven't tested it.
Sorry for misguiding you. Another lesson for me to look for all possibilities before posting. On the other hand, I hadn't used it, so it is good to know how it works.
Thanks Mario, no problem at all.
I have tried to use this option but when New Year comes nothing happens it just continue to count as it was . So I was wondering is there somebody who use this - I am not sure what to put in "Date Coloumn" field?
as I wrote before, according to the code, you must run manually the process UpdateSequenceNo. There, you set the starting sequence for any year with the value of StartNo of the sequence table.
Notably, if the process UpdateSequenceNo ran, the sequences are generated in the Callouts for InOut, Invoice and Order, so it seems that only these documents can restart sequences yearly.
Also, if you leave the DateColumn empty, the Callouts try to get the sequence of the actual year. Otherwise, the year of DateColumn.
Well this is only theory. It should be tested to know the truth.
Thanks if I do somethuing about this I will let you know