如何将SAP API Hub 上提供的工作流导入到 SAP BTP 上
官网链接:https://developers.sap.com/tutorials/cp-starter-ibpm-employeeonboarding-2-configure.html
SAP Workflow service: helps to digitalize workflows and quickly orchestrate tasks that span people, applications, and organizations.
SAP 工作流服务可以使企业运行流程实现数字化,让横跨企业组织架构,应用和员工的任务能够协同工作。
通过这些任务(比如审批,订单履行,以及对时间敏感的合作伙伴协作)的自动化和无缝跟踪与协调,企业生产力得以提升。
You can enhance productivity by automating and tracking coordinated, account-able tasks – including approvals, order fulfillment, or time-sensitive partner collaboration.
The sample business rule used in this scenario is published in API Business Hub.
链接地址: https://api.sap.com/package/EquipmentDeterminationRules?section=Artifacts
SAP Business Rules service is part of SAP Workflow Management which enable business users & application developers to automate their decisions and enhance their decision-making experience. It offers simplified Fiori-based rule authoring tool & a central rule repository with various deployment options to different runtimes.
SAP Business Rules Service 是 SAP workflow management 的一部分,使业务用户和应用开发人员能够自动化其决策制定,以及增强决策制定的体验。
SAP Business rules Service 提供了简化的基于 Fiori 风格的规则创作工具以及规则存储仓库,以及各种部署选项,支持多种运行环境的部署。
SAP Process Visibility service:
SAP 流程可见性服务:提供对运行在 cloud 或者 On-Premises 或者混合环境下的流程可见性的洞察功能。
provides visibility into processes that run in the cloud, on-premise, or in hybrid environments.
Process visibility works on events. SAP or non-SAP applications (cloud or on-premise) push events into Process Visibility.
Process visibility 基于事件工作,接收来自 SAP 或者 非 SAP 应用的事件推送。
These events are persisted, processed and enhanced to form end-to-end process instances with insights, which are visualized by business users in their process workspace.
这些事件被持久化且进一步增强,形成具有洞察力的端到端流程实例。业务用户在其流程工作区(一个 Fiori Launchpad tile 的名称)中以可视化的方式查看。
The insights enable business users to identify process bottlenecks, track process performance, and operational issues and act on them.
这些见解使业务用户能够识别流程瓶颈、跟踪流程绩效和运营问题并对其采取行动。
BUSINESSRULES_APIHUB destination is used in Manage Rule Projects application to import business rules from API Business Hub.
从 API Business Hub 导入 business rule.
This destination is already created in the previous set up tutorial, and now you will configure the destination for the password.
确保该 Destination 能够正常工作:
创建一个新的 system:
指向 SAP API Business Hub:
在 Manage Projects 里,选择 Import Project from API Business Hub:
选择 Equipment determination business rules:
如果遇到 Bad gateway error 的错误消息,检查 Destination 里维护的用户名和密码是否正确:
If you get Bad Gateway Error error, then check the username and password you have used in BUSINESSRULES_APIHUB destination. If your user is 2-Factor-Authentication enabled, then the password will be password+passcode. This passcode will expire in a minute.
点击这个按钮:
点击 deploy 按钮:
可以选择 Deploy 到 Cloud Runtime 或是 Success Factors,这里我们选择前者。
部署成功:
Only deployed business rules can be consumed via APIs published in API Business Hub.
下载这个例子程序的源代码: https://github.com/SAP-samples/cloud-workflow-samples/blob/master/cf-onboarding-sample/resources/cf-onboarding-sample.zip
登录 SAP Business Application Studio:
创建一个 dev space:
确保 space 处于 running 状态:
打开 workspace,导入 reference workflow 应用:
打开的 workflow 项目如下图所示:
这个 MTA 应用的核心是这个工作流 onboard.workflow:
起始事件:
这个工作流包含如下内容:
一个名为 determine equipment 的 service task:
script task:
为员工决定出需要的工作设备:
这个 script task 的执行,位于 script file 里:
这些字段的值来自 sample Data:
service task:
business rule:
输入和输出:
user task:confirmation of the equipment selected via business rules and for the approval of equipment.
确认通过 business rules 选择的 equipment 并审批。
这个 user task 的接收者:info.startedBy, 也就是说,谁启动这个 workflow 实例,谁就会接收到 Change or Confirm Equipment 这个 task:
这些 user task 的 UI, 实现在 forms 文件夹下面:
选择项目文件夹里的 mta.yaml 文件,右键菜单里选择:Build MTA Project:
上图 Build MTA Project 的菜单,实际执行的是 mta build -s '/home/user/projects/cf-onboarding-sample' 的命令行:
build 成功后,在 mta_archives 文件夹里,生成了一个 .mtar 压缩包:
通过菜单 Deploy MTA Archive, 把这个压缩包,部署到运行时:
需要输入用户名和密码,在 SAP Business Application Studio 里登录 SAP BTP:
成功登录:
选择 CloudFoundry 环境里的 organization 和 space:
可以使用如下命令行查看日志:
cf dmol -i 4f65fe6d-cf36-11eb-a329-eeee0a914605
使用 Fiori Launchpad tile Configure Visibility Scenarios:
创建一个新的 scenario:
把之前创建好的 workflow 添加到这个 scenario 里来,这样,后续就可以使用该 scenario,查看该 workflow 的执行明细:
workflow 的 id,可以从源代码里获得:
之后,onboard 工作流所有的事件和上下文都已经成功导入了:
创建一个新的 sub-status:
关于后续测试,参考 Jerry 的文章:SAP 业务技术平台(SAP Business Technology Platform) Workflow 工作流功能介绍