Skip to main content

Hello K2 folks,

I've got a Question regarding K2 and SAP. 

I have a table filled with assets which our company is renting to our customers. Once every Day this table should be checked by a job in SAP. If some requirements are true I want SAP to start a new Instance of a Wokflow in K2.

Does anybody did sth similar and can tell me how to do so?

 

Many thanks for upcoming help 

Best regards

Sparrow aka. Tim

I am not to familiar with SAP, but is this an SAP job or some sort of windows/web service developed inhouse to check these records?


 


If it is a window/web service that was developed in-house, perhaps you can reference the K2 API and start K2 process that way.  Some possible method to starting K2 processes include:


 


1.  K2 API (referencing SourceCode.HostClientAPI and SourceCode.Workflow.Client) as per https://www.k2.com/onlinehelp/k2blackpearl/devref/current/webframe.html#Start_Instance_and_Get_Data_Fields.html


 


2.  Using the K2Services REST/WCF services to start process instances:


https://www.k2.com/onlinehelp/k2blackpearl/devref/current/webframe.html#Using_K2_REST_Services_with_ASP.NET_Applications.html


https://www.k2.com/onlinehelp/k2blackpearl/devref/current/webframe.html#Process%20Endpoint%20and%20Methods.html


https://www.k2.com/onlinehelp/k2blackpearl/devref/current/webframe.html#start_a_workflow_using_WCF_service.html


 


3.  Using K2 Smartobject REST/WCF services to call the process Smartobject and start an instance:


https://www.k2.com/onlinehelp/k2blackpearl/devref/current/webframe.html#K2_SmartObject_Services_Introduction.html


 


Essentially, either the SAP job or your custom job will need to call into the K2 Host Server to start process instances.


Although, its hard to say without knowing much about your solutions. This doesn't necessarily mean you will have to use the K2 API or write any code. What you can do is to create a polling workflow or even a scheduled workflow. So create a smartobject out of your database table with a list method. Creat a new process; at the start, call the list mehtod and store the contents of the result into a xml datafield. Then have another activity with the destination as the list method. Then execute a start workflow method for each item and pass in the corresponding xml data fields to that process. You can do this via IPC event. Then when that activity has finished looping through all the items, loop it back to the start(draw a line from that to the start). On the start, if you want this to run every day then set the start delay rule to one day or whatever values you want. and it will automatically run the follwing day and do the same.

 

Hope that gives you some ideas.

 

 


Reply