Number Sequence Creation:
Here I want to design a form named FirstForm with DataSource FirstTable
I want to create sequence like "AX00001---------AX99999".
Step 1
Create an EDT - String Type
So, I created an EDT named "AXSeqEDT" with label "AX Seq"
Drag into Table(FirstTable)àFields
Step 2
Now create a new Number Sequence
Path for creating num Sequence is
"Module:: Organization administration.......Common.........Number sequences......Number sequences"
Click on New(Number Sequence)
Now number Sequence form will be opened----That contains 4 sections.
Section 1.Identification.....Specify the NumberSeqCode and Name
Section 2.Scope Parameters... Select the Scope from the Dropdown
Section 3.Segments.... Add the constant and alphanumeric (by clicking the add button and selecting from drop down)
Section 4 .General.....Checkmark for continous and Specify the "smallest and largest and Next" Fields
Now Save Ur Settings
Step 3
Now add the Respective manual-code to class - NumberSeqModuleURMODULE
And Table - URMODULEParameters.
So I am creating number sequence based on HRM Module.....So iam using classNumberSeqModuleHRM and Table HRMParameters
Now go to AOT---Classes-NumberSeqModuleHRM---loadModule()
Add the code here...
Note::Here we can add the code seeing the existing implementation
The Added Code is::
/* setup discussion number sequence - it is global */
datatype.parmDatatypeId(extendedtypenum(AXSeqEDT));
datatype.parmReferenceHelp(literalstr("@SYS32633"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(99999);
datatype.parmSortField(12);
this.create(datatype);
Now Goto AOT---Tables---HRMParameters---methods-----click on new method
Add the code In the New method
Note::Here we can add the code seeing the existing implementation
The Added Code is
static client server NumberSequenceReference numRefAXSeqEDT()
{
return NumberSeqReference::findReference(extendedTypeNum(AXSeqEDT));
}
Step 4
In order to add our newly created number sequence reference to our Module write the following Job and Execute it
Below job is important to run because without it your new number sequence will not be available to number sequence form under Parameters. This is the change in behavior from AX 2009 where all new number sequence loads while restarting the Dynamic AX. In AX 2012 all the number sequence created to system while installation, so restarting the AOS wont effect in loading the new number sequence, that is why it is important to run the job to load new number sequences.
The Code added in The Job is
static void jobName(Args _args)
{
NumberSeqModuleHRM NumberSeqModuleHRM = new NumberSeqModuleHRM();
;
NumberSeqModuleHRm.load();
}
Step 5
After executing the Above Job, our newly created number Sequence reference "AX Seq" will be added to HRM Module----Number sequence setup form
Lets Check it
Now click on Number Sequence and Identify the newly created Number Seq Reference
After Identifying the Number Sequence Reference ----Allot the Number Sequence Code to the Number Sequence Reference.....By selecting from the drop down list
Step 6
Now add the Code in Create method of Forms Datasource methods
Goto-AOT-Forms-FirstForm-Datasources-FirstTable-Methods-Override method(Create)
public void create(boolean _append = false)
{
;
super(_append);
FirstTable.AXSeqEDT = NumberSeq::newGetNum(HRMParameters::numRefAXSeqEDT(),true).num();
}
Step 7
Now save all ur settings.....Now Open our form-FirstForm
No comments:
Post a Comment