09-30-2010 8:45 AM
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
09-30-2010 10:45 AM
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.
09-30-2010 8:55 AM
09-30-2010 10:45 AM
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.
09-30-2010 11:13 AM
Please refer this link :
http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage
09-30-2010 11:18 AM
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.
09-30-2010 1:00 PM
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.
09-30-2010 1:16 PM
I think using class CL_BCS would make things simpler.
http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage#SendingMails-HomePage-CLBCS
09-30-2010 1:18 PM
But I need to send a message to SBWP with an pdf attachment. Is is possible with CL_BCS ?
09-30-2010 1:29 PM
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.
09-30-2010 1:47 PM
thanks!
but above you use e-mail and I need system user name so that the message will go to SBWP.