Email Archived PDF

I have a requirement to retrieve archived SD Invoices (stored as PDFs) and email them as a PDF attachment. I am using FM 'ARCHIVOBJECT_GET_TABLE' to retrieve the PDF, which works successfully. But, when I use FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to email the PDF it is unsuccessful.
FM 'ARCHIVOBJECT_GET_TABLE'  returns two tables ARCHIVOBJECT and BINARCHIVOBJECT , I am not sure which one I should use as  input for  FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' . ARCHIVOBJECT and BINARCHIVOBJECT  are not size compatible with the corressponding Table Parameter in FM  'SO_NEW_DOCUMENT_ATT_SEND_API1'  - is a conversion required?
Sample code would be appreciated.
thanks,
Con.

Hi Vijay,
I am assuming I use the itab returned by FM 'ARCHIVOBJECT_GET_TABLE' Tables  Parameter BINARCHIVOBJECT  as input for Tables Parameter BINARY_TAB for FM 'SCMS_BINARY_TO_XSTRING' - is this right?
Do I pass one line at a time from BINARCHIVOBJECT itab (lines defined as RAW 1024) to FM 'SCMS_BINARY_TO_XSTRING' ?
Do I set the Exporting Parameter INPUT_LENGTH of  FM 'SCMS_BINARY_TO_XSTRING' to 255?
Do I assigned the binary to xstring converted itab to FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' Tables Parameter contents_bin or contents_hex?
Do you have sample code of this?
thanks,
Con.

Similar Messages

  • PDF email archives: How to selectively re-export to new archive/.pst?

    A while back, I made PDF email archives of a variety of Outlook folders, and eventually deleted the Outlook messages in question.
    Now, unfortunately, I am wishing I had not.  So, a few "save the day" type of questions:
    1) Can I convert an entire PDF email archive, or portions of an archive, back into Outlook format?  How?  (If you know the answer to this, ignore the rest!)
    2) Can I selectively search a PDF email archive, and then group-export the messages displayed in the search results into a separate PDF email archive? How?  I can manage to use the filters to select a group of messages, but I can't manage to re-export them to a new archive or a PDF portfolio.
    thanks,
    Erik

    It cannot be done in InDesign, but, as you surmised in Acrobat.
    You'll need to ask in the Acrobat forums. I don't know of any changes like that in Acrobat DC but because I don't program in JavaScript, I might have overlooked it. Try one of these forums:
                                 Creating, Editing & Exporting PDFs                        
                                 Rich Media & 3D                        

  • Archived PDF could not be opened after downloaded to PC

    Hi
    I am using FM ARCHIVOBJECT_GET_TABLE to get archived PDF into internal table and then using METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD to download this to PC.
    Now when I try to open this PDF, it gives some error.  Error reads
    Adobe reader could not open "file.pdf" because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)
    This was working fine in non unicode 4.7 system, but is not working after upgrade to unicode ECC 6.0 system.
    The code is as follows,
    *   Get document from archive
        CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'
          EXPORTING
            ARCHIV_ID                      = l_archiv_id
            DOCUMENT_TYPE                  = l_document_type
            ARCHIV_DOC_ID                  = l_archiv_doc_id
          IMPORTING
            LENGTH                         = l_sapb_length
          TABLES
            ARCHIVOBJECT                   = lt_tab
          EXCEPTIONS
            ERROR_ARCHIV                   = 1
            ERROR_COMMUNICATIONTABLE       = 2
            ERROR_KERNEL                   = 3
            OTHERS                         = 4.
       CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
          EXPORTING
            BIN_FILESIZE              = l_length
            FILENAME                  = l_filename
            FILETYPE                  = l_filetype
          CHANGING
            DATA_TAB                  = lt_tab
          EXCEPTIONS
            FILE_WRITE_ERROR          = 1
            NO_BATCH                  = 2
            GUI_REFUSE_FILETRANSFER   = 3
    Do we have to change any parameters or anything for unicode system?

    Is the filetype declared as 'BIN' in download?

  • 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>

  • Can't send a PAGES document Via email in PDF form ... used to be done by clicking share and PDF  HELOP

    creating a document on pages and trying to share it via email in PDF form used to be really easy...
    How does this work now?  help

    I always just do file->print. Then in the lower left is a menu that said "PDF" and just pick "Mail PDF" from the dropdown and a new email is composed with the PDF attached. One step to print, one click to choose mail and you're done. I just tried this on the latest Yosemite and Pages updates and it works fine.

  • How can I email several pdf files in one email?

    HOw can I email several pdf files in one email?

    You have to use 3rd party apps like GoodReader.

  • Can I search email archive on iCloud server from iOS device, or can I only search what it has downloaded locally?

    Can I search email archive on iCloud server from iOS device, or can I only search what it has downloaded locally?
    I currently have an iPhone and iPad, and am soon changing over to a Mac. When that happen I'd like to try to see what I can migrate over from the Google ecosystem to the iCloud ecosystem.
    1) Currently I have the Gmail iOS app (a webapp container) that can search server-side of several years of email archive.  Can iCloud do this using the iOS native mail application?  Or is the search just limited to what the device has downloaded locally?
    2) Do I have to use a @me.com address for the full iCloud email sync to take place between server, Mac, and iOS devices?
    Believe it or not I've read quite a bit about the iCloud services, but the answers to these questions were far from clear.  Many thanks for the help.

    2)  iCloud only syncs email between .me/.mac addresses.  For other accounts like google, you set up the account in the mail app and if they're IMAP accounts, you can sync between the google server and any devices you have defined that account on.
    I'm not absolutely sure about 1) since I haven't had to search going back years - I use MailSteward for that on the mac.  On my iPhone/iPad, when I go into a mailbox and the emails are not immediately available, it downloads them.  I suspect for a search, you need the emails downloaded.

  • How do I add text message to this email with PDF attachment?

    Good day, everyone!
    Okay, we have a "z"-version of program RFFOUS_T and some of its include codes.  One include code, RFFORIO6, has a form called MAIL_PDF_ADVICE.  It is in this form that we are emailing a remittance advice form.  The actual form is attached as a PDF file.
    Unfortunately, there's no text in the body of the email -- it's just the attachment -- so the users would like us to add a couple basic lines in the body of the email that explain the attachment.  I'm pretty new to using this particular FM and emailing the PDF attachment, and I've gotten stuck in my research trying to find out exactly how to do this.  I'm guessing this shouldn't be all that difficult, but I'm not finding the right solution.  Here's the form:
    *&      Form  mail_pdf_advice
          E-mail PDF advice
         -->IT_ADVICE     PDF form (output from Adobe server)
         -->I_PDF_LEN     length of PDF advice in bytes
    FORM mail_pdf_advice USING it_advice   TYPE solix_tab
                               i_pdf_len   TYPE i.
      DATA:
        lt_receivers       TYPE TABLE OF somlreci1 WITH HEADER LINE,
        l_user             LIKE soextreci1-receiver,
        ls_send_doc        LIKE sodocchgi1,
        lt_pdf_attach      TYPE TABLE OF sopcklsti1 WITH HEADER LINE.
      CHECK NOT finaa-intad IS INITIAL.
      CHECK finaa-nacha EQ 'I'.
    *--- determine E-Mail sender and recipient
      IF fsabe-usrnam EQ space.
        l_user = sy-uname.
      ELSE.
        l_user = fsabe-usrnam.         "Office-User des Sachbearb.
      ENDIF.
      lt_receivers-receiver = finaa-intad.
      lt_receivers-rec_type = 'U'.      "E-mail address
      APPEND lt_receivers.
      ls_send_doc-obj_descr =  itcpo-tdtitle.
      lt_pdf_attach-transf_bin = 'X'.
      lt_pdf_attach-doc_type   = 'PDF'.
      lt_pdf_attach-obj_langu  = reguh-zspra.
      lt_pdf_attach-body_start = 1.
      lt_pdf_attach-doc_size   = i_pdf_len.
      DESCRIBE TABLE it_advice LINES lt_pdf_attach-body_num.
      APPEND lt_pdf_attach.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = ls_send_doc
          sender_address             = l_user
        TABLES
          packing_list               = lt_pdf_attach
          contents_hex               = it_advice
          receivers                  = lt_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.
    <error checking code snipped>
    Does someone know how to do this?  <b><REMOVED BY MODERATOR></b>  Thanks so much in advance!
    Dave
    Message was edited by:
            Alvaro Tejada Galindo

    Hi Dave,
    Table <b>contents_bin</b> is used to pass attachment file and <b>contents_txt</b> is used to pass mail body contents. You need to declare one more int table to give contents for mail body.
    For reference check the code below
    ut_message is for message body
    and ut_attach is having attachement file.
      FORM send_file_as_email_attachment TABLES ut_message
                                              ut_attach
                                        USING uv_email
                                              uv_mtitle
                                              uv_format
                                              uv_filename
                                              uv_attdescription
                                              uv_sender_address
                                              uv_sender_addres_type
                                     CHANGING uc_error
                                              uc_reciever.
      DATA:  l_error                TYPE  sy-subrc,
             l_reciever             TYPE  sy-subrc,
             l_mtitle               LIKE  sodocchgi1-obj_descr,
             l_email                LIKE  somlreci1-receiver,
             l_format               TYPE  so_obj_tp ,
             l_attdescription       TYPE  so_obj_nam ,
             l_attfilename          TYPE  so_obj_des ,
             l_sender_address       LIKE  soextreci1-receiver,
             l_sender_address_type  LIKE  soextreci1-adr_typ,
             l_receiver             LIKE  sy-subrc.
      DATA:   lt_packing_list    LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
              lt_contents        LIKE solisti1   OCCURS 0 WITH HEADER LINE,
              lt_receivers       LIKE somlreci1  OCCURS 0 WITH HEADER LINE,
              lt_attachment      LIKE solisti1   OCCURS 0 WITH HEADER LINE,
              lt_object_header   LIKE solisti1   OCCURS 0 WITH HEADER LINE,
              l_cnt TYPE i,
              l_sent_all(1) TYPE c,
              lw_doc_data LIKE sodocchgi1.
      l_email               = uv_email.
      l_mtitle              = uv_mtitle.
      l_format              = uv_format.
      l_attdescription      = uv_attdescription.
      l_attfilename         = uv_filename.
      l_sender_address      = uv_sender_address.
      l_sender_address_type = uv_sender_addres_type.
    Fill the document data.
      lw_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      lw_doc_data-obj_langu = sy-langu.
      lw_doc_data-obj_name  = 'SAPRPT'.
      lw_doc_data-obj_descr = l_mtitle.
      lw_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR lw_doc_data.
      READ TABLE ut_attach INDEX l_cnt.
      lw_doc_data-doc_size =
         ( l_cnt - 1 ) * 255 + STRLEN( ut_attach ).
      lw_doc_data-obj_langu  = sy-langu.
      lw_doc_data-obj_name   = 'SAPRPT'.
      lw_doc_data-obj_descr  = l_mtitle.
      lw_doc_data-sensitivty = 'F'.
      CLEAR lt_attachment.
      REFRESH lt_attachment.
      lt_attachment[] = ut_attach[].
    Describe the body of the message
      CLEAR lt_packing_list.
      REFRESH lt_packing_list.
      lt_packing_list-transf_bin = space.
      lt_packing_list-head_start = 1.
      lt_packing_list-head_num = 0.
      lt_packing_list-body_start = 1.
      DESCRIBE TABLE ut_message LINES lt_packing_list-body_num.
      lt_packing_list-doc_type = 'RAW'.
      APPEND lt_packing_list.
    Create attachment notification
      lt_packing_list-transf_bin = 'X'.
      lt_packing_list-head_start = 1.
      lt_packing_list-head_num   = 1.
      lt_packing_list-body_start = 1.
      DESCRIBE TABLE lt_attachment LINES lt_packing_list-body_num.
      lt_packing_list-doc_type   =  l_format.
      lt_packing_list-obj_descr  =  l_attdescription.
      lt_packing_list-obj_name   =  l_attfilename.
      lt_packing_list-doc_size   =  lt_packing_list-body_num * 255.
      APPEND lt_packing_list.
    Add the recipients email address
      CLEAR lt_receivers.
      REFRESH lt_receivers.
      lt_receivers-receiver = l_email.
      lt_receivers-rec_type = 'U'.
      lt_receivers-com_type = 'INT'.
      lt_receivers-notif_del = 'X'.
      lt_receivers-notif_ndel = 'X'.
      APPEND lt_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = lw_doc_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = l_sent_all
        TABLES
          packing_list               = lt_packing_list
          contents_bin               = lt_attachment
          contents_txt               = ut_message
          receivers                  = lt_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.
    Message was edited by:
            Amit Kumar

  • How can I get a search bar added to my email archives screen to make it easier to search for the right archives folder, Samsung has one so I was surprised to see that I have to scroll up and down to find the right folder?

    How can I get a search bar added to my email archives screen to make it easier to search for the right archives folder, Samsung has one so I was surprised to see that I have to scroll up and down to find the right folder?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    You can modify the pref <b>keyword.URL</b> on the <b>about:config</b> page to use Google's "I'm Feeling Lucky" or Google's "Browse By Name".
    * Google "I'm Feeling Lucky": http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=
    * Google "Browse by Name": http://www.google.com/search?ie=UTF-8&sourceid=navclient&gfns=1&q=
    * http://kb.mozillazine.org/keyword.URL
    * http://kb.mozillazine.org/Location_Bar_search

  • My HP Officejet 8500a All-In-One forwards faxes (as a tiff file) to my iphone.  Can only view/receive 1st page, embedded into email as a non-attachment.  Iphone receives email(s) pdf attachments well.  What can I do?

    My HP Officejet 8500a All-In-One forwards faxes (as a tiff file) to my iphone.  Can only view/receive 1st page, embedded into email as a non-attachment.  Iphone receives email(s) pdf attachments well.  What can I do?

    Try this app
    http://itunes.apple.com/us/app/fax-reader/id406902152?mt=8

  • Since the update I can no longer open a link from an email opened PDF file. I could prior to update

    Since the update I can no longer open a link from an email opened PDF file. I could prior to update

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased.
     Cheers, Tom

  • My iPad 2 is shutting down when I try to email a PDF created in pages. Why? Very frustrating...., My iPad 2 is shutting down when I try to email a PDF created in pages. Why? Very frustrating....

    My iPad 2 is shutting down when I try to email a PDF I have created in pages. Why? Very frustrating....

    That is very interesting in that my iPhone was exhibiting similar behavior with the "blue screen of death" with Pages a few months ago. An update for Pages came out and when I installed the update, the problem disappeared.
    Is Pages completely updated on your iPad? Do you use iCloud with Pages? If you use iCloud, try turning it off. settings>Pages>Use iCloud>Off. You will not lose your documents since they will still be in iCloud even if you turn that off on your iPad.

  • Why can't I email a pdf file from Acrobat XI Standard?

    Whenever I try to email a pdf file from Acrobat XI Standard, nothing happens. Outlook 2007 is my default
    email program. I have checked the preferences to be sure that Outlook is checked as default, and it is,
    but when I click on the email icon or select email from the dropdown menu, nothing happens. This is
    so frustrating. I hope someone can help me solve this problem.

    Be sure that MAPI is properly active in your Outlook. I am not an Outlook user, but that is what is needed.

  • I'm using iphone 4S, and I can not open PDF file only from my husband email that using Mic outlook. It was very weird because I can received other email with pdf file from other people. can someone help.

    I'm using iphone 4S and ipad mini, and I can not open PDF file only from my husband email that using Mic outlook. It was very weird because I can received other email with pdf file from other people. Can someone help...
    Thanks in advance

    Hi Eidda,
    This may because the attachment is a winmail.dat file. I would recommend taking a look at the article below for more information. Note: the article is written for OS X mail, but does also apply to this situation.
    Mac OS X Mail: What is a winmail.dat attachment?
    http://support.apple.com/kb/HT2614
    -Griff W.

  • PO- Output to the PO creators by email in pdf

    Hi ALL,
    we have a requirement is to have the PO- Output  to the PO creators by email in pdf. Format.  how can we acheive this requirement , what is the partner function can be used for person who creates PO , where can we maintian his eamil ID .
    please advise.
    Regards,
    Amara.

    hi
    You need to do some configuration for this.
    u2022     Go to NACE.
    u2022     Select EF and click on OUTPUT TYPES.
    u2022     Then select Output Type NEU and click on processing routines .
    u2022     In that you have to add a new entry - medium 5 .
    u2022     Then you need to assign a program, form routine and form.
    u2022     You can use the standard program i.e. SAPFM06P, FORM routine is always ENTRY_NEU and standard MEDRUCK.
    u2022     Then in PARTNER FUNCTION you need to add a new entry : medium - 5 and function - VN .
    u2022     For subject of the mail go to Mail Title and Texts. In title give PO No. &EKKO-EBELN& .
    u2022     Under General data -> Replacement of text symbols give programme as SAPMM06E and Form Routine as TEXT_SYMBOL_REPLACE.
    u2022     Now the subject will be PO No. 1800004202.
    u2022     You need to maintain your email id in tcode SU01 and also the vendor's email id.
    u2022     Now while creating a new purchase order , change the medium to External Send .
    u2022     Then goto Communication Method and select CS01. ALSO make sure that the Cover Page Text has value PO No. &EKKO-EBELN& .
    u2022     Goto tcode ME9F .
    u2022     Execute.
    u2022     Select the checkbox and click on Output Message.
    u2022     You will get a message MAII 00000000000001 generated .
    u2022     Use note no 191470
    now to get the po in pdf u hav eto go to SCOT and here in internet tab maintain SAPscript/Smart Forms PDF
    regards
    KI

Maybe you are looking for

  • Foreign Characters in Windows Vista AutoPlay Dialog Box

    I have an iPhone 3G, using Vista. Upgraded to iTunes 8 (really like the changes so far), and also upgraded to 2.1 (so far so good), but have found a strange behavior when I connect my iPhone to my computer. I have searched the forums and have not fou

  • UIX page not displaying data from VO's

    I have an application where my users log in by passing a username/password to a client method in my application module. The Webusers View Object has a view link to the Customers view object, which has a view link to the Orders view object, which has

  • How do I play just 1 song on the iPhone / Making Playlists on iPhone?

    Is it possible to just pick 1 song and play that and nothing after it? It always wants to play another song after the one I choose. Also - What is the 'On the go' playlist for and does it sync to iTunes? Lastly - Is it possible to make playlists on t

  • Calling RFC placed in PI from Portal

    Dear All, We have a scenario where we have RFCs in ECC and it has to be called from Portal through PI. Please suggest the possible and easiest ways. Please note these RFC are already being called from Portal to ECC directly. So we need to change it b

  • Spanish Manual for SAP GRC AC 5.3

    Hello, I want to know if someone has an spanish manual for SAP GRC AC 5.3 for the 4 modules (RAR, SPM, CUP & ERM). Or if someone knows a link to get them. I need them. Thank you in advance. Best Regards. Pablo mortera.