According as a test, the below detail can create a number sequence in Axapta.
1, Basic->Setup->Number Sequences-> Number Sequence Form.
Create a NS code such as "SN_TEST" from 1 to 999999 and format is SN_######.
2, Create a job to enable InUse button.
NumberSequenceTable _ns ;
ttsbegin ;
while select forupdate _ns where _ns.NumberSequence == 'SN_Test'
{
_ns.InUse = NoYes::Yes ;
_ns.update() ;
}
ttscommit ;
3, Create an EDT named 'IDTest' and extends is num.
4, Create a table named HDSH_SNTest and has two field, one is IdTest (EDT is IDTest) and another is name (EDT is name)
5, Create a Form and DS is HDSH_SNTest. Display two fields in a Grid
6, First confirm which module do want to add this SN. Such as Production. Pls look for a class name 'NumberSeqReference_Production'
In protected void loadModule() method add the code as below:
numRef.dataTypeId = typeId2ExtendedTypeId(typeid(IdTest)); // from EDT
numRef.referenceHelp = literalstr("NS Test");
numRef.WizardContinuous = false;
numRef.WizardManual = NoYes::Yes;
numRef.WizardAllowChangeDown = NoYes::No;
numRef.WizardAllowChangeUp = NoYes::No;
numRef.sortField = 9; // is order
this.create(numRef); // create a SN in parameter of production
7, In DS of HDSH_SNTest form, Add the below code:
public void initValue()
{
super();
HDSH_SNTest.IdTest = Numberseq::newGetNum(prodparameters::numRefSNId()).num() ;
}
OK, all are OK.