SAP Knowledge Base Article - Public

2085371 - Worksheet Design - Using IF THEN ELSE Logic - Compensation


  • Using IF THE ELSE logic in compensation plans


  • Compensation


  • 'if' function should have 3 parameters, if (cond, result1, result2). If parameter number is not 3, it may cause formula evaluation to fail. This will also cause formula references fields with such formulas to get the wrong result.
  • If (cond, result1, result2):  the second (result1) and the third (result2) parameters of function 'if' should have the same type. If they don’t have the same type, it will cause formula evaluation in JAVA side fails. This will also cause formula references fields with such formulas get the wrong result.


  • Simple example of using IF THEN ELSE logic:
    if(location='BDA', curSalary/curRatio, finSalary)
    "if location = BDA then target is based on midpoint of final pay grade, else, target is based on final salary."


  • More complicated if() usage scenarios can be: if () to conditionally reference two different lookup tables, or use another nested if() call like: if (cond1, if(cond2, value1, value2), value3)


  • Even more complicated nested if-then-else example using lookup tables:
    if(customSalaryFrequency='Monthly', (customMonthlyPartTimeRate/lookup('Market_Index', customJobCode, 1)), if(customSalaryFrequency='Annual', (curSalary/lookup('Market_Index', customJobCode, 1)),(curSalary*lookup('Hours Per Month', customMarketIndexCode, 1)*customGuranteedMonths)/lookup('Market_Index', customJobCode, 1)))


KBA , sf compensation worksheet design , LOD-SF-CMP , Compensation Management , How To


SAP SuccessFactors HXM Core all versions