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

Convert Excel to Binary

Former Member
0 Likes
4,008

Dear All,

Has anyone experience convert excel to binary ?

For example, I have an excel file in my PC then I would like to set it as attachment in mail using CL_DOCUMENT_BCS. Attachment in this class only have two version, as text or as hexadecimal.

In order to create hexadecimal content I need a binary format, i will use function SCMS_BINARY_TO_XSTRING.

The problem is, how to convert excel to binary format.

Thanks in advance.

Rgds,

Deny

6 REPLIES 6
Read only

Former Member
0 Likes
2,176

Hi,

You can upload the excel file in binary. This can be specified in the upload FM GUI_UPLOAD.

Hope this helps.

Read only

0 Likes
2,176

Hi Siva,

I tried using FM GUI_UPLOAD, but the excel file contains jibberish character.

Rgds,

Deny

Read only

0 Likes
2,176

Hi,

The other way is to have a input file which is tab delimited. If the file is tabdelimited, then you can skip the binary conversion

Read only

0 Likes
2,176

I want to keep format also. Example Font Size, Color and Border line into binary format. Simple analog My Excel template will be convert into binary and could be open on attachment.

Deny

Read only

Former Member
0 Likes
2,176

hi....

when you are uploading using gui_upload just check your filetype....

for binary....the file type is diffenrent....e.g for text file it is 'DAT' and for excel its is 'ASC'..so just check....

may be thats the reason you are getting sone jibberish characters...

Read only

athavanraja
Active Contributor
0 Likes
2,176

code snippet .


data: xml_tab1 type solix_tab .

 call function 'GUI_UPLOAD'
    exporting
      filename            = filename
      filetype            = 'BIN'
      has_field_separator = ' '
      header_length       = 0
    importing
      filelength          = size
    tables
      data_tab            = xml_tab1
    exceptions
      others              = 1.

 call method document->add_attachment
            exporting
              i_attachment_type    = 'XLS'
              i_attachment_subject = atta_sub
              i_att_content_hex    = xml_tab1.