Skip to main content

SuccessFactors Integration

Configuration Requirements

API Endpoint

https://[API-Server]/odata/v2/[Entity]/$metadata

Authorization

Basic Base64(username@companyId:password)

Supported Filters

eq, in, and, or, ge, le, not, like, etc.

$filter=username eq '[email protected]' and location in 'In','Eu'

Employee Profile

Active Employee

curl --location --request GET 'https://api44.sapsf.com/odata/v2/User?$filter=username%20eq%20%[email protected]%27&$format=json' \
--header 'Authorization: Basic XXXXX'

Deactivate / Ex-Employee

curl --location --request GET 'https://api44.sapsf.com/odata/v2/User?$filter=username%20eq%20%[email protected]%27%20and%20status%20eq%20%27f%27&$format=json&$select=defaultFullName,userId,jobCode,email,hireDate' \
--header 'Authorization: Basic XXXXX'

Employment Termination Info

curl --location --request GET 'https://api44.sapsf.com/odata/v2/EmpEmploymentTermination?$filter=userId%20eq%20300&$format=json' \
--header 'Authorization: Basic XXXXX'

Leave Management

SuccessFactors Leave Entities

EntityDescription
Time Account TypeRules to accrue balance for each leave type
Time TypeTypes of leave (e.g., Annual Leave, Sick Leave)
Time ProfileLeave types applicable to employees
Time AccountHolds the obtained leave balance

Managing Time Off Entities

  1. Log in to SuccessFactors with admin access.
  2. Search for Manage Time Off Structure.
  3. Select desired entity from dropdown.
  4. Select a record to update.
  5. Take Action → Make Correction → Save.

Adding a New Record

Use the right-side dropdown to select entity category and add a record.

Assigning Time Profile to Employee

  1. Search employee in the top search bar.
  2. Go to Job Information → Edit.
  3. Update time profile, work schedule, holiday calendar.
  4. Save changes. A time account is auto-created.

Sample Config

  • Time Profile: Time off Test (TIME_OFF_TEST)
  • Time Types:
    • Sick Leave: SICK_LEAVE
    • Annual Leave 2: ANNUAL_LEAVE

Leave Balance Calculation

Past Leaves (Response1)

curl --location --request GET 'https://api44.sapsf.com/odata/v2/EmpTimeAccountBalance?$filter=userId%20eq%20%27273%27%20and%20timeAccountType%20eq%20%27SICK_LEAVE%27&$format=json' \
--header 'Authorization: Basic XXXXX'

Future Approved Leaves (Response2)

curl --location --request GET 'https://api44.sapsf.com/odata/v2/EmployeeTime?$filter=userId%20eq%20%27273%27%20and%20timeType%20eq%20%27ANNUAL_LEAVE%27%20and%20startDate%20ge%20datetime%272020-02-04T00:00:00%27%20and%20approvalStatus%20eq%20%27PENDING%27&$format=json&$select=deductionQuantity,approvalStatus,timeType,endDate,startDate,externalCode' \
--header 'Authorization: Basic XXXXX'

Final Balance Formula

finalBalance = Response1.balance - SUM(Response2[].deductionQuantity)

Apply Leave

curl --location --request POST 'https://api44.sapsf.com/odata/v2/upsert?workflowConfirmed=true&$format=json' \
--header 'Authorization: Basic XXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"__metadata": {
"uri": "https://api44.sapsf.com/odata/v2/EmployeeTime('273')"
},
"startDate": "{{todayDate}}",
"endDate": "/Date(1611792000000)/",
"externalCode": "TRY1234",
"approvalStatus": "PENDING",
"userIdNav": {
"__metadata": {
"uri": "https://api44.sapsf.com/odata/v2/User('273')",
"type": "SFOData.User"
}
},
"timeTypeNav": {
"__metadata": {
"uri": "https://api44.sapsf.com/odata/v2/TimeType('SICK_LEAVE')",
"type": "SFOData.TimeType"
}
}
}'

Sample Responses

Failure:

{
"d": [
{
"key": "EmployeeTime/externalCode=TRY1234",
"status": "ERROR",
"message": "Expected return date must be one day later than end date.",
"httpCode": 500
}
]
}

Success:

{
"d": [
{
"key": "EmployeeTime/externalCode=TRY1234",
"status": "OK",
"editStatus": "UPSERTED",
"httpCode": 200
}
]
}

Verification in Portal

  • User Profile: Navigate to User Profile → Actions → Manage leave of absence.
  • Manage Data: Go to Manage Time Off Structures → Employee Time → [externalCode]

References

  1. SAP API Guide : https://help.sap.com/viewer/d599f15995d348a1b45ba5603e2aba9b/2011/en-US
  2. https://blogs.sap.com/2015/10/16/ec-time-off-for-on-time-hr-management/