当前位置:网站首页>SAP Fiori 的附件处理(Attachment handling)
SAP Fiori 的附件处理(Attachment handling)
2022-07-17 12:20:00 【汪子熙】
以 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系统,以完成创建媒体资源/媒体链接条目的过程。
边栏推荐
- 上学=挣钱?无需缴纳学费的神仙院校!
- 2022年浙江省中职组“网络空间安全”编码信息获取解析(完整版)
- Ffmpeg record video, stop (vb.net, step on the pit, class library - 10)
- Stream流
- 【分离式超图像分类平台】使用深度学习中那些令人兴奋的模型搭建图像分类平台
- Microsoft OneNote tutorial, how to insert mathematical formulas in OneNote?
- 无法改变的现状
- 高效理解 FreeSql WhereDynamicFilter,深入了解设计初衷[.NET ORM]
- String type function transfer problem
- R语言使用lm函数构建线性回归模型、使用subset函数指定对于数据集的子集构建回归模型(使用subset函数筛选满足条件的数据子集构建回归模型)
猜你喜欢
【微信小程序】使出千手浮图—回滚式
string类的介绍及模拟实现
基于JSP的小说写作与创作网站
The module created by yourself uses CMD to open the report modulenotfounderror: no module named solution
Huawei wireless device configuration intelligent roaming
opencv 画黑色矩形,并写上序号
KunlunBase 线上Meetup等您来~
中科磐云——网络空间安全抓包题目 B.pcap
上學=掙錢?無需繳納學費的神仙院校!
Relationship between standardization, normalization and regularization
随机推荐
STM32F407 NVIC
Flink entry to practice - stage 5 (processing function)
2022年湖南省中职组“网络空间安全”数据包分析infiltration.pacpng解析(超详细)
Analysis of the "Cyberspace Security" competition of Hunan secondary vocational group in 2022 (super detailed)
R语言ggplot2可视化:使用ggpubr包的ggstripchart函数可视化点状条带图(dot strip plot)、设置add参数为mean_sd添加均值标准差竖线、设置error.plot
B. AccurateLee【双指针】【substr函数】
Effectively understand FreeSQL wheredynamicfilter and deeply understand the original design intention [.net orm]
Pfsense configure tailscal site to site connection
FreeRTOS个人笔记-临界值的保护
Blender自动化建模入门
【附下载】带你使用frp实现内网穿透详细教程!
Good news
HCIA 静态基础实验 7.8
The magic of asynclocalstorage
2022.07.14 暑假集训 个人排位赛(九)
Overview of 6G oriented smart reflector wireless communication
2022年湖南省中职组“网络空间安全”赛题解析(超详细)
微信小程序云开发 1 - 数据库
HCIA OSPF
Quick completion guide of manipulator (XIII): joint space trajectory planning