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

Picture to binary

Former Member
0 Likes
1,078

Hi,

How I get the binary text of an picture?

I want to transfer it in a xml file

Regards,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,024

Hi

Check the Tcode

SMW0

to convert to Binary

Reward points for useful Answers

Regards

Anji

6 REPLIES 6
Read only

Former Member
0 Likes
1,025

Hi

Check the Tcode

SMW0

to convert to Binary

Reward points for useful Answers

Regards

Anji

Read only

rodrigo_paisante3
Active Contributor
0 Likes
1,024

Helo Darley...

How are you??

Did you try to use the command open dataset? It has a property binary mode.

Try this and let me know what happened.

Regards

Mineiro

Read only

0 Likes
1,024

Good idea Mineiro,

I got de bytes of a image with GUI_UPLOAD function.

but i want send this image in a xml message.

According with w3c, this images must be in a base 64 encoded image.

Read only

0 Likes
1,024

XML?

I am trying to do this but the code not works in my minisap.

see my opened question

maybe this help you, and if you know other way to manipulate xml, please answer my question too.

Regards

Mineiro

Read only

0 Likes
1,024

Solved

TYPES: BEGIN OF y_byte,
         byte(65534) TYPE x,
       END OF y_byte.

DATA: o_encryptor     TYPE REF TO cl_hard_wired_encryptor,
      t_bytes         TYPE TABLE OF y_byte,
      wa_byte         LIKE LINE OF t_bytes,
      v_byte_array    TYPE xstring,
      v_encoded_bytes TYPE string.

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename = 'C:Sunset.jpg'
    filetype = 'BIN'
  TABLES
    data_tab = t_bytes.

CREATE OBJECT o_encryptor.

LOOP AT t_bytes INTO wa_byte.
  CONCATENATE v_byte_array wa_byte-byte INTO v_byte_array IN BYTE MODE.
ENDLOOP.

v_encoded_bytes = o_encryptor->base64_encode( v_byte_array ).

Read only

0 Likes
1,024

the steps you would need.

1. gui_upload with 'BIN' as file type which would result in a image content in Binary table.

2. use FM SCMS_BINARY_TO_STRING to convert this binary to string

3. use CL_HTTP_UTILITY=>IF_HTTP_UTILITY~ENCODE_BASE64 method to encode the string to base64.

4. now you can use this string to set it in XML