Overview
The S/4HANA OData plugin reads data from an OData service in SAP S/4HANA. You pick a service from the SAP Gateway catalog, pick an entity set, and the plugin returns its records as fields you can map to other plugins.
You can find the plugin in the S/4HANA group on the left panel of the Designer section. Its output fields act as a source for the plugins that follow it. You can also map source fields into its filter to read only matching records.
The plugin currently supports the Read operation on entity sets. Function imports are listed but cannot be used yet.
Connecting to SAP
The plugin connects over HTTPS with a Password Manager entry.
The Password Manager entry must have a Url key in its Options with the address of the S/4HANA system, for example https://host_name:443. The user name and password of the entry are used to log on.
The plugin logs on with HTTP basic authentication. If the Url key is missing or is not a valid URL, the Target System field shows a validation message, and the run stops with the error "Please define 'Url' in Password Manager System". A wrong user name or password is reported as 401 (Unauthorized).
Open the Settings section of the plugin:
- Under Target System, select the Password Manager entry.
- Under Catalog Service, click Get Services. The plugin reads the list of services from the SAP Gateway catalog service (
/sap/opu/odata/IWFND/CATALOGSERVICE;v=2, entity setServiceCollection). - Select a service in Select Service. You can type to filter the list by description or title.
- Click Get Endpoints and select an entity set in Select Endpoint. The plugin reads the service's
$metadatadocument to list the entity sets. You can type to filter the list by label or name. Entity sets that contain errors in the service metadata are marked. - Under Options, set the read options (see below) and click Build Structure.
The plugin builds a Filter item from the entity properties and an export structure with all properties of the entity. Key properties are selected in the filter by default.
Options
| Setting | Description |
|---|---|
| Operation | The HTTP operation. Only Read is available. |
| MaxCount | Maximum number of records to read. 0 means no limit. |
| Use Paging | Reads the records in pages instead of one request. |
| Page Count | Number of records per page when Use Paging is on. The default is 50. |
The options depend on the SAP annotations of the entity set in the service metadata. MaxCount is shown only if the entity set supports $top (sap:topable), and Use Paging and Page Count are shown only if it supports paging (sap:pageable).
If you change the service or entity set later, click Build Structure again. The plugin adds new properties to the filter, updates changed ones, removes properties that no longer exist, and rebuilds the export structure. Fields that were removed lose their mapping.
Fields
Open the Fields section to choose what appears on the canvas.
- The Import tab holds the Filter structure. Select the properties you want to filter by.
- The Export tab lists the properties returned by the entity set, including the fields of complex types. Select the ones you need, or click Select All.
Key properties are marked with K.
Building the filter
Map source fields to the filter properties, or set default values. Then click Filter Editor on the filter item to open the Query Editor:
- Click Generate to create a query that compares each selected property with its value (
eq), joined withand. Generating replaces any existing query, and the plugin asks you to confirm first. Only properties that are mapped, or that use Ignore Source. with a default value, are included. For an Ignore Source. property the default value is written into the query directly. - Generated values are written as OData literals for the property type: text as
'{Material}', dates asdatetime'{...}', date-time offsets asdatetimeoffset'{...}', times astime'{...}', and decimals as{...}d. If you write the query yourself, add the quotes and type prefixes yourself as well, because the plugin inserts the raw value. - Edit the query with any OData
$filtersyntax. Write a property name in braces, such as{Material}, where its value should go. - Click Ok to save the query, or Cancel to discard your changes.
At run time, the plugin fills the query once for each unique combination of source values and joins the results with or. The combined expression is sent as the $filter parameter.
Before a value is inserted, the plugin applies the field settings (upper case, leading zeros, default value) and doubles any single quote in it, so that the value is a valid OData string. For Boolean properties, X or 1 becomes true, and an empty value or 0 becomes false.
Field settings
Click a field on the canvas to open its settings:
| Setting | Description |
|---|---|
| Default Value | Value used for a filter property. Choose No Default Value., Ignore Source. (always use the default value), or Only If Source Empty. |
| Convert To Upper Case | Converts the value to upper case. |
| Add Leading Zeros | Pads the value with leading zeros. |
| Remove Leading Zeros | On export fields: removes leading zeros from the returned value. |
| Truncate | Cuts values that are longer than the property length. |
Not every setting is shown for every property: Add Leading Zeros and Remove Leading Zeros are available for text (Edm.String) properties, and Truncate for decimal and double properties. For date properties the default value is entered with a date picker. Each field also shows its OData data type.
Run-time behavior
The plugin sends a GET request to the selected entity set in JSON format, with the $filter, $top, and $skip parameters as needed. With paging, it keeps requesting pages until it reaches MaxCount or no more records are returned.
Without paging, the plugin sends one request, with $top set to MaxCount when it is greater than 0. With paging, each request asks for at most Page Count records and uses $skip to move to the next page.
The records returned by SAP become the rows of the export structure. Fields of complex types are read from the nested JSON objects.
Simulation mode
The plugin only reads data, so simulation mode does not change its behavior.
Log
The request data and, if object logging is on, the response are written to the log. HTTP and OData errors returned by SAP are shown in the log with their code and message.
The technical log of each run starts with the plugin name, the selected service and entity set, and the plugin version. It then shows:
- the input data section with the filled
$filterexpression; - the output data section with the JSON response, if object logging is on in the Logging Manager.
Prerequisites
- A Password Manager entry with a Url key and a user who may call the OData service.
- The SAP Gateway catalog service (
/IWFND/CATALOGSERVICE, version 2) must be reachable for Get Services. - The OData service you want to read must be active in SAP Gateway and return JSON (OData V2, with results in the
d/resultsstructure).
Our experienced team of experts has the capability to develop customized solutions to fit your individual needs.
Please contact us for more information on how we can help you.