当前位置:网站首页>SAP Fiori 的附件处理(Attachment handling)
SAP Fiori 的附件处理(Attachment handling)
2022-07-25 16:21:00 【Jerry Wang】
以 SAP CRM Fiori 应用为例。附件处理有两个层面,即在 Fiori UI 上显示附件(读取操作),以及通过 Fiori UI 创建附件(写入操作)。
Attachment 的读取
如下图所示,点击任意 Attachment 超链接,
即自动打开浏览器下载窗口。
到该 OData 对应的实现系统,比如 AG3 后台,事物码 SEGW,打开 CRM_OPPORTUNITY OData 项目,创建一个名为 Opportunity_Attachments 的 association,指向一个名叫 OpportunityAttachment 的 Dependent Entity.
Opportunity 和 OpportunityAttachment 模型的关系是 0:n, 即一个 Opportunity 允许没有 attachment,也可以允许有多个 attachment.
Attachment 的模型字段:
我们可以在 AG3 设置断点,调试 attachment 的读取请求:
Fiori UI 把要读取的 attachment 实例信息通过 SAP UI5 代码传递给后台 ABAP:
最后调用 CL_CRM_OPPORTUNITY_DPC_EXT~GET_STREAM 方法从 AG3/001 系统上读取附件数据:
Fiori 前台即 S3.view.xml 使用的是 UploadCollection 控件来显示附件。
当 Attachment 标签页被点击时,触发 attachmentsTabSelected 方法:
在该方法里,手动调用 OData API 发起向后台读取数据的 OData 请求:
var info = this.getView().byId('info');
var headerGuid = info.getModel('json').getData().Guid;
var oModel = this.oModel;
var sPath = this.sPath;
// get the list to set the post url param
var that = this.getView();
oModel.read(sPath, null, [
"$expand=Attachments"
], true, jQuery.proxy(function(odata, response) {
var data = {
OpportunityAttachments: []
};
var length = response.data.Attachments.results.length;Attachment 的创建
点击 + 图标,从本地选择一个文件上传:
SAP UI5 控件能显示上传的进度条:
触发后台的 CL_CRM_OPPORTUNITY_DPC_EXT~CREATE_STREAM 方法:
CREATE_STREAM 方法创建流(媒体资源)和相应的实体(媒体链接条目)。附加信息可以在Slug头中提供。创建媒体链接条目的编排是首先执行HTTP Post,其中只包含二进制数据。注意,不允许先发布条目本身,然后再发布相关的媒体资源。基于Slug头,开发人员可以向服务器传递额外的信息,例如,服务器可用于存储二进制文件(媒体资源)和创建实体(媒体链接条目)创建的框架。新创建的实体(媒体链接条目)在HTTP响应中发送回使用者,可以使用适当的数据更新该响应。更新后的条目将在HTTP Put中发送到SAP NetWeaver Gateway系统,以完成创建媒体资源/媒体链接条目的过程。
边栏推荐
- Solve win10 disk occupation of 100%
- 狂神redis笔记12
- Talk about how to use redis to realize distributed locks?
- 【图像隐藏】基于混合 DWT-HD-SVD 的数字图像水印方法技术附matlab代码
- Analysis and solution of data and clock mismatch delay in SPI transmission
- Quickly deploy mqtt clusters on AWS using terraform
- Shared lock
- 如何安装govendor并打开项目
- MySQL乐观锁
- 链游开发现成版 链游系统开发详细原理 链游源码交付
猜你喜欢

百度富文本编辑器UEditor单张图片上传跨域

【图像去噪】基于双立方插值和稀疏表示实现图像去噪matlab源码

leetcode:6127. 优质数对的数目【位运算找规律 + 两数之和大于等于k + 二分】
![[image hiding] digital image watermarking method technology based on hybrid dwt-hd-svd with matlab code](/img/2a/b5214e9fa206f1872293c9b9d7bdb6.png)
[image hiding] digital image watermarking method technology based on hybrid dwt-hd-svd with matlab code

哪个led显示屏厂家更好

Win11自带画图软件怎么显示标尺?

食品安全丨无处不在的冷冻食品,你真的了解吗?

Equivalent change of resistance circuit (Ⅱ)

狂神redis笔记12

【图像隐藏】基于混合 DWT-HD-SVD 的数字图像水印方法技术附matlab代码
随机推荐
Simple rotation map and hamster beating
C# 音乐
哪个led显示屏厂家更好
ServletConfig 类和ServletContext 类
可验证随机函数 VRF
Win11自带画图软件怎么显示标尺?
【故障诊断】基于贝叶斯优化支持向量机的轴承故障诊断附matlab代码
Sum arrays with recursion
MySQL isolation level transactions
mysql 表读锁
MySQL table write lock
Understanding service governance in distributed development
linux内核源码分析之页表缓存
[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code
Product dynamics - Android 13 high-efficiency adaptation new upgrade
Promise期约
Mqtt x cli officially released: powerful and easy-to-use mqtt 5.0 command line tool
What is a physical firewall? What's the effect?
R语言ggplot2可视化线图(line)、自定义配置标题文本相关内容颜色和图例(legend)颜色相匹配(和分组线图的颜色相匹配、match colors of groups)
使用Huggingface在矩池云快速加载预训练模型和数据集