Sending HTML email with SO_DOCUMENT_SEND_API1

Hi all,
I have implemented a function module to send HTML emails with SO_DOCUMENT_SEND_API1.
It works fine, but in every email I have at the end a CRLF which looks not very nice in MS Outlook.
It seems that this will be added to every email in addition to my HTML text.
Has anyone an idea how I can prevent this?
Thanks in advance for your help.
Best Regards,
Marcel

Hi Marcel,
not only you can, you should use CL_BCS for sending of email. Although I expect it to be not too different from the old functions, it points to the object oriented future of SAP/ABAP. At least it should run more stable and SAP recommends to use it as a replacement for old functions.
I came across one blog
[Sending HTML Email from SAP CRM/ERP|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/2273]
You may be careful with this one: Probably it's not exactly what you need.
The one I love most for its simplicity is this one
[Unknown thus unloved?|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/3443]
although it does not mention HTML - I think easy for you to adapt. Compared  to functional SO_DOCUMENT.. approach the program will shrink.
If you want to understand the concepts behind, nobody explains it better than
[Thomas Jung: Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/789]
or - if you still feel unsafe in oo environment -
[Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/15408]
Happy coding!
Regards,
Clemens

Similar Messages

  • Send HTML emails with ODI

    Hi,
    I wish to send HTML emails with ODI but it seems not possible with the tool ODISendMail. Do you know a procedure to do it ?
    Thank you very much for your answers.
    Regards.

    Hello,
    Thanks but this article decribes an other tool that I don't have in my version. Maybe is it possible to send me the procedure XML to import it ?
    There is also a procedure available on the Oracle support (TRT_Send_Jython_HTML_Email.xml) but I don't know where I can download it... Do you ?
    Thank you very much

  • Send html email with image embedded

    Hi Guys,
    I want send an email using class CL_BCS.
    Can someone please help me to tell me how can we send the email with image embedded in the body?
    The image is stored in the mime repository and was uploaded through se78.
    I have searched online but am not able to send it.
    It will be great if someone has working code for this.
    Regards,
    Dhruv Kashyap

    Hi go to T-code : SMW0   -- To upload the images , after that you can find that entries in wwwparams table .
    Refer this .
    **************** - Display images (like company logo) on the selection-screen
    In order to send it as email you have to add  attachment type as BMP from you BCS class.
    Just try you can .

  • How to send HTML emails with embedded graphics?

    I've discovered Mail is great for sending HTML if you open it in Safari and select "Mail Contents of this Page" - - My problem is, I need to include the graphic elements as embedded images rather than hosted images.
    Is there any way to do this with Mail.app?
    Can I somehow modify my HTML image references to make this happen?
    Is there another Mac application recommended to do this?

    The best thing I've tried is Max Bulk Mailer. Do a search for it on VersionTracker. It's about $50. or so.
    If you're just looking to send one offs, you can do it with a hotmail account - just make sure you pull out the doctype tag (you should do this for any html email).

  • UTL_SMTP send HTML email with embedded image?

    Hi, I can use UTL_SMTP to send an HTML email ok, but does anyone have an example of how to include an inline embedded image in the email? Thanks!

    If you want to send the html page and have it
    reference the images and css files on your web
    site, that's pretty easy. Just create a message
    with text/html content that is your html page.
    If you want to include all the images and css files
    in your message along with the html page, you'll
    need to create a multipart/related message and
    you'll need to change all the html to reference the
    images and css files using "cid:" references.

  • Sending HTML email with iPhone with Exchange

    Can anyone confirm the way the iPhone sends email with Exchange. We have a disclaimer that attaches to all emails. This discalimer is HTML and is processed on the Exchange server. Anything that sends via Exchange gets processed whether from Outlook Web Access, Blackberry or Outlook itself. However, the iPhone sends out its message with no signature or disclaimer. Any ideas?
    Barry

    I am using Active Sync. Pop and IMAP are disabled. The disclaimer is applied by Ninja Email Security for Exchange by Sunbelt Software. The disclaimer is policy based against a users mailbox. It works with everything we have tested except the iPhone. It is like the iPhone is sending a plain text message and the disclaimer is not applied to a plain text message. However, OWA sends as plain text and it is applied as html from OWA. We are using Exchange 2003 SP2 and server 2003 SP2.

  • How to send HTML email with variable substitution in the email body section?

    Does anyone have some scripting examples that create a HTML formatted e-mail with the ability to have some fields be variables?
    I'm familiar with updating a XML document using a template file and the "keyword transform" function in the script.
    (Like setting an emergency close for a queue for example)
    I've also successfully written a script that sends an e-mail with a .wav file attachment.  I think I have the basics down on the e-mail part.
    Using the keyword transform gives me an xml document that shows the tags as well as the desired variable.  Functional but not very attractive
    The issue I'm really struggling with is the formatting of the e-mail body.
    Is there a way to have a "prettier" document with some basic HTML tags that allow the same function?
    For example I'd like a sentence in the body of the e-mail to say
    "Call received from number <VariableOfCallingNumber>  at <TimeVariable>
    I can do this in the subject easily enough but adding together some strings and variables. 
    I could do the same thing in the e-mail body DOC[], but as I understand it, I could only get 1 line so it would be pretty limited
    Can anyone point me in the correct direction?
    Thanks !!

    sorry, not possible
    http://stackoverflow.com/questions/5620324/mailto-with-html-body
    https://www.google.com/search?rlz=1C1CHFX_enUS566US566&{google:acceptedSuggestion}oq=mailto+with+mime+type&sourceid=chro…

  • Send HTML Email with Embedded Images and CSS

    Hi All,
    I have a html page. I want to send that html page(not with attachment) with all images and css. i search and try but I cant find a good solution. can any one help... plz..........
    Thank You.....

    If you want to send the html page and have it
    reference the images and css files on your web
    site, that's pretty easy. Just create a message
    with text/html content that is your html page.
    If you want to include all the images and css files
    in your message along with the html page, you'll
    need to create a multipart/related message and
    you'll need to change all the html to reference the
    images and css files using "cid:" references.

  • How to send html email notification in bpel

    hi gurus,
    i want to send html email notification from bpel.
    before, i already successful send html email with attachment, but when i send an email without attachment, then the body message will turn into a plain text.
    as i check from the email accepted, email with attachment will have a mime type "text/html" but if no attachment then it will be "text/plain"
    from the bpel configuration, by default the mime type already set to "text/html; charset=UTF-8", below is the sample configuration in my bpel process
    [quote]
    <copy>
                                    <from>string('text/html; charset=UTF-8')</from>
                                    <to variable="varNotificationReq"
                                        part="EmailPayload">
                                        <query>ns10:Content/ns10:MimeType</query>
                                    </to>
                                </copy>
    [/quote]
    i think this suppose to be a easy configuration, but i'm not sure whether i miss something in configuration the email process or this is a bugs in bpel.
    environment:
    linux
    jdev 11.1.1.6
    do u guys ever facing a same problem or have a solution to this ? please throw some light.
    thanks
    ===
    update, i found a temporary solutions.
    so i add a attachment from the process design, and then i change it from the source.
    [quote]
    <copy>
                                    <from>
                                        <literal>
                                            <Content xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
                                                <MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">multipart/alternative</MimeType>
                                                <ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
                                                    <MultiPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
                                                        <BodyPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
                                                            <MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
                                                            <ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
                                                            <BodyPartName xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
                                                        </BodyPart>                                            
                                                    </MultiPart>
                                                </ContentBody>
                                            </Content>
                                        </literal>
                                    </from>
                                    <to variable="varNotificationReq"
                                        part="EmailPayload">
                                        <query>ns10:Content</query>
                                    </to>
                                </copy>
    <copy>
                                    <from>string('text/html; charset=UTF-8')</from>
                                    <to variable="varNotificationReq"
                                        part="EmailPayload">
                                        <query>ns10:Content/ns10:ContentBody/ns10:MultiPart/ns10:BodyPart[1]/ns10:MimeType</query>
                                    </to>
                                </copy>
                                <copy>
                                    <from>string('your message')</from>
                                    <to variable="varNotificationReq"
                                        part="EmailPayload">
                                        <query>ns10:Content/ns10:ContentBody/ns10:MultiPart/ns10:BodyPart[1]/ns10:ContentBody</query>
                                    </to>
                                </copy>
    [/quote]
    make sure you put the mime type multipart/alternative into the email payload content. by default, when you add attachment, it will generate mime type multipart mixed automatically.
    if you don't change it to multipart/alternative, your email will show a attachment, but actually your email doesn't contain any attachment.
    and then for the message and mimetype make sure you have that ns10:bodypart, because this email already been set as a multipart email.
    when you add attachment, by default it will generate 2 body part, first one is for the body message and the second one is for the attachment. since i only want to use the body message only, then i have to erase the second bodypart
    with this workaround, i can send a html email without attachment perfectly.
    but i have to take note, when i updating the email process from process design, then the source will be generated again automatically, and the edited one will be replaced.
    thanks.

    Make sure you upload all of the images used in your email to a server you control. Then, change your image paths to point to those uploaded images with absolute links.
    You will get marked as spam if you attempt to send images as attachments to a large list of recipients and most email clients won't download images to begin with, so make sure your html email makes sense with broken pictures.
    CSS support is spotty across email clients, if you use css, make sure it's inline, not embedded in the <head> or externally linked in the <head>. Some email clients strip out the <head> section entirely.
    Basically, you need to design your html email as if you haven't moved out of the 90's yet, as far as web design is concerned, in order to get maximum cross client compatibility.
    Then, when you're ready, I would suggest using a service like www.icontact.com or www.constantcontact.com if your subscriber list is anywhere over 100 or so recipients.

  • Html email with blob attachment and authentication

    I have been looking for a plsql package to send html emails with blob attachments. The html portion and the blob attachment are more than 32k.
    Also the email server needs to be authenticated.
    Does anyone know of something already written to do this? I’ve found lots of code that does one or two items but not all.
    Must:
    - Authenticate
    - Html email
    - Accept blob as input parameter for attachment
    - Exceed 32k
    There are so many routines, I’ve been searching looking for one which does all.

    This works for authentication:
    utl_smtp.command(l_mail_conn, 'AUTH LOGIN' );
    utl_smtp.command(l_mail_conn,utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw ( v_username ))));
    utl_smtp.command(l_mail_conn,utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw ( v_password ))));

  • Need to send HTML email from Workflow : problem with sender

    Hi all,
    i need to send HTML email from my Workflow. I did it but i have a problem with the sender. The sender of email is always the agent responsible of workitem, and i don't want the receiver can answer to sender. So i need to put a false email address like nosender.at.mycustomer.com.
    Possible to do that ?
    Thanks for your help.
    Cheers

    Hi rick
    How to change the wf-batch to some other name  as you mention in previous reply. Can you give some details of that. If i use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 how to change the wf-batch name and if i use send mail step in my workflow how to change wf-batch name.
    Regards
    vijay

  • Sending a html email with jsp

    is it possible to send an email with html content and how do i do that

    Try this
    <%@ page import="sun.net.smtp.SmtpClient,java.io.PrintStream" %>
    <%
    try{
    String host = "IP"; //this is u r IP adress
    String from = "[email protected]"; //mail adress of sender
    String to = "[email protected]"; //mail address whom to
    SmtpClient smtp = new SmtpClient(host);
    smtp.from(from);
    smtp.to(to);
    PrintStream out1 = smtp.startMessage();
    out1.println("To: " + to);
    out1.println("Subject: Hello peter ");
    out1.println();
    out1.println("Hi Peter How r u doing ");
    out1.flush();
    out1.close();
    smtp.closeServer();
    catch(Exception e)
    out.println(e+e.getMessage());
    %>

  • CRM ONLINE 2013: On Approval Of Quotation, Run Report, Generate PDF and Send an Email With PDF as attachment

    Hi,
    I am using CRM ONLINE 2013.
    How to automate below process?
    1. On Approval Of Quotation, Run Report.
    2. Generate PDF.
    3. Send an Email With PDF as attachment.
    As i have gone through many forums for this topic, but creating a plugin code for generating Report PDF is not possible in CRM ONLINE.
    So, What is the alternate way to do this..?
    Thanks.

    This is my entire code mentioned below:-
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
        <script type="text/javascript">
            if (typeof (SDK) == "undefined")
            { SDK = { __namespace: true }; }
            SDK.JScriptRESTDataOperations = {
                _context: function () {
                    if (typeof GetGlobalContext != "undefined")
                    { return GetGlobalContext(); }
                    else {
                        if (typeof Xrm != "undefined") {
                            return Xrm.Page.context;
                        else { return new Error("Context is not available."); }
                _getServerUrl: function () {
                    var serverUrl = this._context().getServerUrl()
                    if (serverUrl.match(/\/$/)) {
                        serverUrl = serverUrl.substring(0, serverUrl.length - 1);
                    return serverUrl;
                _ODataPath: function () {
                    return this._getServerUrl() + "/XRMServices/2011/OrganizationData.svc/";
                _errorHandler: function (req) {
                    return new Error("Error : " +
      req.status + ": " +
      req.statusText + ": " +
      JSON.parse(req.responseText).error.message.value);
                _dateReviver: function (key, value) {
                    var a;
                    if (typeof value === 'string') {
                        a = /Date\(([-+]?\d+)\)/.exec(value);
                        if (a) {
                            return new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
                    return value;
                Create: function (object, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 201) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send(JSON.stringify(object));
                Retrieve: function (id, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("GET", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 200) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                Update: function (id, object, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.setRequestHeader("X-HTTP-Method", "MERGE");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 204 || this.status == 1223) {
                                successCallback();
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send(JSON.stringify(object));
                Delete: function (id, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.setRequestHeader("X-HTTP-Method", "DELETE");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 204 || this.status == 1223) {
                                successCallback();
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                RetrieveMultiple: function (type, filter, successCallback, errorCallback) {
                    if (filter != null) {
                        filter = "?" + filter;
                    else { filter = ""; }
                    var req = new XMLHttpRequest();
                    req.open("GET", this._ODataPath() + type + "Set" + filter, true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 200) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d.results);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                __namespace: true
        </script>
        <script type="text/javascript">
            //Create Email and link it with Order as Regarding field
            var Xrm;
            var email = new Object();
            var ownerID = "";
            var CustomerId = "";
            if (window.opener) { Xrm = window.opener.Xrm; }
            else if (window.parent) { Xrm = window.parent.Xrm; }
            //Get ownerid who send email of quotation to customer
            function GetOwnerID() {
                var owner = Xrm.Page.getAttribute("ownerid").getValue();
                ownerID = owner[0].id;
                var ownerName = owner[0].name;
                var entityType = owner[0].entityType;
                GetToEmailGUID();
            //Get customerid who receive email of quotation from owner
            function GetToEmailGUID() {
                var Customer = Xrm.Page.getAttribute('customerid').getValue();
                CustomerId = Customer[0].id;
                var CustomerName = Customer[0].name;
                var entityType = Customer[0].entityType;
                //if CustomerId is type of "Account" then get Primary Contact id of that account
                if (entityType == "account") {
                    var contact = Xrm.Page.getAttribute("customerid").getValue();
                    if (contact === null) return;
                    var serverUrl = Xrm.Page.context.getClientUrl();
                    var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'" + contact[0].id + "')?$select=PrimaryContactId";
                    var req = new XMLHttpRequest();
                    req.open("GET", oDataSelect, false);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json;charset=utf-8");
                    req.onreadystatechange = function () {
                        if (req.readyState === 4) {
                            if (req.status === 200) {
                                var retrieved = JSON.parse(req.responseText).d;
                                CustomerId = retrieved.PrimaryContactId.Id;
                            else {
                                alert(this.statusText);
                    req.send();
            function CreateEmail() {
                GetOwnerID();
                email.Subject = "Email with Report Attachment";
                //Set The current order as the Regarding object
                email.RegardingObjectId = {
                    Id: Xrm.Page.data.entity.getId(),    //Get the current entity Id , here OrderId
                    LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
                //Create Email Activity
                SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
            // Email Call Back function
            function EmailCallBack(result) {
                email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
                var activityPartyFrom = new Object();
                // Set the From party of the ActivityParty to relate an entity with Email From field
                activityPartyFrom.PartyId = {
                    Id: CustomerId, //"79EBDD26-FDBE-E311-8986-D89D6765B238",  // id of entity you want to associate this activity with.        
                    LogicalName: "contact"
                // Set the "activity" of the ActivityParty
                activityPartyFrom.ActivityId = {
                    Id: result.ActivityId,
                    LogicalName: "email"
                // Now set the participation type that describes the role of the party on the activity).
                activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
                // Create the from ActivityParty for the email
                SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
                var activityPartyTo = new Object();
                // Set the From party of the ActivityParty to relate an entity with Email From field
                activityPartyTo.PartyId = {
                    Id: ownerID, //"79EBDD26-FDBE-E311-8986-D89D6765B238",  // id of entity you want to associate this activity with.        
                    LogicalName: "systemuser"
                // Set the "activity" of the ActivityParty  
                activityPartyTo.ActivityId = {
                    Id: result.ActivityId,
                    LogicalName: "email"
                // Now set the participation type that describes the role of the party on the activity).    
                activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
                // Create the from ActivityParty
                SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
            //ActivityParty From Callback
            function ActivityPartyFromCallBack(result) {
            //ActivityParty To Callback
            function ActivityPartyToCallBack(result) {
                GetReportId('ABM_Infotech_SalesQuote');
            //Create attachment for the created email
            function CreateEmailAttachment() {
                //get reporting session and use the params to convert a report in PDF
                var params = getReportingSession();
                //Email attachment parameters
                var activitymimeattachment = Object();
                activitymimeattachment.ObjectId = Object();
                activitymimeattachment.ObjectId.LogicalName = "email";
                activitymimeattachment.ObjectId.Id = email.ActivityId;
                activitymimeattachment.ObjectTypeCode = "email",
                    activitymimeattachment.Subject = "File Attachment";
                activitymimeattachment.Body = encodePdf(params);
                activitymimeattachment.FileName = "Report1.pdf";
                activitymimeattachment.MimeType = "application/pdf";
                //Attachment call
                SDK.JScriptRESTDataOperations.Create(activitymimeattachment, "ActivityMimeAttachment", ActivityMimeAttachmentCallBack, function (error) { alert(error.message); });
            //ActivityMimeAttachment CallBack function
            function ActivityMimeAttachmentCallBack(result) {
                var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
                var width = "800px";
                var height = "600px";
                window.open(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", features);
                // To open window which works in outlook and IE both
                //openStdWin(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", width,
    height, features);
            //This method will get the reportId based on a report name that will be used in            getReportingSession() function
            function GetReportId(reportName) {
                var oDataSetName = "ReportSet";
                var columns = "ReportId";
                var filter = "Name eq '" + reportName + "'";
                retrieveMultiple(oDataSetName, columns, filter, onSuccess);
            function retrieveMultiple(odataSetName, select, filter, successCallback) {
                var serverUrl = Xrm.Page.context.getServerUrl();
                var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
                var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "?";
                if (select) {
                    odataUri += "$select=" + select + "&";
                if (filter) {
                    odataUri += "$filter=" + filter;
                $.ajax({
                    type: "GET",
                    contentType: "application/json; charset=utf-8",
                    datatype: "json",
                    url: odataUri,
                    beforeSend: function (XMLHttpRequest) {
                        XMLHttpRequest.setRequestHeader("Accept", "application/json");
                    success: function (data) {
                        if (successCallback) {
                            if (data && data.d && data.d.results) {
                                successCallback(data.d.results);
                            else if (data && data.d) {
                                successCallback(data.d);
                            else {
                                successCallback(data);
                    error: function (XmlHttpRequest, errorThrown) {
                        if (XmlHttpRequest && XmlHttpRequest.responseText) {
                            alert("Error while retrieval ; Error – " + XmlHttpRequest.responseText);
            function onSuccess(data) {
                reportId = data[0].ReportId.replace('{', ").replace('}', ");
                CreateEmailAttachment(); // Create Email Attachment
            //Gets the report contents
            function getReportingSession() {
                var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
                var retrieveEntityReq = new XMLHttpRequest();
                var Id = Xrm.Page.data.entity.getId();
                var quotationGUID = Id.replace('{', ""); //set this to selected quotation GUID
                quotationGUID = quotationGUID.replace('}', "");
                var reportName = "ABM_Infotech_SalesQuote"; //set this to the report you are trying to download
                var reportID = "751089AA-74B8-E211-B52F-D8D3855B253B"; //set this to the guid of the report you are trying to download
                var rptPathString = ""; //set this to the CRMF_Filtered parameter
                var strParameterXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='quote'><all-attributes /><filter type='and'><condition
    attribute='quoteid' operator='eq' uitype='quote' value='" + quotationGUID + "' /> </filter></entity></fetch>";
                retrieveEntityReq.open("POST", pth, false);
                retrieveEntityReq.setRequestHeader("Accept", "*/*");
                retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                rptPathString = "id=%7B" + reportID + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName="
    +
                                reportName + "&isScheduledReport=false&p:ABMFilteredQuote=" + strParameterXML;
                //remove the part starting from &p:salesorderid if your report has no parameters
                retrieveEntityReq.send(rptPathString);
                var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
                var ret = new Array();
                ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
                x = retrieveEntityReq.responseText.indexOf("ControlID=");
                ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
                return ret;
            var bdy = new Array();
            var bdyLen = 0;
            function concat2Bdy(x) {
                bdy[bdyLen] = x;
                bdyLen++;
            function encodePdf(params) {
                bdy = new Array();
                bdyLen = 0;
                var retrieveEntityReq = new XMLHttpRequest();
                var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] +
                "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] +
                "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
                retrieveEntityReq.open("GET", pth, false);
                retrieveEntityReq.setRequestHeader("Accept", "*/*");
                retrieveEntityReq.send();
                BinaryToArray(retrieveEntityReq.responseBody);
                return encode64(bdy);
            var StringMaker = function () {
                this.parts = [];
                this.length = 0;
                this.append = function (s) {
                    this.parts.push(s);
                    this.length += s.length;
                this.prepend = function (s) {
                    this.parts.unshift(s);
                    this.length += s.length;
                this.toString = function () {
                    return this.parts.join('');
            var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
            function encode64(input) {
                var output = new StringMaker();
                var chr1, chr2, chr3;
                var enc1, enc2, enc3, enc4;
                var i = 0;
                while (i < input.length) {
                    chr1 = input[i++];
                    chr2 = input[i++];
                    chr3 = input[i++];
                    enc1 = chr1 >> 2;
                    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
                    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
                    enc4 = chr3 & 63;
                    if (isNaN(chr2)) {
                        enc3 = enc4 = 64;
                    } else if (isNaN(chr3)) {
                        enc4 = 64;
                    output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
                return output.toString();
        </script>
        <script type="text/vbscript">
        Function BinaryToArray(Binary)
               Dim i
               ReDim byteArray(LenB(Binary))
               For i = 1 To LenB(Binary)
                     byteArray(i-1) = AscB(MidB(Binary, i, 1))
                     concat2Bdy(AscB(MidB(Binary, i, 1)))
             Next
              BinaryToArray = byteArray
       End Function     
        </script>
    </head>
    <body>
        <input type="button" onclick="CreateEmail();" value="Attach Report" />
    </body>
    </html>

  • When I forward an HTML email with embedded graphics to someone, it forwards it as plain text.. this is driving me batty.. how do I forward such mails INTACT??

    I have the latest Thunderbird installed on a new 64-bit Winblows Eight netbook.. fantastic program, but one problem is driving me absolutely batty, and after using the latest Thunderbird for weeks, I simply can't figure out how to fix it..
    I'm on a lot of mfr. and other kinds of mailing lists, like eBay watch list alerts, and so on.. these are not s p a m (although I get plenty of that.. who doesn't).. but lists I WANT to be on..
    Many such emails from those mailing lists are in HTML format with embedded graphics.. I'm not talking about graphic file attachments, but embedded graphics which are coming from the senders' servers, and appear AS a graphic in the email.. sometimes such emails are one huge graphic with hardly any text.. all well and good..
    However, here's the problem.. when I want to forward such an email to a friend, Thunderbird ALWAYS formats it as plain ASCII text.. I know this because I look in the "sent mail" folder, and can see that it has turned an HTML email with embedded graphics into plain ASCII text..
    I absolutely can't figure out how to get it to forward an HTML email with embedded graphics INTACT, so the sender receives it looking the way it looks when I receive it from a mailing list, or an advertiser, or eBay, or whoever..
    Is Thunderbird capable of forwarding an HTML email with embedded graphics INTACT?.. If so, how / where do I turn on that capability?..
    If the capability to do this isn't built into the program, is there an add-on I can install that will give it that ability?..
    I am not new to computers.. but this really has me stumped.. I want to put Thunderbird on my 32-bit Vista laptop and stop using its horrible "Windoze Mail" program, which I've been using for years, and is slower than snot, and has all kinds of other problems..
    So, assuming whoever reads this FULLY understands my question, PLEASE tell me how to get Thunderbird to have the ability to forward an HTML email with embedded graphics AS-IS, so the receiver(s) I forward it to see it exactly the way I see it when I receive it.. if that ability is built in, please tell me how to turn it on.. if that ability is not built-in, please tell me what add-on I need to install to give Thunderbird this capability.. if Thunderbird absolutely can't forward an HTML email with embedded graphics at all, please also tell me that..
    A virtual box of candy and a dozen long-stemmed roses to anyone who can give me a solution that works..
    Thanks..

    Dear Mr. Toad (my all-time favorite ride at Disneyland ;-) ..
    Thanks so much for your detailed reply.. my netbook is in the bedroom, turned off.. I (so far) only use it in the evening, in the bedroom.. I've saved your response, and will try your suggestions, and let you know if they solve the problem I described. I really appreciate you taking the time to post such a detailed reply..
    I can't answer your Thunderbird "configuration" questions, because I'm in the living room, using the crap Vista laptop, on which I plan to install Thunderbird, and then take Windoze Mail out in the street and drive over it a few times.. I'll get back to you one way or the other, and let you know if your instructions solved the problem, or not..
    I don't understand why Thunderbird "out of the box", so to speak, simply doesn't forward HTML emails with embedded graphics, (like Outlook Excess, and Winblows Mail do).. without having to go through those steps. I personally HATE HTML email, but over the years, it's become more and more prevelant.. so it's a problem I must fix..
    Thanks again..
    Harv..

  • Issue in sending the email with XL attachment in ECC version

    Hi,
    I have an issue with sending the email with XL attachment. My program is sending a mail to the receiver with XLS as attachment. Recently we have migrated from 4.6B to ECC version. Same code was worked in 4.6B.But it is not working in ECC version.When i try to open the attachment, i get a Dialog Box with the following message
    "The file is not in a recognizable format.
    1. if you know the file is from another program whih is incompatible with Microsoft excel,click cancel,then open this file in its original application
    2.If you suspect the file is damaged, click help for more information about solving theproblem.
    3.if you still want to see what text is contained in the file, click OK.Then click the text import wizard. "
    when i click OK, the excel sheet is opening with all required data.
    Can anyone kindly tell me why this is happening.
    I am also attaching part of the coding related to this requirement.
    *&      Form  BUILD_XLS_DATA_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM build_xls_data_table.
      DATA: w_total(13),
      w_clabs(13),
      w_cinsm(13),
      w_ceinm(13),
      w_cretm(13),
      w_cspem(13),
      w_cumlm(13),
      w_exp_date(8),
      w_v_totalp(13),
      w_min_rem(8),
      w_ersda(10),
      w_hsdat(10),
      w_vfdat(10),
      w_ship_date(10),
      w_plnmg(13),
       w_mhdrz(4).
      CLEAR: w_total, w_clabs, w_cinsm, w_ceinm, w_cspem, w_exp_date,
      w_v_totalp, w_min_rem, w_ersda, w_hsdat, w_vfdat, w_ship_date,
      w_plnmg, w_mhdrz.
      w_total = it_batch1-total.
      w_clabs = it_batch1-clabs.
      w_cinsm = it_batch1-cinsm.
      w_ceinm = it_batch1-ceinm.
      w_cspem = it_batch1-cspem.
      w_cumlm = it_batch1-cumlm.
      w_cretm = it_batch1-cretm.
      w_exp_date = it_batch1-exp_date.
      w_v_totalp = it_batch1-v_totalp.
      w_min_rem = it_batch1-min_rem.
      w_plnmg = it_batch1-plnmg.
      w_mhdrz = it_batch1-mhdrz.
      CONCATENATE it_batch1-ersda6(2) it_batch1-ersda4(2)
                  it_batch1-ersda+0(4) INTO w_ersda SEPARATED BY '.'.
      CONCATENATE it_batch1-hsdat6(2) it_batch1-hsdat4(2)
                  it_batch1-hsdat+0(4) INTO w_hsdat SEPARATED BY '.'.
      CONCATENATE it_batch1-vfdat6(2) it_batch1-vfdat4(2)
                  it_batch1-vfdat+0(4) INTO w_vfdat SEPARATED BY '.'.
      CONCATENATE it_batch1-ship_date6(2) it_batch1-ship_date4(2)
                  it_batch1-ship_date+0(4) INTO w_ship_date SEPARATED BY '.'
      CONCATENATE
      it_batch1-werks it_batch1-mtart it_batch1-matnr it_batch1-maktg
    it_batch1-prdha it_batch1-prctr it_batch1-ktext  it_batch1-dispo
      it_batch1-charg it_batch1-lgort it_batch1-herkl w_clabs
      w_cinsm w_ceinm w_cretm w_cspem
      w_cumlm w_total  it_batch1-meins  it_batch1-v_spr_unit
      w_v_totalp it_batch1-waers w_plnmg  it_batch1-meins
      w_ersda w_hsdat w_vfdat  w_exp_date
       w_ship_date  w_mhdrz  w_min_rem it_batch1-zlifer
       it_batch1-doknr it_batch1-dokar it_batch1-doktl  it_batch1-dokvr
               INTO L_STRING SEPARATED BY CON_TAB.
                  INTO l_string SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      WHILE l_string <> space.
        CALL FUNCTION 'TEXT_SPLIT'
          EXPORTING
            length       = 255
            text         = l_string
            as_character = 'X'
          IMPORTING
            line         = it_attach
            rest         = l_string.
        IF l_string = space.
       CONCATENATE IT_ATTACH CON_CRET INTO IT_ATTACH.
          CONCATENATE it_attach cl_abap_char_utilities=>cr_lf INTO it_attach.
          APPEND it_attach.
          CLEAR it_attach.
        ELSE.
          APPEND it_attach.
          CLEAR it_attach.
        ENDIF.
      ENDWHILE.
    move l_string to it_attach .
    CONCATENATE it_attach cl_abap_char_utilities=>cr_lf INTO it_attach.
    APPEND it_attach.
    CLEAR it_attach.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          text
    -->  p1        text
    <--  p2        text
    FORM send_file_as_email_attachment.
      DATA:w_length TYPE i.
      DATA:  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,
              t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    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 = text-034 .
    w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
    DESCRIBE TABLE it_attach LINES w_cnt.
      DESCRIBE TABLE it_message LINES w_cnt.
      READ TABLE it_message INDEX w_cnt.
    w_length = STRLEN( it_attach ).
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_message ).
      w_doc_data-obj_langu  = sy-langu.
    w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = text-034.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_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.
    ***Start of changes by 501507008 on 29.01.2009
      t_packing_list-obj_descr  = 'MAIL BODY'.
    ***End of changes by 501507008 on 29.01.2009
      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   =  'XLS'.
      t_packing_list-obj_descr  =  text-034.
      t_packing_list-obj_name   =  'filename'.
      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.
      LOOP AT it_adr6.
        t_receivers-receiver = it_adr6-smtp_addr.
        t_receivers-rec_type = 'U'.
        t_receivers-com_type = 'INT'.
        t_receivers-notif_del = 'X'.
        t_receivers-notif_ndel = 'X'.
        APPEND t_receivers.
      ENDLOOP.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
         document_data              = w_doc_data
         put_in_outbox              = 'X'
         sender_address             = ' '
         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.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                    = w_doc_data
         put_in_outbox                    = 'X'
      commit_work                      = ' '
    IMPORTING
      sent_to_all                      =
      new_object_id                    =
    tables
            packing_list               = t_packing_list
            contents_bin               = t_attachment
            contents_txt               = it_message
            receivers                  = t_receivers
      contents_hex                     =
      object_para                      =
      object_parb                      =
       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.
      ENDIF.
    ENDFORM.                    " SEND_FILE_AS_EMAIL_ATTACHMENT

    Hi,
    could you tell me which opeion should i select in SCOT under INT node. I have tried with diffrent options. but no luck.
    SAPscript/Smart Forms  - No Conversion
    ABAP List                     - No Conversion
    Business Object/Link     - No Conversion
    RAW Text                     - No Conversion

Maybe you are looking for

  • Quicktime seems to be out of date

    But when I click the UPDATE button, it tells me Quicktime data from Server invalid. How do I fix this?

  • BMM Join logic needed

    Hi, In my BMM, I have two dimension tables(Plan Dim, Stage Dim) and one fact table(Combine fact). Currently I have all my joins to be an inner join, in the source of my fact. (which is producing wrong results). This is what I am trying to accomplish.

  • How to install persian(IRAN) language in ECC 6.0

    Dear Friends, How to install persian language in ECC 6.0 What are different steps IS ECC 6.0 suport to persian language (IRAN) or not, if not then which is closed language for persian Thanks , Regards, SachI

  • Error while installing patches

    I installed Sneak Preview (sp9) and tried to use sdm to ins ltall patches.. There are errors coming up .. I tried to inst sp12 patches i think... WHat all i should do to check the errors? should i install sp 10 sp 11 b4 going for sp12? How can i trou

  • DRM 11.1.2.1 application won't start

    Hi, I just recently installed DRM 11.1.2.1 and trying to start an application. I've successfully created the repository. However I noticed that no application was showing when trying to access through the Web client. Here's the error Oracle.DataAcces