Actions
The ballerinax/sap.successfactors.ecalternativecostdistribution package exposes the following clients:
Available clients:
| Client | Purpose |
|---|---|
Client | Manages ecalternativecostdistribution objects: EmpCostDistribution, EmpCostDistributionItem, over the SAP SuccessFactors OData v2 API. |
Client
You can use these APIs to distribute the costs of an employee over multiple alternative cost centers.
Configuration
ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with the SAP SuccessFactors OData endpoint. Passed as the argument to the client initializer.
| Field | Type | Default | Description |
|---|---|---|---|
auth | http:CredentialsConfig | Required | Configurations related to client authentication |
httpVersion | http:HttpVersion | See default | The HTTP version understood by the client |
http1Settings | http:ClientHttp1Settings | See default | Configurations related to HTTP/1.x protocol |
http2Settings | http:ClientHttp2Settings | See default | Configurations related to HTTP/2 protocol |
timeout | decimal | See default | The maximum time to wait (in seconds) for a response before closing the connection |
forwarded | string | See default | The choice of setting forwarded/x-forwarded header |
followRedirects | http:FollowRedirects | Optional | Configurations associated with Redirection |
poolConfig | http:PoolConfiguration | Optional | Configurations associated with request pooling |
cache | http:CacheConfig | See default | HTTP caching related configurations |
compression | http:Compression | See default | Specifies the way of handling compression (accept-encoding) header |
circuitBreaker | http:CircuitBreakerConfig | Optional | Configurations associated with the behaviour of the Circuit Breaker |
retryConfig | http:RetryConfig | Optional | Configurations associated with retrying |
cookieConfig | http:CookieConfig | Optional | Configurations associated with cookies |
responseLimits | http:ResponseLimitConfigs | See default | Configurations associated with inbound response size limits |
secureSocket | http:ClientSecureSocket | Optional | SSL/TLS-related options |
proxy | http:ProxyConfig | Optional | Proxy server related options |
socketConfig | http:ClientSocketConfig | See default | Provides settings related to client socket configuration |
validation | boolean | See default | Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default |
laxDataBinding | boolean | See default | Enables relaxed data binding on the client side. When enabled, nil values are treated as optional, and absent fields are handled as nilable types. Enabled by default. |
The client also accepts a hostname string parameter (the SAP SuccessFactors API server host) and an optional port (defaults to 443).
Initializing the client
import ballerinax/sap.successfactors.ecalternativecostdistribution;
configurable string hostname = ?;
configurable string username = ?;
configurable string password = ?;
ecalternativecostdistribution:Client client = check new (
{
auth: { username, password }
},
hostname
);
Operations
EmpCostDistribution
listEmpCostDistributions
Queries the EmpCostDistribution collection and returns a page of entities, optionally filtered, sorted, and paged via OData query options.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Headers to be sent with the request |
queries | ListEmpCostDistributionsQueries | No | Queries to be sent with the request |
Returns: ListEmpCostDistributionsResponse|error
Sample code:
ListEmpCostDistributionsResponse result = check client->listEmpCostDistributions();
Sample response:
{
"d": {
"results": [
{
"d": {}
}
]
}
}
createEmpCostDistribution
Creates a new EmpCostDistribution entity from the supplied payload.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | EmpCostDistribution | Yes | New entity |
headers | map<string|string[]> | No | Headers to be sent with the request |
Returns: CreatedEmpCostDistribution|error
Sample code:
CreatedEmpCostDistribution result = check client->createEmpCostDistribution(payload);
Sample response:
{
"d": {
"d": {}
}
}
getEmpCostDistribution
Retrieves a single EmpCostDistribution entity identified by its key properties.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
effectiveStartDate | string | Yes | key: effectiveStartDate |
usersSysId | string | Yes | key: usersSysId |
headers | map<string|string[]> | No | Headers to be sent with the request |
queries | GetEmpCostDistributionQueries | No | Queries to be sent with the request |
Returns: EmpCostDistribution|error
Sample code:
EmpCostDistribution result = check client->getEmpCostDistribution(effectiveStartDate, usersSysId);
Sample response:
{
"d": {}
}
updateEmpCostDistribution
Updates the EmpCostDistribution identified by its key properties with the supplied payload.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
effectiveStartDate | string | Yes | key: effectiveStartDate |
usersSysId | string | Yes | key: usersSysId |
payload | ModifiedEmpCostDistribution | Yes | New property values |
headers | map<string|string[]> | No | Headers to be sent with the request |
Returns: error?
Sample code:
check client->updateEmpCostDistribution(effectiveStartDate, usersSysId, payload);
deleteEmpCostDistribution
Deletes the EmpCostDistribution identified by its key properties.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
effectiveStartDate | string | Yes | key: effectiveStartDate |
usersSysId | string | Yes | key: usersSysId |
headers | DeleteEmpCostDistributionHeaders | No | Headers to be sent with the request |
Returns: error?
Sample code:
check client->deleteEmpCostDistribution(effectiveStartDate, usersSysId);
EmpCostDistributionItem
listEmpCostDistributionItems
Queries the EmpCostDistributionItem collection and returns a page of entities, optionally filtered, sorted, and paged via OData query options.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Headers to be sent with the request |
queries | ListEmpCostDistributionItemsQueries | No | Queries to be sent with the request |
Returns: ListEmpCostDistributionItemsResponse|error
Sample code:
ListEmpCostDistributionItemsResponse result = check client->listEmpCostDistributionItems();
Sample response:
{
"d": {
"results": [
{
"EmpCostDistribution_effectiveStartDate": "2026-01-01",
"EmpCostDistribution_usersSysId": "1000",
"externalCode": "1000"
}
]
}
}
createEmpCostDistributionItem
Creates a new EmpCostDistributionItem entity from the supplied payload.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | EmpCostDistributionItem | Yes | New entity |
headers | map<string|string[]> | No | Headers to be sent with the request |
Returns: CreatedEmpCostDistributionItem|error
Sample code:
CreatedEmpCostDistributionItem result = check client->createEmpCostDistributionItem(payload);
Sample response:
{
"d": {
"EmpCostDistribution_effectiveStartDate": "2026-01-01",
"EmpCostDistribution_usersSysId": "1000",
"externalCode": "1000"
}
}
getEmpCostDistributionItem
Retrieves a single EmpCostDistributionItem entity identified by its key properties.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
EmpCostDistribution_effectiveStartDate | string | Yes | key: EmpCostDistribution_effectiveStartDate |
EmpCostDistribution_usersSysId | string | Yes | key: EmpCostDistribution_usersSysId |
externalCode | int | Yes | key: externalCode |
headers | map<string|string[]> | No | Headers to be sent with the request |
queries | GetEmpCostDistributionItemQueries | No | Queries to be sent with the request |
Returns: EmpCostDistributionItem|error
Sample code:
EmpCostDistributionItem result = check client->getEmpCostDistributionItem(EmpCostDistribution_effectiveStartDate, EmpCostDistribution_usersSysId, externalCode);
Sample response:
{
"EmpCostDistribution_effectiveStartDate": "2026-01-01",
"EmpCostDistribution_usersSysId": "1000",
"externalCode": "1000"
}
updateEmpCostDistributionItem
Updates the EmpCostDistributionItem identified by its key properties with the supplied payload.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
EmpCostDistribution_effectiveStartDate | string | Yes | key: EmpCostDistribution_effectiveStartDate |
EmpCostDistribution_usersSysId | string | Yes | key: EmpCostDistribution_usersSysId |
externalCode | int | Yes | key: externalCode |
payload | ModifiedEmpCostDistributionItem | Yes | New property values |
headers | map<string|string[]> | No | Headers to be sent with the request |
Returns: error?
Sample code:
check client->updateEmpCostDistributionItem(EmpCostDistribution_effectiveStartDate, EmpCostDistribution_usersSysId, externalCode, payload);
deleteEmpCostDistributionItem
Deletes the EmpCostDistributionItem identified by its key properties.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
EmpCostDistribution_effectiveStartDate | string | Yes | key: EmpCostDistribution_effectiveStartDate |
EmpCostDistribution_usersSysId | string | Yes | key: EmpCostDistribution_usersSysId |
externalCode | int | Yes | key: externalCode |
headers | DeleteEmpCostDistributionItemHeaders | No | Headers to be sent with the request |
Returns: error?
Sample code:
check client->deleteEmpCostDistributionItem(EmpCostDistribution_effectiveStartDate, EmpCostDistribution_usersSysId, externalCode);