Please use the below code for edit method and make sure your field maximum length is 4. If it is not 4 then, please mention the maximum length number strRFix function.
edit str editFormattedNoFrom(boolean set, DDSetupDDDetail _DDSetupDDDetail, str enteredNo)
{
int taxNo;
if(Set)
{
taxNo = str2int(enteredNo);
_DDSetupDDDetail.SetupTaxNoFrom = taxNo;
}
else
{
taxNo = _DDSetupDDDetail.SetupTaxNoFrom;
}
return strRFix(int2str(taxNo), 4, '0');
}