SAP SuccessFactors Employee Central, SAP SuccessFactors HXM Core

How to Validate Bank Accounts or Work Permit Documents Using Business Rules in Employee Central

Business Scenario

Sometimes we have a requirement to validate a number containing N digits with an additional validation (or verification) digit. An example is the bank account number of different banks in some countries, where we need to weight each digit with a specific number, sum all the results, apply a Modulo 10 or 11 function and perform some additional calculations to find the validation digit.

A similar requirement may also exist for National Id or Work Permit document number for some countries.

For example, a valid account number of a bank in Brazil (each bank has their own account number validation logic) is:

  • 0238069-2, where 0238069 is the main account number and the rightmost digit (2 in this example) is the validation digit, which is calculated with the following steps:
    • Distribute weights from 2 to 7 on the main account number digits (from right to left);
    • Multiply each digit of the main account number by the corresponding weight defined in the previous step;
    • After the multiplication, sum all results obtained in the previous step and calculate the Modulo 11;
    • If the remainder is equal to 0, the validation digit will be 0;
    • If the remainder is equal to 1, the validation digit will be P;
    • If it is neither 0 nor 1, subtract the remainder from the divisor (11 in this example) to obtain the validation digit (11 – Remainder).
  • For the above example, we would have:

0 2 3 8 0 6 9 -> main account number

x x x x x x x

2 7 6 5 4 3 2 -> weights


0 14 18 40 0 18 18 -> multiplication results for each digit of main account number

Sum all values obtained in the previous step: 0 + 14 + 18 + 40 + 0 + 18 + 18 = 108

Calculation of Modulo (11) for 108 = 9 -> remainder of the division of 108 by 11

As the result is neither 0 nor 1, the validation digit in this case will be: 11 – 9 = 2

Solution Overview

The bank account of an employee in Employee Central is stored using the Payment Information block, which is replicated to Employee Central Payroll for the salary payments after the payroll is run.

Employee Central has some pre-delivered validations, but in many cases they are not enough, because, depending on the country and bank, we might have different validation digit calculation logic for the bank account numbers.

To avoid incorrect bank data, causing inconveniences like the employee not getting paid correctly, we can implement business rules, leveraging the existing rule functions to validate the bank account numbers.

Configuration Details

Step 1 (Optional):

For this example, we will create two custom fields for Payment Information for the end user to enter the bank account number in two separate fields, but this step is not mandatory as the rule can be adjusted to work only with the standard Account Number field:

  • Custom field named “Account Number (Without Validation Digit)” under Payment Information Detail object
  • Custom field named “Account Validation Digit” under Payment Information Details BRA object

The fields will look like as follows:

Step 2:

In this step we will create the validation business rule. First, we will create a variable containing the weighted sum of each digit of the main account number (the“Account Number (Without Validation Digit)” field of our example). The rule function Digitsum() is used for the calculation, as shown below:

As the Digitsum() function works with numbers, we need to convert the “Account Number (Without Validation Digit)” field from string to number. Notice that we are concatenating a 1 at the beginning, because the account number can have leading zeroes (which are automatically removed when the string is converted to a number) and the Weight parameter of Digitsum() function is applied from left to right to the Number parameter (as we are using the first Weight = 0, it will not affect the final result).

Considering our sample account number, 0238069-2, we will have:

  • “Account Number (Without Validation Digit)”: 0238069
  • After the Concatenate() and To Number() functions, we will have: 10238069
  • The result of Digitsum() will be: 1×0 + 0x2 + 2×7 + 3×6 + 8×5 + 0x4 + 6×3 + 9×2 = 108

Now we need to calculate Modulo 11 of this result using the Modulo() function. According to the business requirement:

  • If the result is zero, the “Account Validation Digit” must be zero
  • If the result is 1, the “Account Validation Digit” must be P
  • Otherwise, the “Account Validation Digit” must be equal to 11 minus the result of Module 11, calculated using Modulo() function

If the above conditions are not satisfied, then raise an error message:

Step 3:

Assign the business rule to the Payment Information object:

Final Result

After the configuration steps are complete, we can test the solution.

Using the same example, if the “Account Number (Without Validation Digit)” is 0238069, then the system expects the “Account Validation Digit” to be equal to 2.

If we enter, for instance, “Account Validation Digit” = 0, the result will be:

If we enter the correct data, i.e., “Account Validation Digit” = 2, the result will be: