Application Development 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: 

Problem with Russian characters while attaching sapscript output in a mail

0 Kudos

Hi,

I am trying to add an invoice output of sapscript as an attachment. Email with attachment is getting generated but the problem is all the russian text is showing as XXXXXXX while the english ones in the same attachment are being displayed as it is. Can some one tell me where it is going wrong? You can see the attached PDF.

So far what I have done is..

lvs_itcpo-tdgetotf = 'X'.

where  lvs_itcpo is the structure I am passing to OPTIONS parameter of OPEN_FORM.

then in close form section I am getting otf table as given below

CALL FUNCTION 'CLOSE_FORM'

    IMPORTING

      result                  = i_itcpp

    TABLES

      otfdata                  = it_otf

    EXCEPTIONS

      OTHERS = 1.

Then converting otf to xstring.

CALL FUNCTION 'CONVERT_OTF'

      EXPORTING

        format        = 'PDF'

        max_linewidth = '132'

        use_cascading = 'X'

      IMPORTING

        bin_filesize  = w_bin_filesize

        bin_file      = c_binfile

      TABLES

        otf          = it_otf

        lines        = it_pdf_temp.

Now for sending mail

  w_body_msg = ' '.

  APPEND w_body_msg TO i_body_msg.

  CLEAR w_body_msg.

  DATA: g_tab_lines TYPE i.

  "Write Packing List for Body

  DESCRIBE TABLE i_body_msg LINES g_tab_lines.

  w_packing_list-head_start = 1.

  w_packing_list-head_num = 0.

  w_packing_list-body_start = 1.

  w_packing_list-body_num = g_tab_lines.

  w_packing_list-doc_type = 'RAW'.

  APPEND w_packing_list TO i_packing_list.

  CLEAR w_packing_list.

  DATA: v_lines_bin TYPE i.

  "Write Packing List for Attachment

  w_packing_list-transf_bin = 'X'.

  w_packing_list-head_start = 1.

  w_packing_list-head_num = 0."1.

  w_packing_list-body_start = 1.

*  DESCRIBE TABLE i_objbin LINES v_lines_bin.

  DESCRIBE TABLE it_solix LINES v_lines_bin.

*  READ TABLE i_objbin INDEX v_lines_bin.

  READ TABLE it_solix INDEX v_lines_bin.

  w_packing_list-doc_type = 'PDF'.

  w_packing_list-obj_descr = 'PDF Attachment'.

  w_packing_list-obj_name = 'PDF_ATTACHMENT'.

  w_packing_list-doc_size = v_lines_bin * 255.

  w_packing_list-body_num = v_lines_bin.

  APPEND w_packing_list TO i_packing_list.

  CLEAR w_packing_list.

  "Fill the document data and get size of attachment

  READ TABLE it_pdf_temp INTO w_pdf INDEX g_tab_lines.

  w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_pdf ).

  "Receivers List.

  w_receivers-rec_type = 'U'."Internet address

  w_receivers-receiver = d_email.

  w_receivers-com_type = 'INT'.

*  w_receivers-notif_del = 'X'.

*  w_receivers-notif_ndel = 'X'.

  APPEND w_receivers TO i_receivers .

  CLEAR:w_receivers.

  "Function module to send mail to Recipients

  DATA: g_sent_to_all TYPE sonv-flag.

  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

      document_data              = w_document_data

      put_in_outbox              = 'X'

      commit_work                = 'X'

    IMPORTING

      sent_to_all                = g_sent_to_all

    TABLES

      packing_list              = i_packing_list

*      contents_bin              = i_objbin

      contents_hex              = it_solix

      contents_txt              = i_body_msg

      receivers                  = i_receivers

    EXCEPTIONS

      too_many_receivers        = 1

      document_not_sent          = 2

      document_type_not_exist    = 3

      operation_no_authorization = 4

      parameter_error            = 5

      x_error                    = 6

      enqueue_error              = 7

      OTHERS                    = 8.

7 REPLIES 7

0 Kudos

Just noticed one thing. I opened the PDF attachment and saved it as HTML doc. Now the Russian characters are visible. I suppose the problem is with the PDF conversion right?

0 Kudos

Hi,

could you please attach an example PDF?

Maybe this is helpful:

Best regards,

Andreas

0 Kudos

HI Andreas,

Thanks for your reply.The problem was mostly solved by using  CONVERT_OTF_2_PDF instead of  CONVERT_OTF.

But two of special characters in Russian is still showing as #.

The Russian characters are "«" and "»". Any clue on that?

0 Kudos

Hi Coder X,

Sorry for not being clear. My sapscript output is fine, as I can see in the print preview. The question of special character comes only in case PDF conversion. I have tried using the function module  SX_OBJECT_CONVERT_OTF_PDF but # still appears in place of special characters.

0 Kudos

Can you share the PDF file here? Since you mentioned that the preview looks good, I think the problem could be because of your Adobe Reader missing some fonts.

peng_wen
Employee
Employee
0 Kudos

Hello,

You have to ensure the correct device type is being used, refer to note 2039553 and see if it helps.

Regards,
Wen Peng