Skip to main content

Actions

The ballerinax/sap.successfactors.ecalternativecostdistribution package exposes the following clients:

Available clients:

ClientPurpose
ClientManages 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.

FieldTypeDefaultDescription
authhttp:CredentialsConfigRequiredConfigurations related to client authentication
httpVersionhttp:HttpVersionSee defaultThe HTTP version understood by the client
http1Settingshttp:ClientHttp1SettingsSee defaultConfigurations related to HTTP/1.x protocol
http2Settingshttp:ClientHttp2SettingsSee defaultConfigurations related to HTTP/2 protocol
timeoutdecimalSee defaultThe maximum time to wait (in seconds) for a response before closing the connection
forwardedstringSee defaultThe choice of setting forwarded/x-forwarded header
followRedirectshttp:FollowRedirectsOptionalConfigurations associated with Redirection
poolConfighttp:PoolConfigurationOptionalConfigurations associated with request pooling
cachehttp:CacheConfigSee defaultHTTP caching related configurations
compressionhttp:CompressionSee defaultSpecifies the way of handling compression (accept-encoding) header
circuitBreakerhttp:CircuitBreakerConfigOptionalConfigurations associated with the behaviour of the Circuit Breaker
retryConfighttp:RetryConfigOptionalConfigurations associated with retrying
cookieConfighttp:CookieConfigOptionalConfigurations associated with cookies
responseLimitshttp:ResponseLimitConfigsSee defaultConfigurations associated with inbound response size limits
secureSockethttp:ClientSecureSocketOptionalSSL/TLS-related options
proxyhttp:ProxyConfigOptionalProxy server related options
socketConfighttp:ClientSocketConfigSee defaultProvides settings related to client socket configuration
validationbooleanSee defaultEnables the inbound payload validation functionality which provided by the constraint package. Enabled by default
laxDataBindingbooleanSee defaultEnables 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:

NameTypeRequiredDescription
headersmap<string|string[]>NoHeaders to be sent with the request
queriesListEmpCostDistributionsQueriesNoQueries to be sent with the request

Returns: ListEmpCostDistributionsResponse&#124;error

Sample code:

ListEmpCostDistributionsResponse result = check client->listEmpCostDistributions();

Sample response:

{
"d": {
"results": [
{
"d": {}
}
]
}
}
createEmpCostDistribution

Creates a new EmpCostDistribution entity from the supplied payload.

Parameters:

NameTypeRequiredDescription
payloadEmpCostDistributionYesNew entity
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: CreatedEmpCostDistribution&#124;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:

NameTypeRequiredDescription
effectiveStartDatestringYeskey: effectiveStartDate
usersSysIdstringYeskey: usersSysId
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetEmpCostDistributionQueriesNoQueries to be sent with the request

Returns: EmpCostDistribution&#124;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:

NameTypeRequiredDescription
effectiveStartDatestringYeskey: effectiveStartDate
usersSysIdstringYeskey: usersSysId
payloadModifiedEmpCostDistributionYesNew property values
headersmap<string|string[]>NoHeaders 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:

NameTypeRequiredDescription
effectiveStartDatestringYeskey: effectiveStartDate
usersSysIdstringYeskey: usersSysId
headersDeleteEmpCostDistributionHeadersNoHeaders 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:

NameTypeRequiredDescription
headersmap<string|string[]>NoHeaders to be sent with the request
queriesListEmpCostDistributionItemsQueriesNoQueries to be sent with the request

Returns: ListEmpCostDistributionItemsResponse&#124;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:

NameTypeRequiredDescription
payloadEmpCostDistributionItemYesNew entity
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: CreatedEmpCostDistributionItem&#124;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:

NameTypeRequiredDescription
EmpCostDistribution_effectiveStartDatestringYeskey: EmpCostDistribution_effectiveStartDate
EmpCostDistribution_usersSysIdstringYeskey: EmpCostDistribution_usersSysId
externalCodeintYeskey: externalCode
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetEmpCostDistributionItemQueriesNoQueries to be sent with the request

Returns: EmpCostDistributionItem&#124;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:

NameTypeRequiredDescription
EmpCostDistribution_effectiveStartDatestringYeskey: EmpCostDistribution_effectiveStartDate
EmpCostDistribution_usersSysIdstringYeskey: EmpCostDistribution_usersSysId
externalCodeintYeskey: externalCode
payloadModifiedEmpCostDistributionItemYesNew property values
headersmap<string|string[]>NoHeaders 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:

NameTypeRequiredDescription
EmpCostDistribution_effectiveStartDatestringYeskey: EmpCostDistribution_effectiveStartDate
EmpCostDistribution_usersSysIdstringYeskey: EmpCostDistribution_usersSysId
externalCodeintYeskey: externalCode
headersDeleteEmpCostDistributionItemHeadersNoHeaders to be sent with the request

Returns: error?

Sample code:

check client->deleteEmpCostDistributionItem(EmpCostDistribution_effectiveStartDate, EmpCostDistribution_usersSysId, externalCode);