SAP also secondary development of products with ABAP? To understand this new concept of development of the secondary bar

Jerry from the end of 2018 so far, has written a series of articles on the SAP Kyma, venue to the end of this article you can get a list of these articles. Kyma is a SAP-based open source cloud Kubernetes native application development platform, SAP's partners to allow simple and modern way of SAP cloud solutions and traditional On Premises products to connect, integrate and extend. The so-called "modern", that is, during the second development partners, can take full advantage of new technologies in recent years, enterprise development areas continue to emerge, such as Serverless computing, micro-service architecture and so on.

clipboard1,1

Kyma is completely open source and free, anyone can try to install it on your local computer. Of course, there are some attempts to install their own local threshold, because the installation process needs to take some of the drag associated Kubernetes image from Google's website, it is necessary to learn "on the Branch (fang) school (zhi) (he) network (xie)".

The SAP Cloud Platform Extension Factory, SAP is further improved and the launch of the open source project Kyma a commercial solution itself does not sell alone, but as an integral part of SAP cloud platform.

clipboard2,2

Kyma relations and SAP Cloud Platform Extension Factory, and like the same relationship between the Open UI5 and UI5 SAP Fiori framework currently in use. Jerry particular in the context of this article, because every time Jerry did not want to knock out "SAP Cloud Platform Extension Factory This five words," so unified Kyma below or use the word.

Jerry previous article  WordPress, SAP Kyma integration, and micro-channel three , explains how to use SAP Kyma in Lambda Function, listening post.created event WordPress, thereby enhancing the completion of WordPress.

今天这篇文章,让我们把通过SAP Kyma进行扩展的对象换成C/4HANA中的一朵云,SAP Cloud for Customer(C4C)。Jerry希望每当C4C中有新的Opportunity创建时,C4C都会把这个事件通知给Kyma上的Lambda Function,后者作为事件监听函数,可以进行对应的处理,具体做什么逻辑,大家可以试着开开自己的脑洞。

比如实现一个Account Address Enrichment的功能,就是用户在C4C里创建Account时,只需要维护基本的地址信息,然后点击保存,C4C发送事件给Kyma,后者接到这个事件后,调用SAP API Hub上的Address微服务,把丰富过后的地址详情通过C4C Account OData API调用的方式,写回C4C。通过这个增强,减少了C4C用户录入数据的工作量,同时也展示了Kyma与被其扩展的C/4HANA产品的数据双向读写功能。

clipboard3,3

下面我们就来看看这个扩展如何完成。

首先当然是要把C4C同Kyma建立起互相信任的连接了。对于SAP partners来说,好消息是这个连接的配置是一个黑盒子,通过下图Kyma的Application Connector模块完成,partners不需要了解其技术实现。

clipboard4,4

首先进入SAP Cloud for Customer的Administration的工作中心,打开General Settings视图,进入Event Notification配置UI:

clipboard5,5

新建一个C4C OData事件和API的消费者:

clipboard6,6

类型选择SAP Cloud Platform Extension Factory,即Kyma:

clipboard7,7

这个Remote Environment URL从哪里来呢?就是SAP Kyma应用里的Application Connector对应的url:

clipboard8,8

到Kyma控制台的应用里,点击Connect Application,就得到了需要维护到C4C里的url:

clipboard9,9

维护了回调用户名和密码之后,再添加Subscription,即您希望将Cloud for Customer系统里的哪些BO事件,发布给Kyma:

clipboard10,10

我选择了Account和Opportunity这两个BO的创建和更新事件,暴露给Kyma:

clipboard11,11

成功保存并激活配置:

clipboard12,12

回到Kyma的应用界面,在Provided Services & Events界面下,此时能看到Cloud for Customer发布过来的API和事件了:

clipboard13,13

进入Kyma Service Management的Catalog界面下,找到从Cloud for Customer系统导入进来的服务,

clipboard14,14

进入服务明细,能观察到Cloud for Customer系统发布的BO事件的字段参数,

clipboard15,15

以及该C4C系统所有支持的OData API列表。如果我们期望在Kyma的Lambda Function里对C4C的数据进行写回操作,就得使用这些OData API.

clipboard16,16

接下来,我们就可以基于这些API和事件进行Lambda Function的开发了。

首先基于C4C导入进来的服务,创建一个新的实例:

clipboard17,17

确保实例处于运行状态:

clipboard18,18

然后基于该实例创建一个新的Lambda Function:

clipboard19,19

Lambda Function的触发方式,选择之前C4C暴露的BO创建和修改事件:

clipboard20,20

由于文章篇幅原因,这里暂时不介绍在Kyma Lambda Function里如何调用C4C的OData API,而只是简单的打印出C4C传递过来的事件参数:

clipboard21,21

至此Kyma端的开发和配置就结束了,是不是觉得步骤非常简单明了?

现在到C4C里创建一个新的Opportunity,保存:

clipboard22,22

到C4C的Event Notification Monitoring界面去,观察到Opportunity创建的事件已经成功被投递到Kyma去了,对应的Kyma实例的url也可以在投递明细里查看到。

clipboard23,23

再回到Kyma Lambda Function的日志界面,这里也看到了Lambda Function实现体里打印出的来自C4C的事件明细:

clipboard24,24

Why only two guid print it? Because BO C4C event exposed, it will only contain parameter specifications in the current node and guid Root node of the event. As for how to call C4C in Lambda Function Kyma's OData, we talk to you in the future.

clipboard25,25

We can try to compare, how C4C secondary development of the traditional way, how to listen BO creation and update events it? That is to use SAP Cloud Application Studio, create BO enhanced Solution, and then create AfterModify in the BO node and implemented by ABSL programming.
clipboard26,26

The SAP Kyma turned out, really like SAP's official propaganda as to SAP partners who provide secondary development of a new way to be different from the past in the ABAP platform. By event listener mechanism provided by SAP Kyma, a secondary development of SAP employees no longer need to be enhanced to address technical details of SAP solutions have too much knowledge, only defined interfaces within the context of Kyma Lambda Function, call the public stable API, to complete the development tasks.

clipboard27,27

I hope this can be the majority of the SAP secondary development practitioners who inspire, thanks for reading.

For more Jerry's original article, please pay attention to the public number "Wang Zixi":
公众号截图

Guess you like

Origin www.iteye.com/blog/jerrywang-sap-2443920