Thursday 24 December 2015

Fiscal Year Number Sequence

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);
fk1

Load NumberSeqModulePurchaseIOrder (Load Module) method Through Job

NumberSeqModulePurchaseOrder NumberSeqModulePurchaseOrder = new NumberSeqModulePurchaseOrder();
NumberSeqModulePurchaseOrder.load();


fk2




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




fk3


Add Fiscal Year Relation to PurchParamater Table:

CEU/Procurement and sourcing/procurement and Sourcing parameters

fk4


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


fk5


Add a fiscal year Field on Procurement and Sourcing parameters form


fk6

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())
{
//
PurchParameters PurchParameters;
NumberSeqScope scope;

select firstOnly PurchParameters; // get Selected fiscal year in
// procurement and Sourcing parameters Form

scope = NumberSeqScopeFactory::CreateDataAreaFiscalCalendarPeriodScope
(curext(),FiscalCalendars::findPeriodByPeriodCodeDate(FiscalCalendar::findByCalendarId(PurchParameters.FiscalCalendar).RecId, _date).RecId);
//

return NumberSeqReference::findReference(extendedTypeNum(PurchId),scope);
}


fk7

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


fk8




If you want to add more years follow below screen.


fk9




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

fk10




Click Area Page node: Organization administration -> Common -> Number sequences -> Number sequences. Click the Number sequence -> New -> Number sequence button.




fk11




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′.




fk12






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






fk13

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




fk14






This selected Fiscal year must be same which we have selected in creating Purchase order Fiscal year Number Sequence.

No comments:

Post a Comment