Sending XML file as attachment in E-mail
Hi,
I'm facing a problem with sending e-mails with an XML-file as attachment. Scenario is as follows:
- I collect the payload from XI with FM 'SXMB_READ_MESSAGE_VERSION_RAW'.
- This payload is in the form of an xstring.
- I convert this xstring to binary content by using FM 'SCMS_XSTRING_TO_BINARY'.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_buffer
* APPEND_TO_TABLE = ' '
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_conhex.
The itab lt_conhex is of type solix_tab.This is used finally to send the mail via class CL_BCS following normal procedures. Now when I open the e-mail with attachments I get the error that in the last line of my xml-file some squares are placed, which causes the document to open incorrectly. When I delete the squares via e.g. notepad and open my xml-file again in my internet browser, it opens correctly.
If I look at the contents of the solix_tab I see that the last line of the hexadecimal values are zero's, probably causing the XML file to be attached/oopened incorrectly. Is there any way to replace these zero's with some hexadecimal value in order to display my XML-file correctly?
Kind regards!
Thanks Sandra,
Overlooked that parameter. Indeed if you take the XSTRLEN of the document and place this in the method for creating the attachment it works fine.
CALL METHOD lo_email->add_attachment
EXPORTING
i_attachment_type = ls_email-type
i_attachment_subject = ls_email-subject
i_att_content_hex = ls_email-content_hex
i_attachment_size = ls_email-content_length.
By the way...if you're dealing with PDF documents this documentlength doesn't matter.
Similar Messages
-
Send XML File as attachement in Mail Receiver adapter
Hi all,
i have the following scenario. i would like to read an XML file from the file system and send this file as an attachement of a mail to a mail receiver specified in this file.
i would like to fill the payload of the mail with some information from the xml file and in addition i would like to send the complete xml file as an mail attachement.
can anybody tell me, how the mail receiver adater needs to be specified ?
best regards,
martinHey,
you can go for dynamic configuration of mail adapter.
In this you need to import a mail structure.
mail details such as to, from, subject and content of the mail are a part of the structure.
In your ID check the Use Mail package and also keep attachments.
Now you can give your details in mapping itself.
whatever you want to map in the content of the mail, map it in the content field.
also your file will behave as an attachment.
refer to this blog.
this is the mail structure. Import it as extenal definitions.
<?xml version="1.0" encoding="utf-8" ?>
<!--
SAP takes no position regarding the validity or scope of any intellectual property or
other rights that might be claimed to pertain to the implementation or use of the
technology described in this document or the extent to which any license under such
rights might or might not be available; neither does it represent that it has made any
effort to identify any such rights.
Copyright © SAP 2003-2004. All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative
works that comment on or otherwise explain it or assist in its implementation may be
prepared, copied, published and distributed, in whole or in part, without restriction of
any kind, provided that the above copyright notice and this paragraph are included on all
such copies and derivative works. However, this document itself does not be modified in
any way, such as by removing the copyright notice or references to SAP.
This document and the information contained herein is provided on an u201CAS ISu201D
basis and SAP DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY
IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-->
<xs:schema targetNamespace="http://sap.com/xi/XI/Mail/30"
xmlns:xi="http://sap.com/xi/XI/Mail/30"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!--
Mail
-->
<xs:element name="Mail">
<xs:annotation>
<xs:documentation>Mail package for XI - Mail Adapter</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Subject" type="xs:string" minOccurs="0"/>
<xs:element name="From" type="xs:string" minOccurs="0"/>
<xs:element name="To" type="xs:string" minOccurs="0"/>
<xs:element name="Reply_To" type="xs:string" minOccurs="0"/>
<xs:element name="Content_Type" type="xs:string" minOccurs="0"/>
<xs:element name="Date" type="xs:dateTime" minOccurs="0"/>
<xs:element name="Message_ID" type="xs:string" minOccurs="0"/>
<xs:element name="X_Mailer" type="xs:string" minOccurs="0"/>
<xs:element name="Content" minOccurs="0">
<xs:annotation>
<xs:documentation>any type</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="encoding" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="MailReceipt">
<xs:annotation>
<xs:documentation>Mail Receipt for XI - Mail Adaper</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Server" type="xs:string"/>
<xs:element name="Format" type="xs:string"/>
<xs:element name="UseMailPackage" type="xs:boolean"/>
<xs:element name="Encoding" type="xs:string"/>
<xs:element name="Subject" type="xs:string" minOccurs="0"/>
<xs:element name="From" type="xs:dateTime" minOccurs="0"/>
<xs:element name="To" type="xs:string" minOccurs="0"/>
<xs:element name="Date" type="xs:dateTime" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
regards,
milan -
Is it possible to zip a file and send it as an attachment in a mail?
Hi,
Is it possible to zip a file and send it as an attachment in a mail?When you use OWA in something other than IE, you're using OWA lite and no--it is not possible to do either in OWA lite (well, new Exchange stuff makes my answer a little less emphatic but still: pretty much no). Thanks Microsoft. But this guy made it possible to mark unread/read and select all/none:
http://david-burger.blogspot.com/2008/07/firefox-greasemonkey-outlook-web-access_19.html -
How to send XML file to https server using POST
Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
Thanks,Can anybody give me the solution
-
How to send XML file into XI using sender HTTP adapter
I am using HTTP sender adapter to post the XML file into XI. I tried to form the URL by using the following String query , but I am unable to execute file.
String urlString = "http://<servername:portno>/sap/xi/adapter_plain?namespace=<namespace>&interface=<interface name>&service=<service name>&party=&agency=&scheme=&QOS=BE&sap-user=xiappluser&sap-password=satyam&sap-client=100&sap-language=EN";
How can I execute xml file by using HTTP sender adapter.
Any one with better suggestions, about this idea?
Thanks in advance for all.
Ram RajHi
Just use the following parameter to send xml file using HTTP adapter.
"http://xiserver:8000/sap/xi/adapter_plain?namespace="senderNamespace"&interface=senderinterface&service=sender service";
"&party=sender party"&agency=&scheme=&QOS=BE&sap-user=userid &sap-password=password&sap-client=100&sap-language=D";
with the help of this you are able to point out which interface you would like to use.
And in payload pass the xml.
and thats it
carry on
Cheers
Regards
Piyush -
how to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 device using ftp through Ethernet
Hello
For using FTP function in LabVIEW, I recommend you to check this document: FTP Basics
Also, take a look at FTP Browser.vi, which is available at the Example Finder.
To edit a XML file, try to use VIs in XML palette. Maybe Write to XML.vi helps you.
Post your current VI if possible.
Regards
Mondoni -
I can't get files to attach in e-mail quickly.
I can't get files to attach in e-mail. I get a prompt to retry or switch and retry. Switching works but the process takes too long.
Which email client are you using?
-
How to send txt file as attachement in email
Hi Experts ,
How to send txt file as attachement in email .
which function module i useHi,
Try to use this one
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
Hope it can solve your problem!
Good luck!
Tao -
How to send XML files through Business Connector to client URL
Dear ALL
I am new to SAP BC. We have setup BC 4.8 and would like to send out a XML file from BC to Client URL. Could someone please guide me.
Please suggest solutions.
Thanks
AhmedHello Mickael
Thanks for your reply. No, we do not have PI. This BC will be used for point to point communication with client.
Scenario:
R/3 server to send XML files to BC. BC will load these files ( using pub.getfile service), this file is to be parsed using pub.loaddocument service and then sent to client in XML format wrapped with digital signature. As i am new to BC i am unable to parse this file and wrap it with the digital signaature to send it.
Kindly advise on how best can we perform this action.
Thanks
Ahmed -
Sending XML Files with Certificate
Hello everybody.
I need develop an abap program for sending XML files with a certificate.
How I can create this certificate?
Somebody have an idea?
Thank you everybody.
NelsonMikael,
This sounds like one of the many quirks (perhaps bugs) related to how FrameMaker handles non-FM files in books. The current book model doesn't play well with XML files as chapters and this seems like yet another problem. Apparently, if an xref does not target another .fm file in the book, Frame assumes that the target file is not in the book and therefore will not be in the book PDF.
There have been discussions here about this in the past. The solution that I use is to run an API client before publishing that converts all XML files to .fm files, and redirect all xrefs appropriately. Then, book features work as expected and PDFs come out as normal. This is not feasible, however, without the automation from the API client.
There may be some who would say that the best approach is to use XML and books the way that the designers did account for... that is, the whole book becomes an XML document with entity references to the separate chapters. In my work, though, this model was not appropriate... rather, I needed a binary FM book to act like a book, except with XML files as chapters. So, I think I understand your situation.
Is API programming or FrameScript an option for you? I think it may be the only way to get what you are looking for.
Russ -
How to send xml file from local folder to azure storage
Hi,
My plan is i have xml files which are under folders in my local.
I want to use mobile service to send xml files to azure storage,
how shall i do that, either by c# or mobile service.
If internet stop, I will use my mobile service to transfer all xml files to azure storage and run web job to do to update azure
sql by xml file.
please advice.
SupermanHi,
You could refer the following link for assistance with uploading image files to Azure Blob Storage using Mobile Services:
http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-phone-upload-data-blob-storage/
And for image files you could refer the following link:
http://stackoverflow.com/questions/25977406/upload-a-text-file-with-azure-mobile-services
Regards,
Malar. -
Application or Front end to send XML file to Webservice in 7.0
Hi,
Can anyone send me sample code how to send XML file to Webservice datasource,I have tested it through Navigator and it works fine.
Kindly send me the sample code how to pass XML data.
Thanks,
Arvind MHi Arvind,
Please check out below links
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e698aa90-0201-0010-7982-b498e02af76b
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d3219af2-0c01-0010-71ac-dbb4356cf4bf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1530ab90-0201-0010-6791-f31512d75e6a
Hope its Helps u.
Thanks
SRS -
Not able to send pdf file as attachment in my apple mail.
Hi, I was easily able to attach pdf files to my apple mail. infact I could just open a pdf file and then send it as attachment in the email earlier. but after downloading and upgrading to os X Mountain lion, I am neither being able to attach and send pdf files in my apple mail, nor can I send PDF file as an attachment.
Is there any issue with OS X Mountain Lion.
Issue 1. I compose Email , then click attach > Browse > select pdf file > click attach > it shows in my Email body either as an icon or as first page of the pdf document > I send it. >>> But when the receipient opens the Email, that pdf attachment is missing. In fact When I put a cc to my self and I open the Email, the attachment is mssing in the incoming E amil.
Issue 2. I open the PDF document > Click on File > send as attachment in E-Mail > on right, a menu appears where I select the File and click attach> I get a message
The SendMail doesnot know how to talk to your default mail client. Please select a different mail application to use. Attaching a screen shot.
I never had these issues earlier with my Lion OS . but since the time I have upgraded to mountain Lion OS, I am having these issues.
Are these the Mountain Lion issues, how to fix these please.I believe, the software team forgot to put a button for send or share as an attachment to preview.
-
Email XML file as attachment in 4.6c
Hi,
I have a requirement to generate an XML file and email it.
I am using Class CL_IXML to create the xml requirement. The code is listed below
When I download the file to the PC, i am able to open the file and the XML format is ok, but when
I email the file using SO_NEW_DOCUMENT_ATT_SEND_API1, the attachment is still in the Binary format. Does anyone know how to send the file as an XML attachment.
We are using SAP R/3 ver 4.6c.
Load the class definition
CLASS cl_ixml DEFINITION LOAD.
Creating a ixml factory
l_ixml = cl_ixml=>create( ).
Creating the dom object model
l_document = l_ixml->create_document( ).
Message
l_element_message = l_document->create_simple_element(
name = 'Message'
parent = l_document ).
Message Header
l_element_message_hdr = l_document->create_simple_element(
name = 'MessageHeader'
parent = l_element_message ).
Sender Id
l_element_dummy = l_document->create_simple_element(
name = 'SenderID'
value = 'ABCDE'
parent = l_element_message_hdr ).
Receipient Id
l_element_dummy = l_document->create_simple_element(
name = 'RecipientID'
value = 'ZZZZZZZZZZZ'
parent = l_element_message_hdr ).
Prepared
l_element_dummy = l_document->create_simple_element(
name = 'Prepared'
value = '2009-03-31T14:30:00'
parent = l_element_message_hdr ).
Msg ID
l_element_dummy = l_document->create_simple_element(
name = 'MessageID'
value = '1234567896'
parent = l_element_message_hdr ).
Msg type
l_element_dummy = l_document->create_simple_element(
name = 'MessageType'
value = 'MANIFEST'
parent = l_element_message_hdr ).
Msg ver
l_element_dummy = l_document->create_simple_element(
name = 'MessageVersion'
value = '02'
parent = l_element_message_hdr ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
Connect internal XML table to stream factory
l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
Rendering the document
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
Saving the XML document
l_xml_size = l_ostream->get_num_written_raw( ).
Thanks
NDHi,
I have one program conerts data to xml format.
TABLES:
MAKT, "Mat description
MARC, "Material / plant
T001W, "plant name
BHDGD. "Batch heading
Internal tables
DATA:
BEGIN OF GT_MARC OCCURS 0,
WERKS LIKE MARC-WERKS,
MATNR LIKE MARC-MATNR,
END OF GT_MARC,
Table to be downloaded as xml. Each line stores start and end tags
and the value
BEGIN OF GT_XML OCCURS 0,
LINE(120),
END OF GT_XML,
G_MAKTX(120).
User-input
SELECT-OPTIONS:
S_WERKS FOR MARC-WERKS,
S_MATNR FOR MARC-MATNR.
START-OF-SELECTION.
Extract all required data
PERFORM MAIN_PROCESSING.
END-OF-SELECTION.
SORT GT_MARC BY WERKS MATNR.
LOOP AT GT_MARC.
AT FIRST. "First tag must be root
CLEAR GT_XML.
GT_XML-LINE = ''.
APPEND GT_XML.
CLEAR GT_XML.
display data
FORMAT COLOR 2 ON.
WRITE :/ GT_MARC-MATNR, MAKT-MAKTX.
FORMAT COLOR 2 OFF.
ENDLOOP.
The last tag must be the root closing tag --*
GT_XML-LINE = '</LOCATIONS>'.
APPEND GT_XML.
CLEAR GT_XML.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
FILENAME = 'C:PLANT1.XML'
FILETYPE = 'ASC'
TABLES
DATA_TAB = GT_XML.
TOP-OF-PAGE.
MOVE SY-TITLE TO BHDGD-LINE1.
MOVE SY-REPID TO BHDGD-REPID.
MOVE SY-UNAME TO BHDGD-UNAME.
MOVE SY-DATUM TO BHDGD-DATUM.
MOVE '0' TO BHDGD-INIFL.
MOVE '132' TO BHDGD-LINES.
FORMAT INTENSIFIED ON COLOR COL_HEADING.
PERFORM BATCH-HEADING(RSBTCHH0). "report header
Form READ_PLANT
FORM READ_PLANT.
Get plant name
CLEAR T001W.
SELECT SINGLE NAME1
INTO T001W-NAME1
FROM T001W
WHERE WERKS EQ GT_MARC-WERKS.
ENDFORM. " READ_PLANT
Form MAIN_PROCESSING
FORM MAIN_PROCESSING.
Material and plant basic data
SELECT WERKS MATNR
INTO TABLE GT_MARC
FROM MARC
WHERE WERKS IN S_WERKS
AND MATNR IN S_MATNR.
ENDFORM. " MAIN_PROCESSING
Form READ_DESCRIPTION
FORM READ_DESCRIPTION.
Material name
CLEAR G_MAKTX.
SELECT SINGLE MAKTX
INTO G_MAKTX
FROM MAKT
WHERE MATNR EQ GT_MARC-MATNR
AND SPRAS EQ 'E'.
Replace special character
DO.
REPLACE '&' WITH '*ù%;' INTO G_MAKTX.
IF NOT SY-SUBRC IS INITIAL. EXIT.ENDIF.
ENDDO.
DO.
REPLACE '*ù%;' WITH '&' INTO G_MAKTX.
IF NOT SY-SUBRC IS INITIAL. EXIT.ENDIF.
ENDDO.
DO.
REPLACE '/' WITH '/' INTO G_MAKTX.
IF NOT SY-SUBRC IS INITIAL. EXIT.ENDIF.
ENDDO.
ENDFORM. " READ_DESCRIPTION
END OF PROGRAM Z_DOWN_XML ************************
*******For sending data to mail check the following link*****
http://itknowledgeexchange.techtarget.com/itanswers/is-there-an-xml-function-module/
(OR)
search in sdn.sap.com for mail data(xml) -
In Adobe froms - Sending PDF file as Attachment via email
I have to develop a <b>PDF form</b> and one more requirement; I have to change the mail Content (body) and the Subject line which should have attached PDF file.The (Transaction Code VA21) Has the sending the Email part. My Requirement is to <b>Change the Content (body) and the Subject</b>.
Requirement;
When customer request for the quote, quote document is created in SAP (Transaction Code VA21). Promised Price, quantity, date is communicated to customer via quote output. Customer may decide to place firm order with reference to quote.
So this form (PDF file and send via email) is used to communicate the AMAT quote to customer. The PDF file will be as a attachment in the mail. With change subject line, and content of the mail (Thanks for the Quote, Please dont reply to this mail). It also consists of applicable terms & condition of the quote.
Is it possible to handle the Content and the Subject of the mail in Program or Form layout (SFP). or it's Enhancement?
How to go about it? I tried a lot. At last am contacting you. Please.............. Let me know. Very urgent.Point will be given sooon. Tnx a lot.....
#SinivasHi,
Yes But you can use ADOBE FORMS for that... Check this link for presentation...
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0c139d3-3eae-2910-01a1-d253f2587b0e?prtmode=navigate
Check this BLOG for sending Email through ABAP..
Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface
One more thing... You can download your data to a PDF file and send that PDF file via program...
Search this Forum for more answers.. you would get plenty out of it...
Check this thread for further information..
Sending mail with 2 attachments
Hope this would help you.
Any queries plz revert back
Good luck
Narin
Maybe you are looking for
-
Calculate Withholding taxes for VEndor Invoices using ABAP program.
Hi All, I have to upload Vendor Invoices using FB60/Fb01 tcodes. I am able to post the Invoices using FB01/Fb60 but I have to calculate extended withholding taxes also using this program for the Invoices. Is it possible to upload vendor Invoices and
-
I downloaded tomcat 4.1 and extracted it to my harddrive, but when i try to start up the tomcat server i get the following error. C:\Program Files\apache-tomcat-4.1.34\bin>startup JAVA_HOME\bin\java.exe is missing The JAVA_HOME environment variable m
-
Removing tool tip texts in pdf?
Hello there and good day. I have a pdf document in abobe 9, and it has hyperlinks and when I hover over them with the mouse it has the link addy in the tool tip text thing. I was wonder if there was a may to remove it or have that box blank. Thanks!
-
Is it possible to have a custom downloaded text/ringtone?
I want to download a ringtone and use it but it doesn't look like that is possible. Is it?
-
PDF from (old) Fireworks
Hi, I have Fireworks MX 2004 and I have created a page I need to have as a PDF for distribution - as you will gather I am not very good with this stuff... The file was made a while ago (hence the old version of firewosks), I now have Adobe Design Pre