Issue with check numbers when exceeding the upper limit of a 32-bit integer
Problem:
When attempting to process a check which exceeds the upper limit of a 32-bit integer the following message is displayed: “The value is not within the range. Acceptable values are within the range 0 – 2147483647.”
Resolution:
To resolve this issue the following changes can be made.
1. Create a new 64-bit Extended Data Type to be used for checks
a. From the AOT navigate to \Data Dictionary\Extended Data Types
b. Right-click and select New -> Int64
i. Name = BankChequeStartNumInt64
ii. Label = @SYS23068
iii. HelpText = @SYS23068
iv. FormHelp = BankChequeLookup
v. DisplayLength = 10
vi. ConfigurationKey = BankCheque
c. Save the Extended Data Type.
2. Update NumberSeq Class to handle the new 64-bit integer
a. \Classes\NumberSeq\numInsertFormat
From:
public static client server Num numInsertFormat(Integer num,
NumberSequenceFormat format
)
{
;
if (format == '')
return int2str(num);
if (!strfind(format, #SymbolLetters,1,999))
return NumberSeq::numInsertFormatInternal(int2str(num), format);
return NumberSeq::numInsertFormatLetters(num, format);
}
To:
public static client server Num numInsertFormat(Int64 num,
NumberSequenceFormat format
)
{
;
if (format == '')
return int642str(num);
if (!strfind(format, #SymbolLetters,1,999))
return NumberSeq::numInsertFormatInternal(int642str(num), format);
return NumberSeq::numInsertFormatLetters(num, format);
}
3. Update NumberSeq Class to handle new 64-bit integer.
a. \Classes\NumberSeq\numRemoveFormat
From:
public static client server Integer numRemoveFormat(Num num,
NumberSequenceFormat format
)
{
Integer x;
Integer val = 0;
if (!format)
return str2int(num);
...
To:
public static client server Integer numRemoveFormat(Num num,
NumberSequenceFormat format
)
{
Integer x;
Integer val = 0;
if (!format)
return str2int64(num);
...
4. Update BankChequeCreate Class to handle the new 64-bit integer
a. \Classes\BankChequeCreate\dialog
From:
public Object dialog()
{
DialogRunbase dialog = super();
dialogFromNegInstNum = dialog.addFieldValue(typeid(BankChequeStartNum), fromNegInstNum, "@SYS4083");
dialogFromNegInstNum.lookupButton(0);
...
To:
public Object dialog()
{
DialogRunbase dialog = super();
dialogFromNegInstNum = dialog.addFieldValue(typeid(BankChequeStartNumInt64), fromNegInstNum, "@SYS4083");
dialogFromNegInstNum.lookupButton(0);
...
5. Update BankNegInstCreate Class to handle the new 64-bit integer
a. \Classes\BankNegInstCreate\classDeclaration
From:
abstract public class BankNegInstCreate extends RunBase
{
BankAccountTable bankAccountTable;
NumberSequenceFormat format;
CompanyBankAccountId accountID;
BankNegInstStartNum fromNegInstNum;
BankNegInstQty numOfNegInst;
DialogField dialogAccountId;
DialogField dialogFromNegInstNum;
DialogField dialogNumOfNegInst;
#DEFINE.CurrentVersion(1)
...
To:
abstract public class BankNegInstCreate extends RunBase
{
BankAccountTable bankAccountTable;
NumberSequenceFormat format;
CompanyBankAccountId accountID;
BankChequeStartNumInt64 fromNegInstNum;
BankNegInstQty numOfNegInst;
DialogField dialogAccountId;
DialogField dialogFromNegInstNum;
DialogField dialogNumOfNegInst;
#DEFINE.CurrentVersion(2)
...
b. \Classes\BankNegInstCreate\parmFromNegInstNum
From:
public BankNegInstStartNum parmFromNegInstNum(BankNegInstStartNum _fromNegInstNum = fromNegInstNum)
{
To:
public BankChequeStartNumInt64 parmFromNegInstNum(BankChequeStartNumInt64 _fromNegInstNum = fromNegInstNum)
{
c. \Classes\BankNegInstCreate\run
From:
public void run()
{
#OCCRetryCount
BankNegInstStartNum toNegInstNum;
BankNegInstNum negInstNum;
;
To:
public void run()
{
#OCCRetryCount
BankChequeStartNumInt 64 toNegInstNum;
BankNegInstNum negInstNum;
;
6. Update CustVendCheque class to handle the new 64-bit integer
a. \Classes\CustVendCheque\classDeclaration
From:
class CustVendCheque
{
CompanyBankAccountId accountId;
ChequeNumMethod chequeNumMethod;
BankChequeStartNum nextChequeNum;
BankChequeStartNum firstChequeNum;
BankChequeNum chequeNum;
...
To:
class CustVendCheque
{
CompanyBankAccountId accountId;
ChequeNumMethod chequeNumMethod;
BankChequeStartNumInt64 nextChequeNum;
BankChequeStartNumInt64 firstChequeNum;
BankChequeNum chequeNum;
Comments
- Anonymous
August 08, 2014
Sir, Thank you for this.
Does it work in AX 2012 R2? because as after I have done this steps, I did not get the right value.
Example: 5820500300, it prompt that it was created, but 2147483644 was register in BankChequeTable.
Thanks ahead.