Here we are customizing existing Number sequence and convert it in to Fiscal year number sequence Many customer demands for Purchase order creation with automatic year means how to add year to a number sequence in AX2012, e.g. to generate IDs such as 2013-xxxxx and 2014-xxxxx, that would automatically use the current year. Some people understand that number sequence scopes should allow that, but they don’t know how, from very little bit of customization we can automate purchase order number sequence with year
Customize Purchase order Number Sequence Class:
Add fiscal calendar parameter in NumberSeqModulePurchaseIOrder (LoadModule) method as shown in below screen
datatype.addParameterType(NumberSeqParameterType::FiscalCalendarPeriod, true, true);
Load NumberSeqModulePurchaseIOrder (Load Module) method Through Job
NumberSeqModulePurchaseOrder NumberSeqModulePurchaseOrder = new NumberSeqModulePurchaseOrder();
Before going to run the Job, Remove purchase order existing scope parameter record in NumberSequenceDatatype table, if we don’t remove previous Purchase order scope parameter record it will not effect in Segment configuration as shown below
CEU/Organization administration/Number Sequence/ Segment configuration
Add Fiscal Year Relation to PurchParamater Table:
CEU/Procurement and sourcing/procurement and Sourcing parameters
We have customized procurement and Sourcing parameters form for Purchase order Fiscal Number sequence, because we need to select which Fiscal year the purchase order is created every year.
Add fiscal year table relation to PurchParamter table
Add a fiscal year Field on Procurement and Sourcing parameters form
Customize Purchase Order Number Sequence Table (PurchParameter):
Add following code in Purchase order Number sequence Parameter table method (numRefPurchId), in this existing method we have change code according to fiscal year.
static client server NumberSequenceReference numRefPurchId(TransDate _date = systemdateget())
select firstOnly PurchParameters; // get Selected fiscal year in
// procurement and Sourcing parameters Form
scope = NumberSeqScopeFactory::CreateDataAreaFiscalCalendarPeriodScope
Fiscal Year Number Sequence Configuration
General ledger -> Setup -> Fiscal calendars.
Create a new Fiscal year or use existing Fiscal year, but In our case we have created our own Fiscal year for Ten years because we need to create Purchase order automated for Ten years
If you want to add more years follow below screen.
Click the Calendar -> Calendar year -> New fiscal year button.
Change Copy from last fiscal year from ‘true’ to ‘false’.
Change Unit from ‘Months’ to ‘Years’.
Click the Create button.
Close the Fiscal calendars form.
Number sequences creation
Click Area Page node: Organization administration -> Common -> Number sequences -> Number sequences. Click the Number sequence -> New -> Number sequence button.
Change Number sequence code from ” to ‘POFiscal’.
Change Name from ” to ‘2013’.
Change Scope from ‘Shared’ to ‘Company and Fiscal calendar period’.
Change Company from ” to ‘ceu’.
Change Calendar from ” to ‘FiscalYear’.
Change Fiscal year from ” to ‘2013’.
Change Period name from ” to ‘Period 1′.
Make it very clear that we are creating PO number sequence for the year 2013 and we have to create PO number sequence again for Year 2014, 2015, 2016.xxxxxx 2023 with same Number sequence Code i.e. ‘POFiscal’ as shown in below screen for Year 2014
Creating Purchase orders:
Before going to create Purchase order make sure that Fiscal year must be selected in Procurement and sourcing Parameter form which we have customized earlier above
This selected Fiscal year must be same which we have selected in creating Purchase order Fiscal year Number Sequence.