# SuccessFactors Document Generation Amounts in Words

Hello,

Writing this blog post to share with you a solution for displaying the Salary amount in words while you generate documents in Employee Central Document Generation.

In Most of organizations and for legal requirements Official HR Documents Like HR Letter, Employment Contract and so on, it is mandatory to have the agreed on Salary whether gross amount or broken down to Pay Components written in both Number and Words.
For Example 1450 (Only One Thousand Four Hundreds Fifty)

This feature is not available out of the box in SuccessFactors Document Generation and you cannot find in Business Rule Engine a function that converts Amounts from Numbers into Words.

The blog post explains a solution to display Amount in Words in Documents

Solution in brief

1. Creating a lookup table to map the number to equivalent words (Custom MDF Object). The MDF includes the number and the equivalent text.
2. A business rule using (Lookup) function to return the wording of the number.

Solution Implementation Description

Before starting solution implementation you have to consider the following points

• Discuss with the Customer the number ranges of current salaries and the expected increases in the coming years
• This solution can handle the fractions if the Basic Salary or Gross Pay Components those will be displayed in the documents contains fractions (Cents for USD)
• The solution is built based on an assumption that there is a good knowledge of document generation function as it will not get deeper in document generation steps

Step 1:

Create a custom MDF object (i.e. NumtoWords) as a lookup table contains the following fields

• Number (Type Should be “Decimal” similar to Amount field in Compensation or Pay Components field)
• Words or Text “String” (Can be repeated for multiple languages)

Step 2

Prepare a CSV file to fill the lookup table with the number and text (You can search for functions available on the internet to assist you in preparing the file). then upload the file.

Step 3

Now it is time to write the rule to populate the Text or Words value of the Amount.You will need to create a rule for each Number will appear as a text also you will need a separate rule for each language

Assuming you have already maintained the Placeholders of the Amount ([Amount]) and ([AmountinWords]) in Document Generation Template. Also the fields are maintained in Configure Object definition – Document Mapping Rule Result

The rule simply lookup in the MDF object created in Step 1 getting the equivalent Text of the amount of i.e Basic Salary

After creating the rule you will assign the rule to the Placeholder ([AmountinWords]) in Document Generation – Manage Document Template Mapping

You are ready now to generate a document (HR with both Amount in Number and Amount in Words

=================================================

Thanks for SAP SuccessFactors Business Rule Engine which enabled us to even find a solution for handling fractions

How to handle fractions – overview

The rule that converts the Number into Words will be changed as follow

1. Creating Two Variables (one for integer and one for fractions) using Round() and Modulo() functions
2. If there is no fractions the rule will convert the integer into words then add the currency using Format() function
3. If there is fractions the rule will convert the integer into words adding the currency (US Dollar) then converting the Fractions into Words adding then the word (Cents)

Steps in Details

Step 1: The Variables

First: The Integer: Using the Round function with Precision 0 and Threshold 1 we can have the Integer value of a number with fractions

Second: The Fractions: using the Modulo function with Divisor 1 will return the fraction value then we will need to multiply by 100 to have the exact value if the fractions is for currencies like USD where 1 USD = 100 Cent.

Note: Currencies like KWD where 1 KWD = 1000 Fils we will then multiply the fraction by 1000 instead of 100

Steps 2 & 3: The Rule Logic

### Assigned Tags

You must be Logged on to comment or reply to a post.

Thanks Dr. Emad , This was of great impact to us specially it was an audit and legal requirement in the documents generated from the system.

Respects,

Assem

Thanks for sharing this .

How are you passing the comp field value to variable, I tried navigating to the particular component  but it is resulting in below error.

'placeholder(s) mapped to Calculated Mapping are not part of a table and have multiple values.
1.SALARY'.

Hi Naveen,

Please check if employee comp info might have 2 different pay components for latest records and due to that the error will be coming.

Thanks

Thanks for the response.

Issue was resolved by removing the additional parameter from the business rule.

hi Naveen,

I faced the same issue , can you explain what you did exactly?