Set up the SAP writeback service
Step 1: Set up the SAP server destination
To send requests to your SAP S/4HANA instance, set up the SAP host destination.
An SAP instance is a configuration for an external SAP S/4HANA destination system. The instance resource contains all the information this API service needs to connect to the SAP S/4HANA destination.
Send a POST request to https://{cluster}.cognitedata.com/api/v1/projects/{project}/writeback/sap/instances
to create an SAP instance destination. See API documentation for more information.
Step 2: Set up your schema mapping (Optional)
The SAP writeback service provides schema mapping functionality to map a Cognite Data Fusion (CDF) resource data schema to an SAP entity schema. The mapping must be defined using the Cognite extractor mapping language. If you set a mapping, the SAP writeback service will apply the mapping expression before sending the request to the SAP destination.
The example below contains an expression mapping the Cognite InField observation schema to the SAP maintenance notification schema:
{
"NotificationText": substring(input.description,0,40),
"MaintPriority": case(input.priority,"Very High","1","Medium","2","Low","3"),
"NotificationType": input.type,
"MaintNotifLongTextForEdit":concat(input.description,input.troubleshooting),
}
Write the mapping expressions to fulfill your business needs regarding field or value mapping between Cognite Data Fusion and SAP entities.
To save your mapping, send a POST request to https://{cluster}.cognitedata.com/api/v1/projects/{project}/writeback/sap/mappings
. See API documentation for more information.
Step 3: Set up the SAP endpoint destination
In the SAP writeback service, an SAP endpoint is a configuration to an SAP S/4HANA OData endpoint (and its related OData entity). The API will send writeback requests to this endpoint. It defines which SAP instance destination and schema mapping should be used when processing a writeback request. Use the SAP endpoint as a reference to send requests to your SAP destination.
To set the SAP endpoint, send a POST request to https://{cluster}.cognitedata.com/api/v1/projects/{project}/writeback/sap/endpoints
. See API documentation for more information.