How to send incoming XML as mail-attachment
Hi Experts,
I have the following scenario: an incoming XML-file should be send as attachment of a mail. Now, I have defined incoming message with the structure of the xml-message and outgoing message as mail-package. In the message mapping I fill the nessesary mail-fields. In my receiver comm.channel (mailadapter) I checked "Use mail package" and "Keep attachment".
Result is that the mail is created and send ok, but without attachment....what am I doing wrong here?
Regards,
William
Hi JWD,
You should configure the mail adapter with 'use the mail adpater' and 'keep attachments'.
Create an XML file conform the XML structure provide by SAP
The mail package should look like this:
<?xml version="1.0" encoding="utf-8"?>
<ns:MT_Mail_Sent xmlns:xi="http://sap.com/xi/XI/Mail/30">
<xi:Mail>
<Subject>Item</Subject>
<From>MAIL ADDRESS</From>
<To>MAIL ADRESS</To>
<Content_Type>multipart/mixed; boundary="AaBb--984dfgeSSd3532"</Content_Type>
<Content_Disposition>attachment</Content_Disposition>
<Content>
AaBb984dfgeSSd3532
Content-Type: text/plain
this is sample data.
AaBb984dfgeSSd3532
Content-Type: text/plain;name="CSV_data.csv"
Order number;Item number;description<xsl:text> </xsl:text>
<xsl:for-each select="Article_line">
<xsl:value-of select="Ord_nmbr"/>;<xsl:value-of select="Item_nmbr"/>;<xsl:value-of select="Description<xsl:text>
</xsl:text></xsl:for-each>
AaBb984dfgeSSd3532
Content-Type: text/plain;name="TXT_data.txt"
Order number;Item number;description<xsl:text> </xsl:text>
<xsl:for-each select="Article_line">
<xsl:value-of select="Ord_nmbr"/>;<xsl:value-of select="Item_nmbr"/>;<xsl:value-of select="Description<xsl:text> </xsl:text></xsl:for-each>
AaBb984dfgeSSd3532
</Content>
</xi:Mail>
</ns:MT_Mail_Sent>
In the above example you should have some content and 2 attachments (1 csv file and 1 txt file).
After each break (AaBb984dfgeSSd3532) specify again the 'Content-Type'.
*When you want to send a message payload as described, you have to set in the mail receiver channel the parameter Content Encoding to None and uncheck Keep Attachments.
The last boundary AaBb984dfgeSSd3532 should be omitted, as the mail adapter sets that border itself (tested with SP16)*
Reward points if this helps
Regards
Pragathi.
Similar Messages
-
How to send table contents as mail attachment.
Hi,
I am showing data into webdynpro table by accessing database. Now i have to send these data through mail to different persons. How can i do it. I tried it by sending the table elements into excel files but i am facing some problems. can it be done through HTML files??
Please give a solution to it.
Thanks and Regards..
Pankaj Kumar.Pankaj
I am giving sample code here.
Put this code in an action behind Send Mail button on your iview as an example.
Also add external jar file mail.jar to your web dynpro project to achieve your objective.
if(wdContext.currentContextElement().getTest()== null)
IWDWindowInfo windowInfo1 = wdComponentAPI.getComponentInfo().findInWindows("EnterText");
IWDWindow window1 =wdComponentAPI.getWindowManager().createWindow(windowInfo1,true);
window1.open();
window1.setWindowPosition(300,300);
wdContext.currentContextElement().setEmptyText(window1);
} else
Properties props = new Properties();
String host = "XXX.XXX.X.X"; /*ip address of mail server */
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", "25");
props.put("mail.smtp.auth","false");
// auth = new AuthenticationBean();
Session session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage (
Session.getInstance ( props, null ) );
Address toAddress = new InternetAddress();
Address fromAddress = new InternetAddress();
Address ccAddress = new InternetAddress();
Address bccAddress = new InternetAddress();
//new window code
IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("SuccessWindow");
IWDWindow window =wdComponentAPI.getWindowManager().createWindow(windowInfo,true);
window.open();
window.setWindowPosition(300,300);
wdContext.currentContextElement().setSuccess(window);
try
MimeMultipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
fromAddress = new InternetAddress(wdContext.currentContextElement().getFromEmail());
message.setFrom(fromAddress);
toAddress = new InternetAddress(wdContext.currentContextElement().getRfcEmail());
wdContext.currentContextElement().setErr(wdContext.currentContextElement().getRfcEmail());
message.setRecipient(Message.RecipientType.TO, toAddress);
message.setSubject(wdContext.currentContextElement().getMycontactDD());
messageBodyPart.setText("Message From :"" " wdThis.wdGetMailAppController().wdGetContext().currentContextElement().getName()"\r\n""\r\n"+wdContext.currentContextElement().getTest());
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
Transport.send(message);
catch (AddressException e)
wdComponentAPI.getMessageManager().reportWarning(e. getLocalizedMessage());
e.printStackTrace();
catch (SendFailedException e)
wdComponentAPI.getMessageManager().reportWarning(e. getLocalizedMessage());
e.printStackTrace();
catch (MessagingException e)
wdComponentAPI.getMessageManager().reportWarning( e.getLocalizedMessage());
e.printStackTrace();
Please award points if this helps as this will give you a hint for sending mails. -
How to send image file through mail without any attachment
Plz tell me how to send image file through mail without any attachment ( i mean not converting that image into pdf or any format ) i want to send that text or image through mail .
Hi Sandeep,
I think you can setup the type of email in Shared office Settings in transaction S016.
There is an option called <Preset document classes>
You choose this pushbutton to branch to the maintenance screen for the document classes that are directly displayed to users in the Business Workplace for selection when they use the Create function. The name under which the documents are displayed can also be maintained.
http://help.sap.com/saphelp_nw70/helpdata/en/6c/69c30f418d11d1896e0000e8322d00/content.htm
Haven't tried it though.
Regards,
Siddhesh -
How to send an email with an attachment to the customers email address.
Hi friends,
How to send an email with an attachment to the customers email address.
the attachment will be in doc format.
Having an Header
the data which i am sending must be in a TABLE format
with 5 columns.
and each column must have a column heading
Please guide me.
Thanks in Advance,
Ganesh.*& Report ZEMAIL_ATTACH *
*& Example of sending external email via SAPCONNECT *
REPORT ZEMAIL_ATTACH .
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver .
*Here get the values of mail from the table adn6 for the customer address.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
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'
'DOC'
'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 con_tab.
CONCATENATE con_cret 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 con_tab.
CONCATENATE con_cret 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_BODY
regards,
venkat. -
Very urjent how to send report output in mail
hi experts,
how to send report output in mail which function module should i use wht parameters should i pass.
thanks in addavnce,
points to be awarded.CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = '026c'
copies = count
list_name = 'VATS_ASBUILT'
list_text = v_list
immediately = 'X'
release = 'X'
new_list_id = 'X'
expiration = days
line_size = 132
line_count = 65
layout = 'X_65_132'
* sap_cover_page = 'X'
* cover_page = 'X'
receiver = 'SAP*'
department = 'VATS'
no_dialog = 'X'
IMPORTING
out_parameters = params
valid = valid.
SUBMIT zppr_vats_asbuilt WITH p_aufnr EQ v_aufnr
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS params
AND RETURN.
SELECT SINGLE rqident FROM tsp01 INTO l_spoolno
WHERE rqtitle = v_list .
* convert report to PDF format
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = l_spoolno
no_dialog = 'X'
TABLES
pdf = l_ipdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
EXIT .
ENDIF.
Now comes the part to send the mail
try.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
clear document.
* -------- create and set document with attachment ---------------
* create document from internal table with text
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = '' ).
*changing the content of the attachment
binary_content[] = l_iobjbin[].
*change the name of the PDF attachment
concatenate 'Build ID' s_buildid_i 'Rev' v_buildid_rev
into i_att_sub separated by space.
* add attachment to document
call method document->add_attachment
exporting
i_attachment_type = 'PDF'
i_attachment_subject = i_att_sub
i_att_content_hex = binary_content.
*setting the option to send an e-mail more than 50 characters
call method send_request->set_message_subject
exporting
ip_subject = t_sub.
* add document to send request
call method send_request->set_document
exporting
i_document = document.
* --------- set sender -------------------------------------------
* note: this is necessary only if you want to set the sender
* different from actual user (SY-UNAME). Otherwise sender is
* set automatically with actual user.
sender = cl_sapuser_bcs=>create( 'VATSUPPORT' ).
call method send_request->set_sender
exporting
i_sender = sender.
*Send the list based on receivers list obtained
loop at l_ireclist.
AD_SMTPADR = l_ireclist-receiver.
* --------- add recipient (e-mail address) -----------------------
* create recipient - please replace e-mail address !!!
recipient = cl_cam_address_bcs=>create_internet_address(
AD_SMTPADR ).
* add recipient with its respective attributes to send request
call method send_request->add_recipient
exporting
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
call method send_request->set_status_attributes
exporting
i_requested_status = 'E'
i_status_mail = 'E'.
* To send the mail immediately
call method send_request->set_send_immediately( 'X' ).
* ---------- send document ---------------------------------------
call method send_request->send( ).
commit work. -
How to send a file as an attachment using mailx
Hi
Can any one tel me how to send a file as an attachment using mailx command in shell script.
Thanks,
Suman.Wrong forum where to ask such questions.
Check this one link:
http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html?t=18370#post70254 -
How to send sapmails to external mail systems
Hi,
how to send sapmails to external mail systems....
like if we want to mail a purchase order from SAP System to *@yahaoo.com or @.com.
TY.hi manish,
u can do it.
chk this .
chk this code
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
*& Form f_send_mail
text
--> p1 text
<-- p2 text
FORM f_send_mail .
*store the vendor name, vendor email id , employee name and employee
*email id in the internal table int_crb
Creation of the document to be sent
CLEAR doc_chng.
REFRESH objpack.
REFRESH objhead.
REFRESH reclist.
REFRESH objtxt.
File Name
doc_chng-obj_name = 'SHIPMENT'.
Mail Subject
CONCATENATE 'Shipment Document No.' int_crb_mail-shipdocnum
'Cleared.'
INTO doc_chng-obj_descr SEPARATED BY ' '.
Mail Contents
objtxt-line = 'Hi,'.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
CONCATENATE 'Shipment Document Number ' int_crb_mail-shipdocnum
' cleared for move.' INTO objtxt-line SEPARATED BY ' '.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
CLEAR objtxt.
objtxt-line = 'Regards '.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
objtxt-line = 'SAP '.
APPEND objtxt.
CLEAR objtxt.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN(
objtxt ).
Creation of the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Completing the recipient list
target recipent
CLEAR reclist.
reclist-receiver = int_crb_mail-empperid. "employee email ID
"wf_empperid.
reclist-express = 'X'.
reclist-rec_type = 'U'.
APPEND reclist.
copy recipents
CLEAR reclist.
reclist-receiver = int_crb_mail-smtp_addr."vendor email id
reclist-express = 'X'.
reclist-rec_type = 'U'.
reclist-copy = 'X'.
APPEND reclist.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
COMMIT WORK.
SUBMIT rsconn01
WITH mode = 'INT'
WITH output = ' '
AND RETURN.
ENDFORM. " f_send_mail
for any clarifiaction pls mail me.
pls reward points, if this helped u.
regards,
anversha.
[email protected] -
How to run 2 reports to send 1 PDF e-mail attachment instead of 2 e-mails.
I used 9i Reports to create 2 reports in a PDF format. I run these reports from a 9i form using the web.show_document command. XML is used to send the 2 e-mails with the reports.
Is there a way I can combine the running of the reports to make one PDF to created 1 e-mail attachment or run the reports at the same time and attach 2 PDF files to 1 e-mail.
I have no problems running 1 report and sending 1 e-mail attacment!
This is example of the XML used in creating the e-mail:
- <destinations>
- <foreach>
- <file id="Test" name="REPORT_1.pdf" format="pdf" instance="XXXX">
<include src="report" />
</file>
</foreach>
- <!-- Send a mail with an attachment
-->
- <mail id="ex1" to="&DESNAME" from="&DESNAME" subject="&DESNAME;*;&p_postal_number: was submitted for
approval on &p_postal_date">
<body srcType="text">This is to notify you of a new submission that requires an approval before being
sent to out. Please use the URL link below to review the information as soon as possible.
https://xxxx.aaaa.sss.com:234/web_html/static.html AAAA Administrator</body>
- <attach format="pdf" name="Report_1&.pdf" srcType="report">
<include src="mainSection" />
</attach>
</mail>
</destinations>You can use iText to combine two PDF files into one.
-
How to send original filename as the attachment name through mail adapter?
Hi,
I have a File to Mail scenario where the file is picked up from a folder in R/3 system and is sent as an attachment through mail. The requirement is to send the file unconverted and with the same file name.
When tried without creating any ESR objects, it was sending the file with the name Untitled.xml.
Since the filename has to be picked dynamically, I am not able to configure it through module parameters also (where we can set it through Content_Disposition)
I tried configuring it as mentioned in the following link: [http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=138084630]
But still it is going as Untitled.xml with the whole mail package as the content of the attachment.
Any pointers to solve this issue will be of great help.
Thanks
Justinthere is no standard way so you will have to write module beans.
in other way:
XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping - XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
Dynamic name in the mail attachment - pseudo "variable substitution" :
XI: Dynamic name in the mail attachment - pseudo "variable substitution"
Dynamic attachment name in receiver mail adapter -
How to send text file as an attachment to exteral mail
hi ,
Can any one tell me how to send an internal table as a textfile attachment to the external mail.
regards
kishorehi,
i am assuming txt fie attachment means you want notepad attachment
recently i struggled on this and i achieved success by doing as below
remember to keep packlist as RAW type like below:
t_packing_list-doc_type = 'RAW'.
do like this
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
EXPORTING
ip_solitab = t_attachment[]
IMPORTING
EP_SOLIXTAB = xtext[].
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_data
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
tables
packing_list = t_packing_list
OBJECT_HEADER =
CONTENTS_BIN = objbin
CONTENTS_TXT = it_message
CONTENTS_HEX = xtext
OBJECT_PARA =
OBJECT_PARB =
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 -
How to send only one (of several) attachment from a receiver email adapter?
Hi all,
I have been working with the SAP XI email adapter for some time and now I encountered the following challenge:
I am receiving a message via email from a partner, call some modules which lead to the generation of 5 attachments in total for the incoming message.
I then map the MainDocument to a CONTRL message and return it to the sender using the dynamic parameters of both the sender and the receiver email cc.
I am filling these parameters inside the message mapping; so far I am not using the mailpackage xsd (the only things out of the ordinary are checked boxes for "use adapter specific parameters", "variable transport" and "keep attachments").
My problem is that the email receiver cc now generates an email with 5 attachments when I need it to add only the CONTRL (aka MainDocument) as attachment to this email.
Do you know if there is a way to tell the receiver cc to only use one attachment (or to remove attachments from the original message, f.ex. inside the message mapping)?
Thanks and cheers!
StefanHi Stefan,
>>>>Do you know if there is a way to tell the receiver cc to only use one attachment (or to remove attachments from the original message, f.ex. inside the message mapping)?
1. It cannot be done in a mapping
2. have a look at mz blog
how simple it is to write an adapter that will do what you need
(just check the delete part of this blog):
/people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
Sending XI-Content as Mail Attachement with specific Filename
Hi,
I want to send the Message-Content as a mail attachment with a specific Filename (e.g. 2005-08-31.csv). The content is a CSV File, not a XML
In the scenario an IDOC is sent to the XI mapped in a CSV-File (via Java-Mapping) and should be send as a Mail Attachment.
Is this possible and how?
Thank you for your help
ThomasHi Thomas,
You can influence the filename with the ModuleTransformBean. You need at least SP9 for this feature.
In the Mail Receiver Channel got to tab "Module"
As first module (before the mail module) enter:
localejbs/AF_Modules/MessageTransformBean as Local Enterprise Bean with any key
For this module key you can use in the module configuration following entries:
Transform.ContentDisposition inline|attachment;filename=<filename>
Transform.ContentDescription <Filename>
Transform.ContentType <MimeType>/<SubType>;name="<filename>"
If you want to send an attachment, use:
Transform.ContentDisposition attachment;filename="MyFile.csv"
Transform.ContentDescription MyFile
Transform.ContentType text/plain;name="MyFile.csv"
If you use the Mail Package, you can set the file name that way:
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Hello</Subject>
<From>[email protected]</From>
<To>[email protected]</To>
<Content_Type>text/plain;name="MyFile.csv"</Content_Type>
<Content>Here comes the CSV Data</Content>
</ns:Mail>
Hope that helps,
Stefan -
How to send a picture as an attachment
I'm new here and not sure I'm in the correct place .
I just bought a imac and I'm trying to send a picture as an attachment. I showes up in the body of the email. How do I get it to be just an attachment like on a computer?Try using the Finder Compress the file, then attach the resultant file to the e-mail.
-
How to send multiple attachments thru mail?
I haven't been able to figure out how from the mail application send docs, worksheets etc as attachment. Also how to attach multiple docs in the mail. Looking for help on this.
SparasharYou need to start in the app that contains the files that you want to send as attachments and use that app's functionality to select and attach files to an email, and not start in the Mail app e.g. the GoodReader app supports multiple document types (word and excel, read only, PDFs, text files, pictures) and allows you to select one or more of them and attach/switch with them to an email.
In the Mail app itself on iOS 6 you can now press and hold the body of the email and select photos from the Photos app to attach to it. -
Is it possible to generate a PDF and send it as a mail attachment ?
Hello All,
While there are many contributions and suggestions on how to send a pdf form via email, I will like to find out if its possible to send a pdf as part of an email attachment WITHOUT even viewing it first ? Below is a brief descrption of what I'll like to do :
1) A user logs into his inbox and checks if there are any requests for his approval. In the event that he finds one, he may either select the row item in the table to display the requests details prior to approving or clicks on approve immediately.
2) This approval action should send an email to an appointed external supplier with the request details as a pdf attachment.
All this should be done without the need to generate a interactive form. Is this possible ?
Thank you very much.
from
Kwok WeiHi Hubert,
I am tryign the same logic as ur to send PDF as an attachement but while opening its giving me file cannot be opened.
My code goes like this
CALL FUNCTION 'FP_JOB_CLOSE'
IMPORTING
E_RESULT = RESULT
EXCEPTIONS
USAGE_ERROR = 1
SYSTEM_ERROR = 2
INTERNAL_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.
ELSE.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = FORM_OUT-PDF "PDF file from function module
TABLES
binary_tab = lv_output.
DATA: GD_DOC_DATA TYPE SODOCCHGI1,
lt_mailpack TYPE STANDARD TABLE OF SOPCKLSTI1 ,
la_mailpack type SOPCKLSTI1 .
data:lf_lines type i.
describe table lv_output lines lf_lines.
clear la_mailpack.
la_mailpack-transf_bin = 'X'.
la_mailpack-head_start = 1.
la_mailpack-head_num = 1.
la_mailpack-body_start = 1.
la_mailpack-doc_type = 'PDF'.
la_mailpack-body_num = lf_lines.
la_mailpack-doc_size = lf_lines * 255.
la_mailpack-obj_descr = 'object'.
la_mailpack-obj_name = 'MAIL'.
append la_mailpack to lt_mailpack.
data: IT_RECEIVERS type STANDARD TABLE OF SOMLRECI1 WITH HEADER LINE.
*DATA: GD_DOC_DATA TYPE SODOCCHGI1.
BREAK FTABAP.
GD_DOC_DATA-OBJ_DESCR = 'PDF'.
IT_RECEIVERS-RECEIVER = 'email address'.
IT_RECEIVERS-REC_TYPE = 'U'.
APPEND IT_RECEIVERS.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = GD_DOC_DATA
* PUT_IN_OUTBOX = ' '
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
PACKING_LIST = lt_mailpack
*OBJECT_HEADER = lt_mailhead
* CONTENTS_BIN =
*CONTENTS_TXT = lt_mailtxt
CONTENTS_HEX = lv_output
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS = IT_RECEIVERS.
Kindly please help me in solving this issue.
Maybe you are looking for
-
Regarding header proble in FM GUI_download.
Hi, I want to write header in XL file by using the paramter fieldnames, but the FM is not considering full text what i m giving , please see the below code *To download DATA : BEGIN OF t_header OCCURS 0, name(100) TYPE c, END OF t_heade
-
Photo folders not showing on ATV
Hi, Just set up my new ATV yesterday, and overall I really like it. However, I do have one problem with photo syncing. I set up iTunes to sync all the contents of a folder on my iMac called "Photos". All 2,500 photos appear to have synced to the ATV.
-
Customizing Worklist Discoverer portlet - 10.1.2
Hi, Is there any clean way of customizing the Discoverer worklist portlet. I want to remove the "type" column and the "Expand all" section. I have looked at show_list_of_worksheets.uix but I am not particularly sure of what to change. Thanks Joel.
-
Hi Experts, I'm new to SRM. We have requirment for N-Level Approvals Sequentially at item based for the SC . The Approval Level needs to be determined dynamically , by comparing the Total value of the SC with the Approval limit maintined in the Custo
-
Can I reinstall PS CS6 without reinstalling the whole suite
Photoshop is angry. There seems to be no solution short of uninstall/reinstall. Is there a way to uninstall just Photoshop and then reinstall just Photoshop without messing with the rest of the suite. Everything else is running smoothly. I'm running