如何从 MIME 存储库将图像添加到 SAP Adob​​e Form?

发布于 2024-09-18 03:51:43 字数 727 浏览 3 评论 0原文

我已将图像加载到 SAP MIME 存储库:

名称:watermark100.bmp

MIME 类型: 图标(在属性窗口的技术信息下。我没有设置此项,我假设 SAP 默认是基于我上传时的文件类型)。

现在我尝试在 SAP adobe 表单中显示此图像:

在表单界面中,我创建了一个全局常量:

GV_IMG_WATERMARK TYPE STRING VALUE 'watermark100.bmp'

在上下文中,我创建了一个图形节点:

Name:         WATERMARK
Graphic Type: GRAPHIC CONTENT
Field:        GV_IMG_WATERMARK 
MIME Type:    'icon'  //I have also tried '.bmp'

不幸的是,当我测试表单时,没有图像显示。知道我做错了什么吗?

附加评论:

  • 我可以通过指向 URL 来显示图像将其嵌入表单中,但这对于我想要做的事情来说还不够。图像必须从 MIME 加载,并且显示节点将是有条件的。
  • 似乎有一种有点复杂的方法,我可以将图像转换为 XSTRING 并将其传递给表单,接下来我可能会尝试这种方法,但对于我想要实现的目标来说,它似乎过于复杂。

I have loaded an image to the SAP MIME Repository:

Name: watermark100.bmp

MIME Type: Icon (Under technical information on the properties window. I didn't set this, I assume SAP defaults that in based on the file type when I upload).

Now I'm trying to display this image in a SAP adobe form:

In the Form Interface I have created a global Constant:

GV_IMG_WATERMARK TYPE STRING VALUE 'watermark100.bmp'

In the Context I have created a Graphic Node:

Name:         WATERMARK
Graphic Type: GRAPHIC CONTENT
Field:        GV_IMG_WATERMARK 
MIME Type:    'icon'  //I have also tried '.bmp'

Unfortunately, when I test the form, no image displays. Any idea what I'm doing wrong?

Additional Comments:

  • I can display the image by pointing to the URL & embedding it in the form, but that is not sufficient for what I'm trying to do. The image have to be loaded from MIME, and displaying the node will be conditional.
  • There seems to be a somewhat convoluted way where I can convert the image to an XSTRING and pass that to the form, I will probably try that next, but it seems overly complex for what I'm trying to achieve.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诗化ㄋ丶相逢 2024-09-25 03:51:43

好的,我已经通过以下方式解决了这个问题:

更改了数据声明,如下所示: URL 仅遵循 MIME 存储库中的树结构

data:      gv_bmp_watermark type xstring.
constants: gc_url_watermark type string 
    value '/BC/PUBLIC/MyImages/watermark100.bmp'.

在“代码初始化”下的界面中,我添加了以下内容:(请注意,您必须导入和导出使用顶部接口的相关变量 - 如果不这样做,您将得到一个相当不言自明的编译错误)

//* Read Images
data: lr_api type ref to if_mr_api.

lr_api = cl_mime_repository_api=>get_api( ).

lr_api->get( exporting i_url = gc_url_watermark
             importing e_content = gv_bmp_watermark ).

Context 节点仅略有变化:

Name:         WATERMARK         
Graphic Type: GRAPHIC CONTENT         
Field:        GV_BMP_WATERMARK          
MIME Type:    'image/bmp'

Ok I've solved it in the following way:

Changed the data declarations as follows: The URL just follows the tree structure in the MIME Repository

data:      gv_bmp_watermark type xstring.
constants: gc_url_watermark type string 
    value '/BC/PUBLIC/MyImages/watermark100.bmp'.

In the interface under Code Initialization I added the following: (Note that you have to import & export the relevant variables using the interface at the top - you'll get a fairly self-explanatory compile error if you don't)

//* Read Images
data: lr_api type ref to if_mr_api.

lr_api = cl_mime_repository_api=>get_api( ).

lr_api->get( exporting i_url = gc_url_watermark
             importing e_content = gv_bmp_watermark ).

The Context node only changed slightly:

Name:         WATERMARK         
Graphic Type: GRAPHIC CONTENT         
Field:        GV_BMP_WATERMARK          
MIME Type:    'image/bmp'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文