Skip to main content

Actions

The ballerinax/sap.s4hana.api_sd_incoterms_srv package exposes the following clients:

ClientPurpose
ClientProvides read access to SAP S/4HANA Incoterms classifications, versions, and their multilingual text descriptions via OData.

Client

Provides read access to SAP S/4HANA Incoterms classifications, versions, and their multilingual text descriptions via OData.

Configuration

FieldTypeDefaultDescription
authhttp:CredentialsConfigRequiredBasic authentication credentials containing username and password for the SAP S/4HANA Communication User.
httpVersionhttp:HttpVersionhttp:HTTP_2_0HTTP protocol version to use for outbound requests.
timeoutdecimal60Request timeout in seconds.
retryConfighttp:RetryConfig?()Retry configuration for transient request failures.
secureSockethttp:ClientSecureSocket?()SSL/TLS configuration for secure connections.
proxyhttp:ProxyConfig?()HTTP proxy server configuration.
validationbooleantrueEnables constraint validation on request and response payloads.

Initializing the client

import ballerinax/sap.s4hana.api_sd_incoterms_srv as incoterms;

configurable string username = ?;
configurable string password = ?;
configurable string hostname = ?;

incoterms:Client incotermsClient = check new (
{
auth: {
username: username,
password: password
}
},
hostname
);

Operations

Incoterms classifications

listA_IncotermsClassifications

Reads the IDs and descriptions of all Incoterms classifications.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoOptional HTTP headers to include in the request.
queriesListA_IncotermsClassificationsQueriesNoOData query options: $top, $skip, $filter, $orderby, $expand, $inlinecount, $select.

Returns: CollectionOfA_IncotermsClassificationWrapper|error

Sample code:

incoterms:CollectionOfA_IncotermsClassificationWrapper result =
check incotermsClient->listA_IncotermsClassifications();

Sample response:

{
"d": {
"results": [
{
"IncotermsClassification": "CFR",
"LocationIsMandatory": false,
"to_IncotermsClassificationText": {"__deferred": {"uri": "..."}}
},
{
"IncotermsClassification": "CIF",
"LocationIsMandatory": false,
"to_IncotermsClassificationText": {"__deferred": {"uri": "..."}}
},
{
"IncotermsClassification": "EXW",
"LocationIsMandatory": true,
"to_IncotermsClassificationText": {"__deferred": {"uri": "..."}}
}
]
}
}
getA_IncotermsClassification

Reads the ID and description of a specific Incoterms classification identified by its key.

Parameters:

NameTypeRequiredDescription
IncotermsClassificationstringYesThe Incoterms classification code (up to 3 characters, e.g., "CIF").
headersmap<string|string[]>NoOptional HTTP headers.
queriesGetA_IncotermsClassificationQueriesNoOData query options: $expand, $select.

Returns: A_IncotermsClassificationWrapper|error

Sample code:

incoterms:A_IncotermsClassificationWrapper result =
check incotermsClient->getA_IncotermsClassification("CIF");

Sample response:

{
"d": {
"IncotermsClassification": "CIF",
"LocationIsMandatory": false,
"to_IncotermsClassificationText": {
"__deferred": {"uri": "https://my-tenant.s4hana.cloud.sap/sap/opu/odata/sap/API_SD_INCOTERMS_SRV/A_IncotermsClassification('CIF')/to_IncotermsClassificationText"}
}
}
}

Incoterms classification texts

listA_IncotermsClassificationTexts

Reads the text descriptions of all Incoterms classifications across all available languages.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoOptional HTTP headers.
queriesListA_IncotermsClassificationTextsQueriesNoOData query options: $top, $skip, $filter, $orderby, $inlinecount, $select.

Returns: CollectionOfA_IncotermsClassificationTextWrapper|error

Sample code:

incoterms:CollectionOfA_IncotermsClassificationTextWrapper result =
check incotermsClient->listA_IncotermsClassificationTexts();

Sample response:

{
"d": {
"results": [
{"IncotermsClassification": "CFR", "Language": "EN", "IncotermsClassificationName": "Cost and Freight"},
{"IncotermsClassification": "CIF", "Language": "EN", "IncotermsClassificationName": "Cost Insurance Freight"},
{"IncotermsClassification": "CIF", "Language": "DE", "IncotermsClassificationName": "Kosten, Versicherung und Fracht"},
{"IncotermsClassification": "EXW", "Language": "EN", "IncotermsClassificationName": "Ex Works"}
]
}
}
getA_IncotermsClassificationText

Reads the text description of a specific Incoterms classification in a specific language.

Parameters:

NameTypeRequiredDescription
IncotermsClassificationstringYesThe Incoterms classification code (e.g., "CIF").
LanguagestringYesThe two-character SAP language code (e.g., "EN" for English, "DE" for German).
headersmap<string|string[]>NoOptional HTTP headers.
queriesGetA_IncotermsClassificationTextQueriesNoOData query options: $select.

Returns: A_IncotermsClassificationTextWrapper|error

Sample code:

incoterms:A_IncotermsClassificationTextWrapper result =
check incotermsClient->getA_IncotermsClassificationText("CIF", "EN");

Sample response:

{
"d": {
"IncotermsClassification": "CIF",
"Language": "EN",
"IncotermsClassificationName": "Cost Insurance Freight"
}
}
listIncotermsClassificationTextsOfA_IncotermsClassification

Reads all language descriptions for a specific Incoterms classification via the navigation property.

Parameters:

NameTypeRequiredDescription
IncotermsClassificationstringYesThe Incoterms classification code (e.g., "CIF").
headersmap<string|string[]>NoOptional HTTP headers.
queriesListIncotermsClassificationTextsOfA_IncotermsClassificationQueriesNoOData query options: $top, $skip, $filter, $orderby, $inlinecount, $select.

Returns: CollectionOfA_IncotermsClassificationTextWrapper|error

Sample code:

incoterms:CollectionOfA_IncotermsClassificationTextWrapper result =
check incotermsClient->listIncotermsClassificationTextsOfA_IncotermsClassification("CIF");

Sample response:

{
"d": {
"results": [
{"IncotermsClassification": "CIF", "Language": "DE", "IncotermsClassificationName": "Kosten, Versicherung und Fracht"},
{"IncotermsClassification": "CIF", "Language": "EN", "IncotermsClassificationName": "Cost Insurance Freight"},
{"IncotermsClassification": "CIF", "Language": "FR", "IncotermsClassificationName": "Coût, assurance et fret"}
]
}
}

Incoterms versions

listA_IncotermsVersions

Reads the IDs and descriptions of all available Incoterms versions.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoOptional HTTP headers.
queriesListA_IncotermsVersionsQueriesNoOData query options: $top, $skip, $filter, $orderby, $expand, $inlinecount, $select.

Returns: CollectionOfA_IncotermsVersionWrapper|error

Sample code:

incoterms:CollectionOfA_IncotermsVersionWrapper result =
check incotermsClient->listA_IncotermsVersions();

Sample response:

{
"d": {
"results": [
{
"IncotermsVersion": "2010",
"to_IncotermsVersionText": {"__deferred": {"uri": "..."}}
},
{
"IncotermsVersion": "2020",
"to_IncotermsVersionText": {"__deferred": {"uri": "..."}}
}
]
}
}
getA_IncotermsVersion

Reads the ID and description of a specific Incoterms version by its key.

Parameters:

NameTypeRequiredDescription
IncotermsVersionstringYesThe Incoterms version code (up to 4 characters, e.g., "2020").
headersmap<string|string[]>NoOptional HTTP headers.
queriesGetA_IncotermsVersionQueriesNoOData query options: $expand, $select.

Returns: A_IncotermsVersionWrapper|error

Sample code:

incoterms:A_IncotermsVersionWrapper result =
check incotermsClient->getA_IncotermsVersion("2020");

Sample response:

{
"d": {
"IncotermsVersion": "2020",
"to_IncotermsVersionText": {
"__deferred": {"uri": "https://my-tenant.s4hana.cloud.sap/sap/opu/odata/sap/API_SD_INCOTERMS_SRV/A_IncotermsVersion('2020')/to_IncotermsVersionText"}
}
}
}

Incoterms version texts

listA_IncotermsVersionTexts

Reads the text descriptions of all Incoterms versions across all available languages.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoOptional HTTP headers.
queriesListA_IncotermsVersionTextsQueriesNoOData query options: $top, $skip, $filter, $orderby, $inlinecount, $select.

Returns: CollectionOfA_IncotermsVersionTextWrapper|error

Sample code:

incoterms:CollectionOfA_IncotermsVersionTextWrapper result =
check incotermsClient->listA_IncotermsVersionTexts();

Sample response:

{
"d": {
"results": [
{"IncotermsVersion": "2010", "Language": "EN", "IncotermsVersionName": "Incoterms 2010"},
{"IncotermsVersion": "2010", "Language": "DE", "IncotermsVersionName": "Incoterms 2010"},
{"IncotermsVersion": "2020", "Language": "EN", "IncotermsVersionName": "Incoterms 2020"},
{"IncotermsVersion": "2020", "Language": "DE", "IncotermsVersionName": "Incoterms 2020"}
]
}
}
getA_IncotermsVersionText

Reads the text description of a specific Incoterms version in a specific language.

Parameters:

NameTypeRequiredDescription
IncotermsVersionstringYesThe Incoterms version code (e.g., "2020").
LanguagestringYesThe two-character SAP language code (e.g., "EN").
headersmap<string|string[]>NoOptional HTTP headers.
queriesGetA_IncotermsVersionTextQueriesNoOData query options: $select.

Returns: A_IncotermsVersionTextWrapper|error

Sample code:

incoterms:A_IncotermsVersionTextWrapper result =
check incotermsClient->getA_IncotermsVersionText("2020", "EN");

Sample response:

{
"d": {
"IncotermsVersion": "2020",
"Language": "EN",
"IncotermsVersionName": "Incoterms 2020"
}
}
listIncotermsVersionTextsOfA_IncotermsVersion

Reads all language descriptions for a specific Incoterms version via the navigation property.

Parameters:

NameTypeRequiredDescription
IncotermsVersionstringYesThe Incoterms version code (e.g., "2020").
headersmap<string|string[]>NoOptional HTTP headers.
queriesListIncotermsVersionTextsOfA_IncotermsVersionQueriesNoOData query options: $top, $skip, $filter, $orderby, $inlinecount, $select.

Returns: CollectionOfA_IncotermsVersionTextWrapper|error

Sample code:

incoterms:CollectionOfA_IncotermsVersionTextWrapper result =
check incotermsClient->listIncotermsVersionTextsOfA_IncotermsVersion("2020");

Sample response:

{
"d": {
"results": [
{"IncotermsVersion": "2020", "Language": "DE", "IncotermsVersionName": "Incoterms 2020"},
{"IncotermsVersion": "2020", "Language": "EN", "IncotermsVersionName": "Incoterms 2020"},
{"IncotermsVersion": "2020", "Language": "FR", "IncotermsVersionName": "Incoterms 2020"}
]
}
}

Batch operations

performBatchOperation

Sends multiple OData read requests as a single HTTP $batch call, reducing round trips to the SAP server.

Parameters:

NameTypeRequiredDescription
requesthttp:RequestYesAn http:Request object containing the multipart/mixed batch payload with individual OData request parts.
headersmap<string|string[]>NoOptional HTTP headers to include in the outer batch request.

Returns: http:Response|error

Sample code:

http:Request batchRequest = new;
string boundary = "batch_abc123";
batchRequest.setHeader("Content-Type", "multipart/mixed; boundary=" + boundary);
batchRequest.setTextPayload(
"--" + boundary + "\r\n" +
"Content-Type: application/http\r\n" +
"Content-Transfer-Encoding: binary\r\n\r\n" +
"GET A_IncotermsClassification HTTP/1.1\r\n\r\n" +
"--" + boundary + "\r\n" +
"Content-Type: application/http\r\n" +
"Content-Transfer-Encoding: binary\r\n\r\n" +
"GET A_IncotermsVersion HTTP/1.1\r\n\r\n" +
"--" + boundary + "--"
);
http:Response batchResponse = check incotermsClient->performBatchOperation(batchRequest);

Sample response:

HTTP/1.1 200 OK
Content-Type: multipart/mixed; boundary=AAD136757C5CF75E21C04F59B

--AAD136757C5CF75E21C04F59B
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 200 OK
Content-Type: application/json

{"d":{"results":[{"IncotermsClassification":"CIF","LocationIsMandatory":false},{"IncotermsClassification":"EXW","LocationIsMandatory":true}]}}

--AAD136757C5CF75E21C04F59B
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 200 OK
Content-Type: application/json

{"d":{"results":[{"IncotermsVersion":"2010"},{"IncotermsVersion":"2020"}]}}

--AAD136757C5CF75E21C04F59B--