SAP Knowledge Base Article - Public

3678812 - Inconsistent behavior of Modulo() function

Symptom

The Modulo() function is not taking correct value as parameter when a number with many digits is passed to it.

"Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental." 

Environment

SAP SuccessFactors Employee Central

Reproducing the Issue

1. Create a business rule that uses Modulo() function.
2. In the Modulo() function pass a parameter that has 18 digits or more.
3. Set up a rule trace.
4. Assign and execute the business rule.
5. Observe the rule trace, where Modulo() function takes incorrect parameter value.

A reference rule can be as below:


The rule trace will show as:

[Resolve]Resolve variable 'var_test_number' to value '732040440260111473', Duration: 3883 microseconds.
[Function]Call function 'modulo' with parameters '732040440260111488, 97'. Result: '16.00000000000000000000'. Duration: 79 microseconds.

Cause

The issue arises due to precision problems in the Java code because the "Long" data type returned by toNumber() function needs to be converted into "BigDecimal" type for Modulo() function.

Resolution

The engineering team will correct the code by using a different Java method in the release 1H2026.

Workaround:

  • Add ".0" to the end of the number being passed to the Modulo() function.
  • This ensures that the result of toNumber() is interpreted as a decimal number (e.g., 732040440260111473.0), which avoids the precision error during the conversion process.

A reference rule can be as below:


The rule trace will show as below:

[Resolve]    Resolve variable 'var_testNumber' to value '732040440260111473.0', Duration: 401 microseconds.
[Function]    Call function 'modulo' with parameters '732040440260111473.0, 97'. Result: '1.00000000000000000000'. Duration: 29 microseconds.

Keywords

 INC16410483, RUL-11228, COD0436205, modulo function, Modulo(), business rule, toNumber function, toNumber(), BigDecimal conversion, precision error, concatenate function, Concatenate(). , KBA , LOD-SF-EC-PAY , Payment Information (Bank Information) , LOD-SF-EC , Employee Central , Known Error

Product

SAP SuccessFactors Employee Central 2505 ; SAP SuccessFactors Employee Central 2511