Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Display Image in Adobe from using RAWSTRING data

alok_patra
Product and Topic Expert
Product and Topic Expert
4,152

Hello,

My requirement is to print an image in Adobe form based on the RAWSTRING received from a front end non-SAP app.

The images are stored on the front end app and the converted RAWSTRING is sent back to SAP system based on user selection. SAP program receives the data as a 2000 character RAWSTRING format through a RFC call.

In Adobe form, I have created an image field and mapped to a graphics node in context menu. In code initialization section, RFC populates the XSTRING variable mapped to graphics node, however, image is not getting displayed on the form.

I tried to put an image in MIME and used it in form, and it worked.

I want your help to understand:

  1. Is it required to convert RAWSTRING to XSTRING before it is used in form?
  2. Is there any way to check the incoming RAWSTRING valid
  3. Is there any other way to achieve this requirement?

Thanks,

Alok

4 REPLIES 4
Read only

roberto_forti
Contributor
0 Likes
2,569

Hi Alok,

Try to upload graphics with transaction SE78 and then method below can help you.

CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp.

Regards,

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
2,569

"Is it required to convert RAWSTRING to XSTRING "

This question simply makes no sense.

Please look up the documentation about built-in dictionary types and ABAP types.

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenddic_builtin_t...

Read only

0 Likes
2,569

On the context, the graphic MIME type is 'IMAGE/BMP'?

Are you inserting an image field and marking the check box “Embed Image Data” on the forma layout?

Try to download the image and open It

Use the methods below: cl_gui_frontend_services=>file_save_dialog cl_document_bcs=>xstring_to_solix cl_gui_frontend_services=>gui_download

Sample code

" Download the image

DATA: lv_filename TYPE string,

lv_path TYPE string,

lv_fullpath TYPE string,

lv_user_action TYPE i.

CALL METHOD cl_gui_frontend_services=>file_save_dialog

EXPORTING

file_filter = '*.jpg'

default_extension = 'jpg'

default_file_name = 'file_name'

initial_directory = 'C:\TEMP\'

CHANGING

filename = lv_filename

path = lv_path

fullpath = lv_fullpath

user_action = lv_user_action

EXCEPTIONS

cntl_error= 1

error_no_gui = 2

invalid_default_file_name = 3

not_supported_by_gui = 4

OTHERS = 5.

DATA(lt_jpg_content) = cl_document_bcs=>xstring_to_solix( ip_xstring = <your xstring> ).

CALL METHOD cl_gui_frontend_services=>gui_download EXPORTING

filename = lv_filename

filetype = 'BIN'

CHANGING

data_tab = lt_jpg_content

EXCEPTIONS

file_not_found = 1

file_write_error = 2

filesize_not_allowed = 3

invalid_type = 4

no_batch = 5

gui_refuse_filetransfer = 8

OTHERS = 10.

Read only

DoanManhQuynh
Active Contributor
0 Likes
2,569

1. RAWSTRING is equal to XSTRING in abap, you dont have to convert (unless your word "rawstring" mean difference). anyway, you could find alot of convert method from class CL_BCS_CONVERT if you need to.

2. idk if there is a way to check it, maybe not since that string could be anything and dont have syntax...idk.

3. it might be related to mime_type parameter, could you set a fixed mime type (like bmp => mime type = IMAGE/BMP...) and see what happend?