SAP K2 integration #

SAP integration with the K2 Cloud is enabled with cloud connector ECS Core.

With ECS Core it is possible to create REST services for SAP read write access and import these services as a so-called K2 SmartObject.
SmartObjects are business entities for data integration across different applications. Building a SmartObject is completely no-code and, once created, a SmartObject can be used for different purposes, e.g. for data integration in a workflow.

Step-by-step guide #

Here’s a step-by-step guide how SAP integration with ECS Core and K2 SmartObjects works.

Step 1: Create and deploy a web service for SAP read or write access in the ECS Core WebService Designer.

In this example a web service to create purchase requisitions with one material item in SAP is used.


Step 2: Export the web service into an OpenAPI definition.

This export can be done through the WebService designer or the ECS Core administration dashboard.
If it’s done via the WebService Designer, checkbox Use definition section (references) must be activated in the Options section for OpenAPI.
Also make sure to enter the Azure Relay endpoint in the Server Settings under Connections if you have integrated an Azure Relay instance.
If you don’t do this, the default local consumer endpoint “http://localhost…” will be taken and used in the definition.




If you want to download it from the ECS Core management dashboard, navigate to the Web Services section, select the required web service and click on Download OpenAPI Definition (with references). With this approach the Azure Relay endpoint (https://[Relay name] is automatically used in the definition, if you use Azure Relay with ECS Core as a secure data gateway.


Step 3: Create a Service Instance in K2.

The mandatory fields are marked red.




For the Default HTTPS Request Headers box the following template can be used.

{"$type":"SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader[], SourceCode.SmartObjects.Services.Endpoints.Common, Version=, Culture=neutral, PublicKeyToken=null","$values":[{"$type":"SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader, SourceCode.SmartObjects.Services.Endpoints.Common, Version=, Culture=neutral, PublicKeyToken=null","Name":"Authorization","Value":"Apikey 
[Your API Key]"}]}

Under Descriptor Location enter the path where the OpenAPI file is stored. In this example Amazon S3 is used as a file storage.
Click OK to create the SmartObject.

If Generate SmartObjects for this Service instance is checked, a SmartObject with the same name of the service instance is created directly.
However this is not recommended, because by using this checkbox, all default object types besided the objects coming from the OpenAPI definition are created for that SmartObject as well.


Step 4: Create a SmartObject

For a more precise control of the SmartObject creation, it should be created separately. The easiest way to directly test the functionality of a SmartObject is also via the Management Dashboard.
To do this, select the created service instance and click on Generate SmartObjects.
Only the Object Types must be selected in the following screen and not the System Types.


A new SmartObject for SAP integration can also be created in the K2 Designer.
Use Advanced SmartObjekt, only this type brings the functionality for third-party data integration.



Step 5: Test the SmartObject functionality

A newly created SmartObject can be executed and tested directly in the K2 Management Dashboard.
To do so, select the newly created object under the category REST (refresh it if necessary), select the desired method in the bottom right corner (name of the web service operation) and click Execute.


In the following screen, input parameters can be entered and the service executed.


Return values are displayed under RESULTS.


The SmartObject can then be used (e.g. in a K2 workflow or form).

Note: This was an example for a simple object without structured parameters (arrays, lists, etc.). For SmartObjects with complex parameters, additional configuration steps might be necessary.

ECS Core Online Help