Skip to content

Adding a new custom number sequence in standard modules using COC

Purpose

Adding a new custom number sequence in Account Receivable module

Accounts receivable – Setup – Accounts receivable parameters

Adding custom number sequence is possible using chain of commands.
below code snippet will shows how to add custom number sequence.

Step to add number sequence :

  1. Create a new extension class of table CustParameter and a new method.
[ExtensionOf(tableStr(custParameter))]
final class CustParameter_Extension
{
public static NumberSequenceReference custGroupId()
{
return NumberSeqReference::findReference(extendedTypeNum(custGroupId));
}
}

2. Create a new extension class of NumberSeqModuleCustomer.

[ExtensionOf(classStr(NumberSeqModuleVendor))]
final class NumberSeqModuleCustomer_Extension
{
    protected void loadModule()
    {
        NumberSeqDatatype datatype = NumberSeqDatatype::construct();
        next loadModule();
        datatype.parmDatatypeId(extendedTypeNum(custGroupId));
        datatype.parmReferenceHelp(literalStr("@SYS53981"));
        datatype.parmWizardIsContinuous(false);
        datatype.parmWizardIsManual(NoYes::No);
        datatype.parmWizardFetchAheadQty(10);
        datatype.parmWizardIsChangeDownAllowed(NoYes::No);
        datatype.parmWizardIsChangeUpAllowed(NoYes::No);
        datatype.parmWizardHighest(999999);
        datatype.parmSortField(1);
        datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
        this.create(datatype);
    }
}

3. Create a runnable class NumberSeqModuleCustRunnableClass which will load the number sequences.

class NumberSeqModuleCustRunnableClass
{
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        NumberSeqModuleCustomer   loadModule = new NumberSeqModuleCustomer();
        ;
        loadModule.load();
    }
}

4. Now, run the runnable class and then go to 

Organization administration – Number sequences – Number sequences – Generate Button (Run the wizard to complete the number sequence process)

Published inTechnical Blog