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

Problem with Mail-Attachments in an Unicode-Systems

Former Member
0 Likes
695

Hi everybody,

we have a problem mailing a attachment by using the class CL_DOCUMENT_BCS in a Unicode system, WAS 7.0

We attach a textfile using the method

    CALL METHOD lr_document->add_attachment
        EXPORTING
          i_attachment_type    = lv_extension
          i_attachment_subject = lv_dateiname
          i_att_content_text   = oti_object.

The mail should have a TXT-file in ASCII.

With NOTEPAD, the attachment looks fine.

However with WORDPAD and other applications, all german characters are two bytes, so it seems to be in a UTF-8 format.

Is it possible to say the class, that the attachment should be ASCII?

Regards,

Stefan

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
548

Hi,

Try to use


  try.
      a_sofm_document = cl_document_bcs=>create_from_text(
                   i_text = text
                i_subject = subject ).
    catch cx_bcs into bcs_exception.
      error_handling
      'cl_document_bcs=>create_from_text' bcs_exception->error_type.
  endtry.

** attachment
  if w_att = 'X'.
     try.
        call method a_sofm_document->add_attachment(
                  i_attachment_type = 'RAW'
                  i_attachment_subject = 'My attachment'
                  i_attachment_size = '21'
                  i_att_content_text = text ).
      catch cx_bcs into bcs_exception.
        error_handling 'a_sofm_document->add_attachment'
                                      bcs_exception->error_type.
    endtry.
  endif.

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
549

Hi,

Try to use


  try.
      a_sofm_document = cl_document_bcs=>create_from_text(
                   i_text = text
                i_subject = subject ).
    catch cx_bcs into bcs_exception.
      error_handling
      'cl_document_bcs=>create_from_text' bcs_exception->error_type.
  endtry.

** attachment
  if w_att = 'X'.
     try.
        call method a_sofm_document->add_attachment(
                  i_attachment_type = 'RAW'
                  i_attachment_subject = 'My attachment'
                  i_attachment_size = '21'
                  i_att_content_text = text ).
      catch cx_bcs into bcs_exception.
        error_handling 'a_sofm_document->add_attachment'
                                      bcs_exception->error_type.
    endtry.
  endif.

Read only

0 Likes
548

Hi a®s,

thanks, but this is the way I do it.

Example:

The parameter

i_att_content_text

gets the text:
"the quick brown fox jump over the lazy dog äöüß,:/?!+*"

In the mail, the attachment has the text:
"the quick brown fox jump over the lazy dog äöüß,:/?!+*"

It seems to be UTF-8.

I guess that I have to use the class

CL_ABAP_CONV_OUT_CE

and put this to the parameter

I_ATT_CONTENT_HEX

.

Is this correct and has somebody an example of this?

Regards,

Stefan

Read only

0 Likes
548

Hi everybody,

the problem is solved by using the class CL_ABAP_CONV_OUT_CE.

Regards,

Stefan