Symptom
You are working on a custom field and receive error upon saving: 'Only X digits before the decimal point and Y decimal places permitted.' for a field with Decimal Annotation.
Environment
- SAP Cloud Application Studio
- SAP Cloud for Customer
- SAP Business ByDesign
Reproducing the Issue
- Set the value for a PDI field with Decimal Annotation.
- Save the changes.
- Error is raised.
Cause
When using Decimal Annotation, there are two parameters which should be set as below:
[Decimal (x,y)]
x = Total digits allowed
y = Number of digits allowed after decimal point
Now for example, if you make use of the annotation as below:
[Decimal (7,2)]
This means that 2 digits will be reserved for after decimal point. Since 7 digits is the total, this means there are still 5 digits remaining to be used in front of the decimal point.
Therefore, for the parameters on the example above, if you try to set the value to 123456 or 1234.567, the system will prompt the error. That’s because 123456 contains 6 digits before the decimal point, and 1234.567 contains 3 digits after decimal point.
In case the value is set as 12345, or 1234.56, both would be allowed, as it does not exceed the number of digits set on the first and second parameter of the annotation.
Resolution
- Ensure that the total digits set to the element does not exceed the value set as first parameter on Decimal Annotation (Note that the numbers after the decimal point are also counted for the first parameter)
- Ensure that the digits after the decimal point does not exceed the value set as second parameter on Decimal Annotation
See Also
Keywords
Decimal Annotation, digits before decimal , KBA , AP-RC-BDS-BO , ByDesign Studio BO definition/generation , How To