Skip to main content

Actions

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

ClientPurpose
ClientProvides read access to SAP S/4HANA sales organization master data via the API_SALESORGANIZATION_SRV OData v2 service.

Client

Provides read access to SAP S/4HANA sales organization master data via the API_SALESORGANIZATION_SRV OData v2 service.

Configuration

FieldTypeDefaultDescription
authhttp:CredentialsConfigRequiredSAP user credentials; provide username and password.
httpVersionhttp:HttpVersionHTTP_2_0HTTP protocol version to use.
http1SettingsClientHttp1Settings()HTTP/1.x client settings including keep-alive, chunking, and proxy.
http2Settingshttp:ClientHttp2Settings()HTTP/2 client settings.
timeoutdecimal60Request timeout in seconds.
forwardedstring"disable"Forwarded header handling mode.
poolConfighttp:PoolConfiguration()HTTP connection pool configuration.
cachehttp:CacheConfig()HTTP response caching configuration.
compressionhttp:CompressionCOMPRESSION_AUTOCompression mode for requests and responses.
circuitBreakerhttp:CircuitBreakerConfig()Circuit breaker configuration for fault tolerance.
retryConfighttp:RetryConfig()Retry configuration for failed requests.
responseLimitshttp:ResponseLimitConfigs()Limits for response header and body sizes.
secureSockethttp:ClientSecureSocket()SSL/TLS configuration for secure connections.
proxyhttp:ProxyConfig()Proxy server configuration.
validationbooleantrueEnable or disable constraint validation on response records.

Initializing the client

import ballerinax/sap.s4hana.api_salesorganization_srv as salesOrg;

configurable string hostname = ?;
configurable int port = 443;
configurable string username = ?;
configurable string password = ?;

salesOrg:Client salesOrgClient = check new (
{
auth: {
username: username,
password: password
}
},
hostname,
port
);

Operations

Sales organization

listA_SalesOrganizations

Retrieves a collection of sales organization records, with optional OData filtering, ordering, pagination, field selection, and expansion of related texts.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
$topintNoLimits the number of records returned.
$skipintNoNumber of records to skip for pagination.
$filterstringNoOData filter expression (e.g., "CompanyCode eq '1000'").
$orderbyA_SalesOrganizationOrderByOptionsNoArray of fields and sort directions for ordering results.
$selectA_SalesOrganizationSelectOptionsNoArray of field names to include in the response.
$expandA_SalesOrganizationExpandOptionsNoNavigation properties to expand inline (e.g., ["to_Text"]).
$inlinecount"allpages"|"none"NoInclude total result count in the response.

Returns: CollectionOfA_SalesOrganizationWrapper|error

Sample code:

salesOrg:CollectionOfA_SalesOrganizationWrapper result = check salesOrgClient->listA_SalesOrganizations(
queries = {
$top: 10,
$filter: "CompanyCode eq '1000'",
$select: ["SalesOrganization", "SalesOrganizationCurrency", "CompanyCode"]
}
);
salesOrg:A_SalesOrganization[]? records = result.d?.results;

Sample response:

{
"d": {
"results": [
{
"SalesOrganization": "1000",
"SalesOrganizationCurrency": "USD",
"CompanyCode": "1000",
"IntercompanyBillingCustomer": null
},
{
"SalesOrganization": "2000",
"SalesOrganizationCurrency": "EUR",
"CompanyCode": "1000",
"IntercompanyBillingCustomer": null
}
]
}
}
getA_SalesOrganization

Retrieves a single sales organization record by its unique key (SalesOrganization ID).

Parameters:

NameTypeRequiredDescription
SalesOrganizationstringYesThe four-character sales organization key (e.g., "1000").
headersmap<string|string[]>NoAdditional HTTP request headers.
$selectA_SalesOrganizationSelectOptionsNoArray of field names to include in the response.
$expandA_SalesOrganizationExpandOptionsNoNavigation properties to expand inline (e.g., ["to_Text"]).

Returns: A_SalesOrganizationWrapper|error

Sample code:

salesOrg:A_SalesOrganizationWrapper result = check salesOrgClient->getA_SalesOrganization("1000");
salesOrg:A_SalesOrganization? org = result.d;

Sample response:

{
"d": {
"SalesOrganization": "1000",
"SalesOrganizationCurrency": "USD",
"CompanyCode": "1000",
"IntercompanyBillingCustomer": null,
"to_Text": {
"results": []
}
}
}

Sales organization text

listA_SalesOrganizationTexts

Retrieves a collection of sales organization text records (multilingual names), with optional OData filtering, ordering, pagination, and field selection.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
$topintNoLimits the number of records returned.
$skipintNoNumber of records to skip for pagination.
$filterstringNoOData filter expression (e.g., "Language eq 'EN'").
$orderbyA_SalesOrganizationTextOrderByOptionsNoArray of fields and sort directions for ordering results.
$selectA_SalesOrganizationTextSelectOptionsNoArray of field names to include in the response.
$expandA_SalesOrganizationTextExpandOptionsNoNavigation properties to expand inline (e.g., ["to_SalesOrganization"]).
$inlinecount"allpages"|"none"NoInclude total result count in the response.

Returns: CollectionOfA_SalesOrganizationTextWrapper|error

Sample code:

salesOrg:CollectionOfA_SalesOrganizationTextWrapper result = check salesOrgClient->listA_SalesOrganizationTexts(
queries = {
$filter: "Language eq 'EN'",
$select: ["SalesOrganization", "Language", "SalesOrganizationName"]
}
);
salesOrg:A_SalesOrganizationText[]? textRecords = result.d?.results;

Sample response:

{
"d": {
"results": [
{
"SalesOrganization": "1000",
"Language": "EN",
"SalesOrganizationName": "Sales Organization US"
},
{
"SalesOrganization": "2000",
"Language": "EN",
"SalesOrganizationName": "Sales Organization Europe"
}
]
}
}
getA_SalesOrganizationText

Retrieves a single sales organization text record by its composite key (SalesOrganization and Language).

Parameters:

NameTypeRequiredDescription
SalesOrganizationstringYesThe four-character sales organization key (e.g., "1000").
LanguagestringYesThe two-character ISO language code (e.g., "EN", "DE").
headersmap<string|string[]>NoAdditional HTTP request headers.
$selectA_SalesOrganizationTextSelectOptionsNoArray of field names to include in the response.
$expandA_SalesOrganizationTextExpandOptionsNoNavigation properties to expand inline (e.g., ["to_SalesOrganization"]).

Returns: A_SalesOrganizationTextWrapper|error

Sample code:

salesOrg:A_SalesOrganizationTextWrapper result = check salesOrgClient->getA_SalesOrganizationText(
"1000",
"EN"
);
salesOrg:A_SalesOrganizationText? textRecord = result.d;

Sample response:

{
"d": {
"SalesOrganization": "1000",
"Language": "EN",
"SalesOrganizationName": "Sales Organization US"
}
}
listTextsOfA_SalesOrganization

Retrieves all text records (multilingual names) associated with a specific sales organization, navigating the to_Text relationship.

Parameters:

NameTypeRequiredDescription
SalesOrganizationstringYesThe four-character sales organization key (e.g., "1000").
headersmap<string|string[]>NoAdditional HTTP request headers.
$topintNoLimits the number of records returned.
$skipintNoNumber of records to skip for pagination.
$filterstringNoOData filter expression.
$orderbyA_SalesOrganizationTextOrderByOptionsNoArray of fields and sort directions for ordering results.
$selectA_SalesOrganizationTextSelectOptionsNoArray of field names to include in the response.
$expandA_SalesOrganizationTextExpandOptionsNoNavigation properties to expand inline.
$inlinecount"allpages"|"none"NoInclude total result count in the response.

Returns: CollectionOfA_SalesOrganizationTextWrapper|error

Sample code:

salesOrg:CollectionOfA_SalesOrganizationTextWrapper result = check salesOrgClient->listTextsOfA_SalesOrganization("1000");
salesOrg:A_SalesOrganizationText[]? texts = result.d?.results;

Sample response:

{
"d": {
"results": [
{
"SalesOrganization": "1000",
"Language": "EN",
"SalesOrganizationName": "Sales Organization US"
},
{
"SalesOrganization": "1000",
"Language": "DE",
"SalesOrganizationName": "Verkaufsorganisation US"
}
]
}
}
getSalesOrganizationOfA_SalesOrganizationText

Navigates from a sales organization text record back to the parent sales organization entity using the to_SalesOrganization navigation property.

Parameters:

NameTypeRequiredDescription
SalesOrganizationstringYesThe four-character sales organization key (e.g., "1000").
LanguagestringYesThe two-character ISO language code (e.g., "EN").
headersmap<string|string[]>NoAdditional HTTP request headers.
$selectA_SalesOrganizationSelectOptionsNoArray of field names to include in the response.
$expandA_SalesOrganizationExpandOptionsNoNavigation properties to expand inline.

Returns: A_SalesOrganizationWrapper|error

Sample code:

salesOrg:A_SalesOrganizationWrapper result = check salesOrgClient->getSalesOrganizationOfA_SalesOrganizationText(
"1000",
"EN"
);
salesOrg:A_SalesOrganization? org = result.d;

Sample response:

{
"d": {
"SalesOrganization": "1000",
"SalesOrganizationCurrency": "USD",
"CompanyCode": "1000",
"IntercompanyBillingCustomer": null
}
}