Skip to Content
0
Former Member
Aug 25, 2016 at 05:43 PM

Display PNG image loaded from memory in classic dynpro

1030 Views

Hi everyone:

I'm following the tutorial How to create a QR code and show it in a Smartform. Unfortunately when I try to convert the PNG image to BMP using the method i_igs_image_converter->execute i get a sy-subrc = 1 (communication error) error. According to the comments and this post seems that the issue solves installing SAP ERP 6 release 731 and apply OSS note 2042588. Unfortunately at this time, the company I'm working for is unable to install SAP enhancements and OSS notes. At this moment I confirmed that I can load the image and save it in a XString variable, According to the code the method convert_image only converts the QRcode to bitmap in order to display the result. Is there another way to display the PNG image without the need to convert to bitmap image?, in case that no, IS there a way to avoid using i_igs_image_converter class and load the image directly in a custom control?

The code involved is the following:

FORM convert_image .

CREATE OBJECT i_igs_image_converter .

i_igs_image_converter->input = 'image/png'.
i_igs_image_converter->output = 'image/x-ms-bmp'.
i_igs_image_converter->width = width.
i_igs_image_converter->height = height.

CALL METHOD i_igs_image_converter->set_image
EXPORTING
blob = mime
blob_size = l_content_length.

CALL METHOD i_igs_image_converter->execute
EXCEPTIONS
communication_error = 1
internal_error = 2
external_error = 3
OTHERS = 4.

IF sy-subrc = 0.

CALL METHOD i_igs_image_converter->get_image
IMPORTING
blob = blob
blob_size = blob_size
blob_type = blob_type.
ELSE.
DATA:
errnum TYPE i,
errmsg TYPE string.

i_igs_image_converter->get_error(
IMPORTING message = errmsg
number = errnum
).
ENDIF.

IF sy-subrc = 0.
IF p_rad1 = 'X'.
CALL SCREEN '9000'. "Calling the screen for qrcode display
ELSE.
PERFORM show_smart_form. "calling the smartform for qrcode display
ENDIF.
ENDIF.
ENDFORM. " CONVERT_IM

Thanks in advance for your help. Best regards