专栏首页Jerry的SAP技术分享如何将SAP CRM里维护的Account图片显示到Fiori应用中

如何将SAP CRM里维护的Account图片显示到Fiori应用中

We have to launch CRM WebUI, upload a new attachment for given account:

This attachment should meet the following criterias, to make sure it could be used as logo for the current account:

  1. it must be an image file ( type JPEG Graphic or other image format )
  2. in property maintenance window, it must be set as default document among all attachments and document type must be BDS_IMAGE.

In the runtime, when you open Fiori UI, it takes two steps to get the image rendered in UI finally. These two steps could just be observed in the Chrome network tab.

Step1 - Fiori UI asks for the image URL from backend.

Previously, I consider Fiori UI asked the binary content of image from backend, this is COMPLETELY WRONG! The complete url for the first step: https://jerry.sap.corp:4080/sap/opu/odata/sap/ZJERRY_DEMO_SRV/AccountCollection(‘4031140’)?$expand=Logo

From url we know there is an expand operation on node Logo. Check response in Chrome, there is no image binary source contained in response.

the url contained in Logo node is used as the requested url for the second step, as could be observed in Chrome:

: The complete url returned by first step:

https://jerry.sap.corp:2030/sap/opu/odata/sap/ZJERRY_DEMO_SRV/AttachmentCollection(documentID=‘FA163EEF573D1EE585804C8B6241ABA3’,documentClass=‘BDS_POC1’,businessPartnerID=‘4031140’)/$value

Although it contains an “Attachment” in url, it HAS NOTHING TO DO WITH the tab in Opportunity detail page! It just indicates that the technical storage of account logo is done via CRM Attachment model.

Step2 - bind the url to image field in application

Check the xml binding path for image field in Opportunity detail view: it is bound to ImgSrc in json model.

In application code, it just fills that json model field with url returned by step1:

And this operation will lead to a delayed re-render later to set the native html property “src” for image field, which is done by framework:

Conclusion: The http request sent in second step is not issued by My Opportunity application, but by browser itself, once an image element is filled with actual url on its “src” property. To simply prove this conclusion:

Create a simple html file as below, just paste the url for second step into src property:

<html>
<img src="https://jerry.sap.corp:2030/sap/opu/odata/sap/ZJERRY_DEMO_SRV/AttachmentCollection(documentID='FA163EEF573D1EE585804C8B6241ABA3',documentClass='BDS_POC1',businessPartnerID='4031140')/$value"></img>
<html>

Open it in Chrome, and you can observe exactly the same network behavior as when you open the application with an image in Fiori ui:

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • SAP Fiori image的显示原理

    Recently I am working on an issue regarding my responsible application and I fou...

    Jerry Wang
  • SAP CRM系统里的附件存储逻辑

    My research about how attachment data is stored in cluster table:

    Jerry Wang
  • SAP CRM系统里的附件存储逻辑

    My research about how attachment data is stored in cluster table:

    Jerry Wang
  • SAP Fiori image的显示原理

    Recently I am working on an issue regarding my responsible application and I fou...

    Jerry Wang
  • 一个ABAP和JavaScript这两种编程语言的横向比较

    There are already two great blogs which stress why ABAPers should learn Javascri...

    Jerry Wang
  • 【开源】XPShadow, 用阴影让UWP更有层次感

    UWP采用的是纯扁平化的设计,个人感觉极端了点,整个世界都是平的,导致App分不清层次,看不出重点。其实扁平化是趋势,android, ios都在搞,问题是an...

    用户1147588
  • 懒人查看python源码方法

    再把代码贴到IDE中即可

    py3study
  • how do you usually upload picture in SCN A workaround for current SCN upload is

    版权声明:署名,允许他人基于本文进行创作,且必须基于与原先许可协议相同的许可协议分发本文 (Creative Commons)

    Jerry Wang
  • P of EAA 总结

    看了几遍了,就只在书上勾了下,也没什么总结。暂且先把关键内容摘抄如下: Domain Logic Patterns Transaction Script Org...

    用户1172223
  • k8s常用命令

    Java学习录

扫码关注云+社区

领取腾讯云代金券