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: 

SO_NEW_DOCUMENT_ATT_SEND_API1 sending pdf with wrong special characters

Former Member
0 Kudos

Hi Experts,

Im using the fm SO_NEW_DOCUMENT_ATT_SEND_API1 to send out a pdf (into sap office box). But when I open it

I get totally wrong special characters (Chinese for instance, and ' is replaced by #).

I have already applied the note 1430123 but it didnt resolve the issue.

Can anybody help on this?

Help will highly appreciated.

Hubert

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hey Hubert...

i had the same problem, then i changed my fm.

But take a look at your table, how is it declared?

My fault was...that i didn't know, that my table has to be from the TYPE solix when i want to send it as PDF.

DATA:  gt_pdfbin           TYPE solix_tab.

I hope it helps.

9 REPLIES 9

Former Member
0 Kudos

check the parameters

Former Member
0 Kudos

Hey Hubert...

i had the same problem, then i changed my fm.

But take a look at your table, how is it declared?

My fault was...that i didn't know, that my table has to be from the TYPE solix when i want to send it as PDF.

DATA:  gt_pdfbin           TYPE solix_tab.

I hope it helps.

Former Member
0 Kudos

Please refer this link :

http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage

ravi_lanjewar
Contributor
0 Kudos

Fill the parameter SOPCKLSTI1-TRANSF_BIN= 'X' of PAKINGLIST.

For more details check the function module documentation where given the example with attachment.

It will help you.

0 Kudos

The above mentioned solution didnt resolve the issue but thanks for your help.

I think we will have to go another fm as this one in obsolote.

0 Kudos

I think using class CL_BCS would make things simpler.

http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage#SendingMails-HomePage-CLBCS

0 Kudos

But I need to send a message to SBWP with an pdf attachment. Is is possible with CL_BCS ?

0 Kudos

Yes. This is very much possible.

gv_xstring contains the pdf data in XSTRING format.

Check the code :



*   ---------- create persistent send request ----------------------
  send_request = cl_bcs=>create_persistent( ).

*   ---------- Create document ----------------------------------------
*   get PDF xstring and convert it to BCS format
  lp_pdf_size = XSTRLEN( gv_xstring ).

  pdf_content = cl_document_bcs=>xstring_to_solix(
      ip_xstring = gv_xstring ).

*     Create Mail Body
  CLEAR ls_body.
  CONCATENATE 'Dear' gv_name1 ',' INTO ls_body SEPARATED BY space .
  APPEND ls_body TO lt_body.

  CLEAR ls_body.
  APPEND ls_body TO lt_body.

  CLEAR ls_body.
  ls_body = 'Warm greetings '.
  APPEND ls_body TO lt_body.

  CLEAR ls_body.
  ls_body = 'Manager'.
  APPEND ls_body TO lt_body.

  document = cl_document_bcs=>create_document(
                  i_type    = 'RAW'
                  i_text    = lt_body
*                  i_length  = '12'
                  i_subject = 'Letter' ).

**   Add Attachment to send request
  CALL METHOD document->add_attachment
    EXPORTING
      i_attachment_type    = 'PDF'
      i_attachment_subject = 'Letter'
      i_att_content_hex    = pdf_content.

*     add document to send request
  CALL METHOD send_request->set_document( document ).

*   ---------- add recipient (e-mail address) ----------------------
  IF gv_adrnr IS INITIAL.
    SELECT SINGLE adrnr
      FROM kna1
      INTO gv_adrnr
     WHERE kunnr EQ gv_kunrg.
  ENDIF.

  SELECT SINGLE smtp_addr
    INTO lv_email
    FROM adr6
   WHERE addrnumber EQ gv_adrnr.

  recipient = cl_cam_address_bcs=>create_internet_address(
      i_address_string = lv_email ).

*   add recipient to send request
  send_request->add_recipient( i_recipient = recipient ).

*   ---------- send document ---------------------------------------
  sent_to_all = send_request->send(
      i_with_error_screen = 'X' ).

  IF sent_to_all = 'X'.
*    MESSAGE i022(so).
    gv_emailflag = 'X'.
  ENDIF.

*   ---------- explicit 'commit work' is mandatory! ----------------
  COMMIT WORK.

0 Kudos

thanks!

but above you use e-mail and I need system user name so that the message will go to SBWP.