hi MSDAX ,
Hope this code might be helpful to u for creating an number sequence number for your po. I have tried this and it worked for me.
Regards ,
Himanshu
Steps to create Sequence number in Ax
Step 1 :
Create an EDT - String Type
So, I created an EDT named “AXSeqEDT” with label “AX Seq”
Step 2 :
Drag new created AXSeqEDT sequence number into our table Fields.
Step 3 :
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)
Or just don’t change anything if generating an error and go to next step
· Section 4 .General…Checkmark for continuous and Specify the “smallest and largest and Next” Fields
Now Save Ur Settings
Step 4 :
Now go to AOT—Classes-NumberSeqModuleHRM—loadModule()
The Added Code is::
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);
Step 5:
Now Goto AOT—Tables—HRMParameters—methods-----click on new method
The Added Code is
static client server NumberSequenceReference numRefAXSeqEDT()
{
return NumberSeqReference::findReference(extendedTypeNum(AXSeqEDT));
}
Step 6 :
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 7 : (Not imp Step to follow)
After executing the Above Job, our newly created number Sequence reference “AX Seq” will be added to HRM Module----Number sequence setup form
If you go to Organization administration…Common…Number sequences…Number sequences"
And find your sequence number and click on Generate. You will c that your sequence number AxSeq is listed.
Step 8 :
Go to Design and select an String control and give the data source name and set data field name as extended data type field name which was drag and drop into table.
Select Button Control and wrote the Step 9 code into button Clicked Event
Step 9 :
write this code on button click event to generate Sequence number on click of button
public void create(boolean _append = false)
{
;
super(_append);
FirstTable.AXSeqEDT = NumberSeq::newGetNum(HRMParameters::numRefAXSeqEDT(),true).num();
}
Step 10 :
Now save all your settings…Now Open our form or run the form and click on button to create or generate automatic number sequence