SAP FSM study notes (a): API consumption data using the FSM

SAP FSM (Field Service Management), belonging to the SAP C / 4HANA five cloud in the Service Cloud.

On its review, can refer to a colleague Jerry Xu Julong 2018 article: SAP Chengdu Institute Xuju Long: Hello, Coresystems!

Because the project needs, Jerry was learning to use FSM. Today just to get the system account, learn afternoon for three hours, with code written colleague Li Cris in the group did some testing in the system, the study notes written down.

This article does not introduce any profound things, is purely my personal record study notes, convenient future reference.

Before Jerry push the micro-channel video SAP FSM and integrated intelligent services scenario presented in prototype development, FSM needs to be able to display data in the micro letter, such as FSM in product and customer master data:


A simple way is to use the Query API FSM provides.

Open the help documentation FSM official website:
https://docs.coresystems.net/dev-index.html

Enter the relevant part of the Query API:

By reading the documentation, that the FSM Query API and uses a Facebook Query Language, SAP Hybris Flexible Search and ABAP Open SQL is similar to the idea that imitation SQL query syntax to read data from the FSM system.

Below is an example of the Facebook Query Language:

The figure is SAP Hybris Commerce Flexible Search examples:

ABAP Open SQL examples I will not put up, we too familiar.

Then the FSM's Query API how to use it?

Log in FSM, click the Query API:

In the pop-up to the console, enter class SQL statement:

SELECT bp FROM BusinessPartner bp
default data returned before 40:

那么如何使用代码来触发Query API查询呢?官网上给出了一个基于nodejs的SDK,可以轻易实现用代码调用Query API的需求。

点击超链接后,会跳转到github的一个仓库:

按照帮助文档上的示例代码,将自己FSM系统里创建的API client对应的credential维护到代码里,得到一个CoreAPIClient实例。

ClientIdentifier和clientSecret等Credential字段的值,可以通过Admin标签页,新建一个Client后获得:

使用CoreAPIClient实例的query方法向FSM系统发起Query API请求,输入参数一为应用程序里拼接的类SQL查询语句,参数二为Data Transfer Object的名称,在帮助文档里能查到。

通过Visual Studio Code调试器观察上面这个API调用返回的结果。因为我的752和753行代码分别指定了Item和BusinessPartner的查询,因此API调用返回的响应是一个数组,其内两个元素分别包含了Item和BusinessPartner各前40条数据。

每个Item和Business Partner实例的明细在调试器里显示如下:


后续Jerry会继续学习FSM并把所学分享给大家,感谢阅读。

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

Guess you like

Origin www.cnblogs.com/sap-jerry/p/12158466.html