Send PO Mail with PDF File that Chinese character doestn't display correctl
Send PO Mail with PDF File that Chinese character doestn't display !
I am using RSTXPDFT4 , tried different computer, some Adobe Reader can read
some are Blank .......
why ?
Hi,
那不是要每一台 PC 如果看不到中文就要更新 ?
如果用戶不懂, 那就不是永遠看不見 ? 因為那是供應商嗎 !
Similar Messages
-
Send PO Mail with PDF File that Chinese character doestn't display
Send PO Mail with PDF File that Chinese character doestn't display.
I am using RSTXPDFT4, unicode ECC6.0
Some computer Adobe Reader can read the file, but some computer cannot read, just a blank page.
Thanks.Hi
I worked for one client-chinese where we have to print chinese & english ( bilingual).You need to have dricer program which could identify both scripts .You are right ( unicode0
Please check for the driver program : TWPDF : PDF converter Chinese in SPAD setting.
SAP note is available.I will check and let you update .
Edited by: sunny on Oct 28, 2009 10:29 AM -
Problem when trying to send a mail with pdf file attached
When I use this features from Adobe reader, a new mail is opened with pdf file but my Outlook signature is not set automatically. Note that all is right configure in Outlook 2007 for the signature option...
Do you have a solution for this problem ?someone else reported this (unless it was you) You'll have to insert your sig manually.
-
Issue regarding sending E-Mail with PDF file(s) as attachment
Hi,
Can anybody provide me with code to send PDF file as E-Mail Attachment!
I know we have to use F.M <b>SO_NEW_DOCUMENT_ATT_SEND_API1</b> but how we have to use it to send PDF file as attachment!
I was able to send Text files as Attachments in my previous assignments.
Thanks in advance.
Thanks & Regards,
Kumar.Hi,
Check this threads:
SO_NEW_DOCUMENT_ATT_SEND_API1
unable to e-mail a pdf through FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'
SO_NEW_DOCUMENT_ATT_SEND_API1
Best regards,
Guillaume
Message was edited by: Guillaume Garcia -
How to send a mail with PDF attachment
Hello
Good Day!
We have a requirement to send the mail with pdf attachment. Pdf file will be remain same for all mails and it will be placed at server. We are on R12.4 and below is the database information :
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Thanks a ton for your anticipated help!
Thanks
GauravThe word URGENT is considered as rude in this forum.. Nobody here is getting paid for the ansers they are giving..
Just have a look at These threads.Those will help you. -
Send a mail with attached file .xls but i got file without
i tried to send a mail with attached file .xls. but i am able to send the file , we recived the file without file name. please do the same
thnaks in advance.
END-OF-SELECTION.
Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
'Example .xls documnet attachment'
'XLS'
'filename'
CHANGING GD_ERROR
GD_RECIEVER.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM DATA_RETRIEVAL.
SELECT EBELN EBELP AEDAT MATNR
UP TO 10 ROWS
FROM EKPO
INTO TABLE IT_EKPO.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM BUILD_XLS_DATA_TABLE.
CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
CON_TAB TYPE X VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO IT_ATTACH SEPARATED BY ''.
CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
LOOP AT IT_EKPO INTO WA_CHAREKPO.
CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
INTO IT_ATTACH SEPARATED BY ''.
CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = PIT_ATTACH[].
Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_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.
Populate zerror return code
LD_ERROR = SY-SUBRC.
Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
FORM POPULATE_EMAIL_MESSAGE_BODY.
REFRESH IT_MESSAGE.
IT_MESSAGE = 'Please find attached a list test ekpo records'.
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODYPERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
'Failed IDOC Analysis report'(020)
'xls'(021)
'IDOC_REP'(022)
CHANGING GD_ERROR
GD_RECIEVER.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
ENDFORM. " F_MAIL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM BUILD_XLS_DATA_TABLE.
*CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
*CON_TAB TYPE X VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE text-040 text-041 text-042 text-043 text-044 text-045 text-046 text-047 text-048 text-049
INTO IT_ATTACH SEPARATED BY con_tab.
CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
clear IT_ATTACH.
loop at i_final_t into w_final.
CONCATENATE
w_final-mestyp w_final-docnum w_final-statxt w_final-msgno w_final-rvplant w_final-kunnr w_final-vbeln w_final-credat
w_final-cretim w_final-flag INTO IT_ATTACH SEPARATED BY con_tab.
CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
clear IT_attach.
endloop.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = PIT_ATTACH[].
Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_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.
Populate zerror return code
LD_ERROR = SY-SUBRC.
Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM. "SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
FORM POPULATE_EMAIL_MESSAGE_BODY.
data: l1(99) type c,
l2(15) type c,
lt_message type standard table of solisti1,
ls_message like line of lt_message.
clear ls_message.
l1 = 'Dear'(007).
l2 = 'Sir/Madam'(008).
concatenate l1 l2 ',' into
ls_message-line separated by space.
append ls_message to lt_message.
*insert Blank Line
clear ls_message.
ls_message-line = space.
append ls_message to lt_message.
*Assign Message text
clear ls_message.
concatenate text-011
text-012
into ls_message-line separated by space.
append ls_message to lt_message.
*insert Blank Line
clear ls_message.
ls_message-line = space.
append ls_message to lt_message.
*Assign Message text
clear ls_message.
concatenate text-013
text-014
text-015
into ls_message-line separated by space.
append ls_message to lt_message.
concatenate text-016
text-017
into ls_message-line separated by space.
append ls_message to lt_message.
*insert Blank Line
clear ls_message.
ls_message-line = space.
append ls_message to lt_message.
ls_message-line = text-018.
append ls_message to lt_message.
ls_message-line = text-019.
append ls_message to lt_message.
clear: ls_message.
REFRESH IT_MESSAGE.
it_message[] = lt_message[].
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY -
How to send the mail with multiple file attachments ?
Sending mails with multiple files as attachments.
You need to start from the app, assuming that it has an email function, that contains the files that you want to send as attachments. The Photos app allows you to send up to 5 photos on the same email, but if you want to send multiple file types then you need an app that supports all those file types. I use the GoodReader app which supports quite a few document/file types (e.g. PDF, Excel, Word, pictures), and from that I can select multiple files (including different types) and attach them to the same email.
-
Sending mail with PDF file attachment ?
Hi All,
I have scenario File ---> Mail, monitoring FTP directory for PDF file and sending using mail attachment.
At the moment i am using JAVA mapping to construct the mail package structure follow all the step in this blog : XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
it is working if i am using text file but then how to encode the pdf content so i can send throught the mail adapter. ?
Thank you and Best Regards
FernandHi,
Actually, i am using this java code below :
try {
// create XML structure of mail package
String output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<ns:Mail xmlns:ns=\"http://sap.com/xi/XI/Mail/30\">"
+ "<Subject>" + mailSubject + "</Subject>"
+ "<From>" + mailSender + "</From>"
+ "<To>" + mailReceiver + "</To>"
+ "<Content_Type>multipart/mixed; boundary=\"" + boundary + "\"</Content_Type>"
+ "<Content>";
out.write(output.getBytes());
// create the declaration of the MIME parts
//First part
output = "--" + boundary + CRLF
+ "Content-Type: text/plain; charset=UTF-8" + CRLF
//+ "Content-Transfer-Encoding: 8bit" + CRLF
+ "Content-Disposition: inline" + CRLF + CRLF
+ mailContent + CRLF
//Second part
+ "--" + boundary + CRLF
+ "Content-Type: Application/pdf; name=" + attachmentName + CRLF
//+ "Content-Transfer-Encoding: base64" + CRLF
+ "Content-Disposition: attachment; filename=" + attachmentName + CRLF + CRLF;
out.write(output.getBytes());
//Source is taken as attachment
copySource(in, out);
out.write("</Content></ns:Mail>".getBytes());
} catch (IOException e) {
throw new StreamTransformationException(e.getMessage());
protected static void copySource(InputStream in, OutputStream out)
throws IOException {
byte[] bbuf = new byte[in.available()];
int bblen = in.read(bbuf);
if (!(bblen < 0)) {
//String sbuf = new String(bbuf);
//String encoded = Base64.encode(sbuf);
// replace all control characters with escape sequences
//sbuf = sbuf.replaceAll("&", "&");
//sbuf = sbuf.replaceAll("\"", """);
//sbuf = sbuf.replaceAll("'", "'");
//sbuf = sbuf.replaceAll("<", "<");
//sbuf = sbuf.replaceAll(">", ">");
out.write(bbuf);
This code working fine with text file but not for pdf file. because i got error in mail adapter :
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: com.sap.aii.messaging.util.XMLScanException: java.lang.NullPointerException; nested exception caused by: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 8f(:main:, row:11, col:4)(:main:, row=11, col=4) -> com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 8f(:main:, row:11, col:4)
I guest the problem because the mail adapter doen't accept pdf content insite the mail package.
please advise me
Best Regards
Fernand -
Error while sending a mail with pdf attachment
Hai
I am sending mail with an attachment of PDF document. While sending I am getting
javax.activation.UnsupportedDataTypeException: application/pdf
This is my code
public static void setByteArrayAsAttachment(Message msg, byte[] attach)
throws MessagingException {
MimeBodyPart p1 = new MimeBodyPart();
ByteArrayDataSource byteStr = new ByteArrayDataSource(attach,"application/pdf");
p1.setContent(byteStr,"application/pdf");
Multipart mp = new MimeMultipart();
mp.addBodyPart(p1);
msg.setContent(mp);
Can one one help me on this...
Thanks
Jithesh PMChange
p1.setContent(byteStr,"application/pdf");
to
p1.setDataHandler(new DataHandler(byteStr)); -
Send e-mail with a file as attachment - Break line problems
Hi
I use the function SO_NEW_DOCUMENT_ATT_SEND_API1 to send an e-mail from ABAP program.
With SAP4.5B, all work good, but since we have 4.6C, the attached file is malformatted.
An automatic CRLF break line is generated all 1022 char!
The eattachment is create from content of internal table with a line of 255 char.
How can I avoid the automatic CRLF char or how can I to send a good file ?
ThankHi,
look here:
Re: How to email an attachment with more than 255 characters?
Andreas -
Send a mail with ppt file as an attachment
Hello,
I need to send an email which has a PPT file as an attachment. The file is on the hard drive of computer. I tried SO_DOCUMENT_REPOSITORY_MANAGER FM. It is asking for a dialog box but I need to design a scheduler which will send this email. Can you suggest any solution(which does not ask for a dialog box)?
Thanks,
Deepti.Hi ,
If your requirement is to send email with attachment by selecting the attachment file from your local hardisk and execute.
and Next, specify the sender email address you can use the following code.
report zmail.
data method1 like sy-ucomm.
data g_user like soudnamei1.
data g_user_data like soudatai1.
data g_owner like soud-usrnam.
data g_receipients like soos1 occurs 0 with header line.
data g_document like sood4 .
data g_header like sood2.
data g_folmam like sofm2.
data g_objcnt like soli occurs 0 with header line.
data g_objhead like soli occurs 0 with header line.
data g_objpara like selc occurs 0 with header line.
data g_objparb like soop1 occurs 0 with header line.
data g_attachments like sood5 occurs 0 with header line.
data g_references like soxrl occurs 0 with header line.
data g_authority like sofa-usracc.
data g_ref_document like sood4.
data g_new_parent like soodk.
data: begin of g_files occurs 10 ,
text(4096) type c,
end of g_files.
data : fold_number(12) type c,
fold_yr(2) type c,
fold_type(3) type c.
parameters ws_file(4096) type c default 'c:\debugger.txt'.
Can me any file fromyour pc ....either xls or word or ppt etc ...
g_user-sapname = sy-uname.
call function 'SO_USER_READ_API1'
exporting
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
importing
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_ERROR = 3
OTHERS = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
clear g_files.
refresh : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
*g_document-OBJYR = '27'.
*g_document-OBJNO = '000000002365'.
*g_document-OBJNAM = 'MESSAGE'.
g_document-objdes = 'sap-img.com testing by program'.
g_document-folrg = 'O'.
*g_document-okcode = 'CHNG'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'sap-img.com testing by program'.
g_header-file_ext = 'TXT'.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
append g_files.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
append g_receipients.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header.
*-- End of Program -
How to send e-mail with attach file from a stated directory?
I can only put the file in the program's same directory for attachment, how to state the file path for the file attachment?
Hi..
The FileDataSource class has two contructors.
FileDataSource(java.io.File file)
Creates a FileDataSource from a File object.
FileDataSource(java.lang.String name)
Creates a FileDataSource from the specified path name.
Using either of them we can select the file in anypath of your system i.e. server.
If you need relative path then you have to use File object.
Cheers. -
Convert Screen(spool) to PDF file sending mail with attach file
Hi :
I'd like convert spool list to pdf and sending file...
so, I read thread about spool convert to PDF before,
and know how to convert Spool to PDF file and send mail with attach file.
but I have a problem.
my solution as:
step 1. Call function: "CONVERT_ABAPSPOOLJOB_2_PDF"
step 2. Call function: "SO_NEW_DOCUMENT_ATT_SEND_API1"
then, I got a mail with attached PDF file, but the PDF file display limited 255 line.( SO_NEW_DOCUMENT_ATT_SEND_API1 limited)
I want to showing word is wider that 255.
and then I find a manual method as:
After program finished.
Function Menu -> system -> List -> Send
use Prog: "Create Document and Send"
I use this prog sending mail and attached file ,
PDF file do <b>NOT</b> have 255 word limit !
finally. my question is, If I want sending mail as Prog: "Create Document and Send", how to do?
which Function I have to use?...
Please help me, Thanks!Hi,
Check this sample code of sending spool as attachment to an email address..
Parameters.
PARAMETERS: p_email(50) LOWER CASE.
PARAMETERS: p_spool LIKE tsp01-rqident.
Data declarations.
DATA: plist LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: document_data LIKE sodocchgi1.
DATA: so_ali LIKE soli OCCURS 100 WITH HEADER LINE.
DATA: real_type LIKE soodk-objtp.
DATA: sp_lang LIKE tst01-dlang.
DATA: line_size TYPE i VALUE 255.
DATA: v_name LIKE soextreci1-receiver.
DATA rec_tab LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
Get the spool data.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = p_spool
first_line = 1
last_line = 0
desired_type = ' '
IMPORTING
real_type = real_type
sp_lang = sp_lang
TABLES
buffer = so_ali
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'Error'.
LEAVE LIST-PROCESSING.
ENDIF.
Prepare the data.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 0.
plist-body_num = 0.
plist-doc_type = 'RAW'.
plist-obj_descr = 'Test ALV'.
APPEND plist.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
DESCRIBE TABLE so_ali LINES plist-body_num.
plist-doc_type = real_type.
Get the size.
READ TABLE so_ali INDEX plist-body_num.
plist-doc_size = ( plist-body_num - 1 ) * line_size
+ STRLEN( so_ali ).
APPEND plist.
Move the receiver address.
MOVE: p_email TO rec_tab-receiver,
'U' TO rec_tab-rec_type.
APPEND rec_tab.
IF NOT sp_lang IS INITIAL.
document_data-obj_langu = sp_lang.
ELSE.
document_data-obj_langu = sy-langu.
ENDIF.
v_name = sy-uname.
Send the email.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
sender_address = v_name
sender_address_type = 'B'
TABLES
packing_list = plist
contents_bin = so_ali
receivers = rec_tab
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.
IF sy-subrc <> 0.
MESSAGE e208(00) WITH 'Error'.
ENDIF.
COMMIT WORK.
Send the email immediately.
SUBMIT rsconn01
WITH mode = 'INT'
AND RETURN.
Thanks,
Naren -
We want to send a mail with attachment pdf file.
Hi!!!
We want to send a mail with attachment pdf file.
The PDF file this is in the server sap.Hi,
Pls check web logs like
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
Eddy
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d! -
Procedure or Function that send E-mail with image background and file attached
hi
I4d like know if someone there is a procedure or function that send E-mail with image background and file attached, for me.
thanks
Josi VieiraIf you go to this part of OTN you will find the official Oracle UTL_SMTP demo, which includes attachments:
http://technet.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
Getting a background is slightly trickier. The UTL_SMTP package is for primarily sending text e-mails, whereas images require HTML e-mail. I suggest you look at the structure of a sample HTML e-mail and see if you can write the necessary HTML strings in the DATA parameter. Otherwise you'll need to investigate handcrafting a program based on the UTL_TCP package.
[rant]
If this seems like a lot of trouble I agree and urge you not to bother. HTML e-mail is one of the curses of the modern age, not least because it is frequently used by purveyors of viruses. I have a filter on my Outlook client that strips out all the HTML in any e-mail I receive, which means I get lots of e-mails rendered unreadable by the inclusion of <HTML> tags. But who cares, they're mostly spam anyway. In fact, the use of HTML in an e-mail is almost always an indicator of the irrelevance of its content.
[rant]
Vibes, APC
Maybe you are looking for
-
TS4002 How can I change iCloud junk mail settings from my iPhone?
I have junk mail filtering turned on in iCloud. If it incorrectly tags mail as junk it is easy to correct using the web interface but there doesn't seem to be a way to do it from iPhone. How can you mark mail as junk / not junk from iOS? Matters are
-
Email Bursting subject have to modify instead of Warning
Dear All, We are using email bursting option to send pdf statement to our investors, with password protected. Email and encryption options are works well. Problem is subject line received by the investor's is [WARNING : MESSAGE ENCRYPTED] FW: [WARNI
-
I installed 1.4.2_01 and my guis break
Hello, I hope somebody can help me with this. I have been happily running j2sdk 1.4.1 on a winxp pro machine. A while ago I tried to install 1.4.2. The install seemed to go fine, but when I ran some simple gui apps, there was some very strange graphi
-
I want is that I get user name!
Hi, Below are my two annotated classes, namely, Requisition and User, that represent two tables requisitions and users. What I want is that I get to get username from users table in my requisition query instead of user id which is stored in the requi
-
MV50AFZ1 - Change Accounting Document During PGI
Using MV50AFZ1 User - Exit ,can i change accounting document during PGI.I want to change the Business Area. If not ,please tell me which User Exit can help me in this. Thanx, Viru