Skip to main content

Actions

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

ClientPurpose
ClientProvides read-only access to the SAP S/4HANA characteristic attribute catalog (selected sets, their codes and texts) via the API_CHARCATTRIBUTECATALOG_SRV OData API.

Client​

Provides read-only access to the SAP S/4HANA characteristic attribute catalog (selected sets, their codes and texts) via the API_CHARCATTRIBUTECATALOG_SRV OData API.

Configuration​

The client is initialized with a ConnectionConfig record, the SAP S/4HANA hostname and an optional port (default 443). The client builds the service URL https://<hostname>:<port>/sap/opu/odata/sap/API_CHARCATTRIBUTECATALOG_SRV from these values.

FieldTypeDefaultDescription
authhttp:BearerTokenConfig|OAuth2RefreshTokenGrantConfig|http:CredentialsConfigRequiredAuthentication configuration; use http:CredentialsConfig (username/password) for Basic Auth with the communication user.
httpVersionhttp:HttpVersionhttp:HTTP_2_0HTTP protocol version understood by the client.
http1Settingshttp:ClientHttp1Settings{}HTTP/1.x protocol settings.
http2Settingshttp:ClientHttp2Settings{}HTTP/2 protocol settings.
timeoutdecimal60Maximum time (in seconds) to wait for a response before closing the connection.
forwardedstring"disable"Choice of setting the forwarded/x-forwarded header.
followRedirectshttp:FollowRedirects()Redirection settings.
poolConfighttp:PoolConfiguration()Request pooling settings.
cachehttp:CacheConfig{}HTTP caching settings.
compressionhttp:Compressionhttp:COMPRESSION_AUTOHow the accept-encoding header is handled.
circuitBreakerhttp:CircuitBreakerConfig()Circuit breaker settings.
retryConfighttp:RetryConfig()Retry settings.
cookieConfighttp:CookieConfig()Cookie settings.
responseLimitshttp:ResponseLimitConfigs{}Inbound response size limits.
secureSockethttp:ClientSecureSocket()SSL/TLS configuration for secure connections.
proxyhttp:ProxyConfig()Proxy server configuration.
socketConfighttp:ClientSocketConfig{}Client socket settings.
validationbooleantrueEnables inbound payload validation using the constraint package.
laxDataBindingbooleantrueEnables relaxed data binding, treating nil values as optional and absent fields as nilable.

Initializing the client​

import ballerinax/sap.s4hana.api_charcattributecatalog_srv as charattributecat;

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

charattributecat:Client charattributecatClient = check new (
{
auth: {
username: username,
password: password
}
},
hostname
);

Operations​

All operations of this API are read-only. A selected set is identified by its plant (SelectedCodeSetPlant, up to 4 characters) and its name (SelectedCodeSet, up to 8 characters). A code in a selected set is further identified by its code group (CharacteristicAttributeCodeGrp, up to 8 characters) and code (CharacteristicAttributeCode, up to 4 characters). Texts add the language key (Language, up to 2 characters).

This API has no navigation properties, so the query records do not offer $expand. In the query records, $select and $orderby take arrays of the allowed property names, and $top and $skip take integers.

Selected sets​

listA_CharcAttribSeldCodeSets

Retrieves a collection of selected sets of the characteristic attribute catalog, with the status of each set and who created and last changed it.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListA_CharcAttribSeldCodeSetsQueriesNoOData query parameters: $filter, $select, $orderby, $top, $skip, $inlinecount.

Returns: CollectionOfA_CharcAttribSeldCodeSetWrapper|error

Sample code:

charattributecat:CollectionOfA_CharcAttribSeldCodeSetWrapper result = check charattributecatClient->listA_CharcAttribSeldCodeSets(
queries = {
\$filter: "SelectedCodeSetPlant eq '1010'",
\$top: 2,
\$orderby: ["SelectedCodeSet"]
}
);

Sample response:

{
"d": {
"results": [
{
"SelectedCodeSetPlant": "1010",
"SelectedCodeSet": "COLOR",
"InspectionSelectedSetStatus": "2",
"CharcAttribSeldSetCreatedBy": "QM_PLANNER",
"CharcAttribSeldSetCrtedOn": "/Date(1741910400000)/",
"CharcAttribSeldSetLastChgdBy": "QM_PLANNER",
"CharcAttribSeldSetLastChgdOn": "/Date(1788307200000)/"
},
{
"SelectedCodeSetPlant": "1010",
"SelectedCodeSet": "SURFACE",
"InspectionSelectedSetStatus": "2",
"CharcAttribSeldSetCreatedBy": "QM_PLANNER",
"CharcAttribSeldSetCrtedOn": "/Date(1741910400000)/",
"CharcAttribSeldSetLastChgdBy": null,
"CharcAttribSeldSetLastChgdOn": null
}
]
}
}
getA_CharcAttribSeldCodeSet

Retrieves a single selected set of the characteristic attribute catalog by plant and selected set.

Parameters:

NameTypeRequiredDescription
SelectedCodeSetPlantstringYesPlant of the selected set (e.g., "1010").
SelectedCodeSetstringYesSelected set (e.g., "SURFACE").
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetA_CharcAttribSeldCodeSetQueriesNoOData query parameters: $select.

Returns: A_CharcAttribSeldCodeSetWrapper|error

Sample code:

charattributecat:A_CharcAttribSeldCodeSetWrapper codeSet = check charattributecatClient->getA_CharcAttribSeldCodeSet(
"1010",
"SURFACE"
);

Sample response:

{
"d": {
"SelectedCodeSetPlant": "1010",
"SelectedCodeSet": "SURFACE",
"InspectionSelectedSetStatus": "2",
"CharcAttribSeldSetCreatedBy": "QM_PLANNER",
"CharcAttribSeldSetCrtedOn": "/Date(1741910400000)/",
"CharcAttribSeldSetLastChgdBy": null,
"CharcAttribSeldSetLastChgdOn": null
}
}

Selected set codes​

listA_CharcAttribSeldSetCodes

Retrieves a collection of the codes and code groups assigned to selected sets, with the valuation (for example, A accepted or R rejected) and defect class of each code.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListA_CharcAttribSeldSetCodesQueriesNoOData query parameters: $filter, $select, $orderby, $top, $skip, $inlinecount.

Returns: CollectionOfA_CharcAttribSeldSetCodeWrapper|error

Sample code:

charattributecat:CollectionOfA_CharcAttribSeldSetCodeWrapper codes = check charattributecatClient->listA_CharcAttribSeldSetCodes(
queries = {
\$filter: "SelectedCodeSetPlant eq '1010' and SelectedCodeSet eq 'SURFACE'",
\$select: ["CharacteristicAttributeCodeGrp", "CharacteristicAttributeCode", "CharcAttributeValuation", "DefectClass"],
\$inlinecount: "allpages"
}
);

Sample response:

{
"d": {
"__count": "2",
"results": [
{
"CharacteristicAttributeCodeGrp": "SURFACE",
"CharacteristicAttributeCode": "01",
"CharcAttributeValuation": "A",
"DefectClass": ""
},
{
"CharacteristicAttributeCodeGrp": "SURFACE",
"CharacteristicAttributeCode": "02",
"CharcAttributeValuation": "R",
"DefectClass": "02"
}
]
}
}
getA_CharcAttribSeldSetCode

Retrieves a single code of a selected set, identified by plant, selected set, code group and code.

Parameters:

NameTypeRequiredDescription
SelectedCodeSetPlantstringYesPlant of the selected set (e.g., "1010").
SelectedCodeSetstringYesSelected set (e.g., "SURFACE").
CharacteristicAttributeCodeGrpstringYesCode group (e.g., "SURFACE").
CharacteristicAttributeCodestringYesCode (e.g., "02").
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetA_CharcAttribSeldSetCodeQueriesNoOData query parameters: $select.

Returns: A_CharcAttribSeldSetCodeWrapper|error

Sample code:

charattributecat:A_CharcAttribSeldSetCodeWrapper code = check charattributecatClient->getA_CharcAttribSeldSetCode(
"1010",
"SURFACE",
"SURFACE",
"02"
);

Sample response:

{
"d": {
"SelectedCodeSetPlant": "1010",
"SelectedCodeSet": "SURFACE",
"CharacteristicAttributeCodeGrp": "SURFACE",
"CharacteristicAttributeCode": "02",
"CharcAttributeValuation": "R",
"DefectClass": "02",
"CharcAttribSeldSetCodeCrtedBy": "QM_PLANNER",
"CharcAttribSeldSetCodeCrtedOn": "/Date(1741910400000)/",
"CharcAttribSeldSetCodeChgdBy": null,
"CharcAttribSeldSetCodeChgdOn": null
}
}

Selected set texts​

listA_CharcAttribSeldSetTs

Retrieves a collection of the language-dependent short texts of selected sets.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListA_CharcAttribSeldSetTsQueriesNoOData query parameters: $filter, $select, $orderby, $top, $skip, $inlinecount.

Returns: CollectionOfA_CharcAttribSeldSetTWrapper|error

Sample code:

charattributecat:CollectionOfA_CharcAttribSeldSetTWrapper setTexts = check charattributecatClient->listA_CharcAttribSeldSetTs(
queries = {
\$filter: "SelectedCodeSetPlant eq '1010' and Language eq 'EN'",
\$top: 2
}
);

Sample response:

{
"d": {
"results": [
{
"SelectedCodeSetPlant": "1010",
"SelectedCodeSet": "COLOR",
"Language": "EN",
"SelectedCodeSetText": "Color check"
},
{
"SelectedCodeSetPlant": "1010",
"SelectedCodeSet": "SURFACE",
"Language": "EN",
"SelectedCodeSetText": "Surface finish"
}
]
}
}
getA_CharcAttribSeldSetT

Retrieves the short text of a selected set in a specific language.

Parameters:

NameTypeRequiredDescription
SelectedCodeSetPlantstringYesPlant of the selected set (e.g., "1010").
SelectedCodeSetstringYesSelected set (e.g., "SURFACE").
LanguagestringYesLanguage key (e.g., "EN").
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetA_CharcAttribSeldSetTQueriesNoOData query parameters: $select.

Returns: A_CharcAttribSeldSetTWrapper|error

Sample code:

charattributecat:A_CharcAttribSeldSetTWrapper setText = check charattributecatClient->getA_CharcAttribSeldSetT(
"1010",
"SURFACE",
"EN"
);

Sample response:

{
"d": {
"SelectedCodeSetPlant": "1010",
"SelectedCodeSet": "SURFACE",
"Language": "EN",
"SelectedCodeSetText": "Surface finish"
}
}

Code texts​

listA_CharcAttribSeldSetCodeTs

Retrieves a collection of the language-dependent texts of the codes in selected sets, for example to show inspectors the meaning of each code.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListA_CharcAttribSeldSetCodeTsQueriesNoOData query parameters: $filter, $select, $orderby, $top, $skip, $inlinecount.

Returns: CollectionOfA_CharcAttribSeldSetCodeTWrapper|error

Sample code:

charattributecat:CollectionOfA_CharcAttribSeldSetCodeTWrapper codeTexts = check charattributecatClient->listA_CharcAttribSeldSetCodeTs(
queries = {
\$filter: "SelectedCodeSetPlant eq '1010' and SelectedCodeSet eq 'SURFACE' and Language eq 'EN'",
\$select: ["CharacteristicAttributeCode", "CharacteristicAttributeCodeTxt"],
\$orderby: ["CharacteristicAttributeCode"]
}
);

Sample response:

{
"d": {
"results": [
{
"CharacteristicAttributeCode": "01",
"CharacteristicAttributeCodeTxt": "Smooth"
},
{
"CharacteristicAttributeCode": "02",
"CharacteristicAttributeCodeTxt": "Rough"
}
]
}
}
getA_CharcAttribSeldSetCodeT

Retrieves the text of a single code in a selected set in a specific language.

Parameters:

NameTypeRequiredDescription
SelectedCodeSetPlantstringYesPlant of the selected set (e.g., "1010").
SelectedCodeSetstringYesSelected set (e.g., "SURFACE").
CharacteristicAttributeCodeGrpstringYesCode group (e.g., "SURFACE").
CharacteristicAttributeCodestringYesCode (e.g., "01").
LanguagestringYesLanguage key (e.g., "EN").
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetA_CharcAttribSeldSetCodeTQueriesNoOData query parameters: $select.

Returns: A_CharcAttribSeldSetCodeTWrapper|error

Sample code:

charattributecat:A_CharcAttribSeldSetCodeTWrapper codeText = check charattributecatClient->getA_CharcAttribSeldSetCodeT(
"1010",
"SURFACE",
"SURFACE",
"01",
"EN"
);

Sample response:

{
"d": {
"SelectedCodeSetPlant": "1010",
"SelectedCodeSet": "SURFACE",
"CharacteristicAttributeCodeGrp": "SURFACE",
"CharacteristicAttributeCode": "01",
"Language": "EN",
"CharacteristicAttributeCodeTxt": "Smooth"
}
}

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[]>NoAdditional HTTP request headers.

Returns: http:Response|error

Sample code:

http:Request batchRequest = new;
string boundary = "batch_cac001";
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_CharcAttribSeldCodeSet(SelectedCodeSetPlant='1010',SelectedCodeSet='SURFACE') HTTP/1.1\r\n" +
"Accept: application/json\r\n\r\n" +
"--" + boundary + "\r\n" +
"Content-Type: application/http\r\n" +
"Content-Transfer-Encoding: binary\r\n\r\n" +
"GET A_CharcAttribSeldSetCode?$filter=SelectedCodeSetPlant%20eq%20'1010'%20and%20SelectedCodeSet%20eq%20'SURFACE' HTTP/1.1\r\n" +
"Accept: application/json\r\n\r\n" +
"--" + boundary + "--"
);
http:Response batchResponse = check charattributecatClient->performBatchOperation(batchRequest);

Returns the raw http:Response from the $batch endpoint. On success the status code is 202 Accepted and the body is a multipart/mixed payload containing one part per request in the batch, each with its own HTTP status line, headers and JSON body. Read it with batchResponse.getTextPayload() and parse each part as needed.