Esti
Esti

Reputation: 3687

How to add an image to a SAP Adobe Form from the MIME repository?

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:

Upvotes: 3

Views: 17700

Answers (1)

Esti
Esti

Reputation: 3687

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'

Upvotes: 5

Related Questions