Skip to Content
0
Aug 11, 2015 at 02:14 PM

SE78 color bitmap image stored as text to BASE64 string

421 Views

Hi,

I found a lot of information in similar discussions but I still didn't manage to solve my scenario, I hope you can help.

I want to get a color bitmap image stored as text in SE78 and convert it to a base64 string (to embed it in HTML).

I know how to read the image data with just READ_TEXT function. It retrieves a text table including comments but I don't know how is this formatted. So debugging SE78 preview function I found out that after reading the text it executes the following function to transform the ITF text image to BMP and store it in lt_image_binary table:

CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP'
EXPORTING
ITF_HEADER = lv_header
OLD_FORMAT = 'ITF'
NEW_FORMAT = 'BMP'
TABLES
ITF_LINES = lt_image_itf
bitmap_file = lt_image_binary
EXCEPTIONS
OTHERS = 1.


I tried to then to transform the binary table to string with SCMS_BINARY_TO_STRING but it is not working... I wanted to do that and then maybe use cl_http_utility, encode_base64 method to achieve my goal. But I'm doing something wrong and I'm not sure what yet.


Could you help me please? Thank you in advance.