FILE- EMAIL with pdf as an attachment and message body.
I have a scenario where FILE to EMAIL with PDF as an attachment; I also need to send to have Email body with some text. For this i have tried using Mail Package then i wont be receiving any attachment. If I use both Mail package + Keep attachments i do not see any attachments in mail.
Let me know the possible ways that can used in the current scenario where i need to send pdf attachment along with messsage body.
Thanks in advance,
nik
Hi Nik
To get the customized email body you need to use the Mail package. Keep attachments tab should be selected
Now sending PDF attachment - Do you need to send data passed by File adapter as pdf attachment or File adapter is reading message other than this attachment.
Case 1. File adapter send message that you need to send as email attachment. Then using mail package use
<content_type>application/pdf</content_type>
you can even add name of the file going as an attachment.
<content_type>application/pdf;name="filename.pdf"</content_type>
Secondly you can use the MessageTransformBean at communication channel as an additional standard module.
Case2: You need to pick file from file adapter as attachment. that is possible only when you use NFS with this file you read as source and attachment has be of same name type eg: you read input.txt then attachment has to be input.pdf
Thanks
Gaurav
Edited by: Gaurav Bhargava on Oct 7, 2008 5:46 AM
Similar Messages
-
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> -
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 advanceHi 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. -
Sending an email with pdf attachment in Ecc6
we were in 4.6 c and recentely upgraded to ECC6. we have a program which we are sending email with pdf attachments. now it is breaking, we are able to display the pdf in the screen, but once it became the attachment , it is not going.
we are running the program in forground and not reading the spool and sending it. any ideahttp://www.sap-img.com/abap/sending-email-with-attachment.htm
Sending mail to an external maild with PDF attachment.
Creating a PDF attachment and send it via Email
Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface
How to send a ttachment with email.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap-Sendthespooldatatoanemail+address.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/convertSpoolrequesttoPDFandsendase-mail
Friend just have a look in the forum itself, there are many posts for ur query, you definetly get exact solution no need to wait for answers/solutions.
All the best -
Custome FM to create Email with PDF attachment
Hi Experts,
I am working in Smart form. my requriment is to create a Custom Function module , for sending email with PDF attachment to the customer. PDF is nothing but which ever I create smart form.
How can I approach , please give me a suggestion or send me a sample code, if any one create.
1. This FM should work like : convert form to PDF and send Email to particular customer.Hi,
Steps to convert Smartform to PDF,
1 Call smartform through FM SSF_FUNCTION_MODULE_NAME.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
2 Converting Smartform to OTF and in turn to PDF
Set Following parameter in order to convert Smartform into OTF.
gs_cparam-no_dialog = 'X'. " Suppressing the dialog box
gs_cparam-preview = 'X'. " for print preview
gs_cparam-getotf = 'X'. " To get Output in OTF
CALL FUNCTION g_fmodule
EXPORTING
control_parameters = gs_cparam
output_options = gs_outoptions
IMPORTING
job_output_info = gt_otf_from_fm
TABLES
gt_final = gt_final
gt_otf[] = gt_otf_from_fm-otfdata [].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = g_bin_filesize
TABLES
otf = gt_otf
lines = gt_pdf_tab
CHECK sy-subrc = 0.
g_bin_filesize = g_bin_filesize + 1.
Transfer the 132-long strings to 255-long strings
LOOP AT gt_pdf_tab into gs_pdf_tab.
TRANSLATE gs_pdf_tab USING ' ~'.
CONCATENATE g_buffer gs_pdf_tab INTO g_buffer.
ENDLOOP.
TRANSLATE g_buffer USING '~ '.
DO.
gs_mess_att = g_buffer.
APPEND gs_mess_att to gt_mess_att.
SHIFT g_buffer LEFT BY 255 PLACES.
IF g_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
3 For Sending Mail use following mail,
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_doc_data
put_in_outbox = 'X'
sender_address = l_sender_address
sender_address_type = l_sender_address_type
commit_work = 'X'
TABLES
packing_list = lt_packing_list
contents_bin = lt_attachment
contents_txt = lt_message
receivers = lt_receivers
I hope this could help you,
Please let me know if any issue.
Thanks & regards,
ShreeMohan
Edited by: ShreeMohan Pugalia on Jul 18, 2009 8:02 AM
Edited by: ShreeMohan Pugalia on Jul 18, 2009 8:03 AM
Edited by: ShreeMohan Pugalia on Jul 18, 2009 8:05 AM -
I have a word document that I have put hyperlinks in and turned into a pdf. When I email and receiver opens in iPad the document is blank. When I do a file save as pdf the document appears and the hyperlinks work but the document has much of the content turned into symbols. What is going wrong?
You select the printer properties and set the appropriate page size (I think there is a place to set it in PDF Maker too, but not sure). In the printer, this is equivalent to putting the proper paper in the printer.
-
Send Invoice email with pdf attachement through DI?
Hi all,
is it possible to send an Invoice email with pdf attachement through DI as it can be done through UI?
Best Regards,
VangelisHi Vangelis,
I Don't think that the DI API has that functionality (but I am not sure).
However with .Net's System.Net.Mail it should be quite easy to build.
Good luck,
Johan -
Mail the local files as attachment and some body text
hello Exprests
I have a requirement where i have to mail the local files as attachment and some body text also...
I am using the following code, and the problem is that i am getting a blank TXT as an attachment.
Please help me solve this issue, if u change the spool request no., client & put ur mail id and execute it u will find that apart from the pdf we get an un wanted attachment also..
Please suggest me the solution..
WORK TABLE AREAS
TABLES: tsp01.
INTERNAL TABLES
DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
TYPES: BEGIN OF y_files,
file(60) TYPE c,
END OF y_files.
DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
g_document LIKE sood4,
g_header_data LIKE sood2,
g_folmem_data LIKE sofm2,
g_header_data LIKE sood2,
g_receive_data LIKE soos6,
g_ref_document LIKE sood4,
g_new_parent LIKE soodk,
l_folder_id LIKE sofdk,
v_email(50).
DATA: hd_dat LIKE sood1.
VARIABLES
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: outbox_flag LIKE sonv-flag VALUE 'X',
store_flag LIKE sonv-flag,
delete_flag LIKE sonv-flag,
owner LIKE soud-usrnam,
on LIKE sonv-flag VALUE 'X',
sent_to_all LIKE sonv-flag,
g_authority LIKE sofa-usracc,
w_objdes LIKE sood4-objdes.
DATA: c_file LIKE rlgrap-filename,
n_spool(6) TYPE n.
DATA: cancel.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
CONSTANTS
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
*=======================================================================
*=
*=========
*z_send_email_fax2
*function z_faian_mail_fax2.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
*" TABLES
*" LT_BODY_EMAIL STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
Fist part: Verify if the spool really exists
*select single * from tsp01 where rqident = src_spoolid.
DATA src_spoolid TYPE tsp01-rqident VALUE '23242'.
DATA header_mail TYPE so_obj_des.
DATA lt_body_email TYPE STANDARD TABLE OF soli WITH HEADER LINE.
DATA l_t VALUE '1'.
header_mail = 'Subject line of mail'.
IF l_t = '1' .
RAISE err_no_abap_spooljob. "doesn't exist
*ELSE.
client = '200'."tsp01-rqclient.
name = 'SPOOL0000023242'."tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = lt_body_email
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
CLEAR lt_rec_tab.
lt_rec_tab-sel = 'X'.
lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
lt_rec_tab-recnam = 'U-'.
lt_rec_tab-deliver = 'X'.
lt_rec_tab-not_deli = 'X'.
lt_rec_tab-read = 'X'.
lt_rec_tab-mailstatus = 'E'.
lt_rec_tab-adr_name = fax_mail_number.
lt_rec_tab-sortfield = fax_mail_number.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-sortclass = '5'.
APPEND lt_rec_tab.
lt_rec_tab-recextnam = ."Email id .
lt_rec_tab-recesc = 'U'. "object_type.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
c_file = 'C:\Documents and Settings\abgupta\Desktop\Abhinav\zpk.txt'.
lt_files-file = c_file.
APPEND lt_files.
begin of insertion by faianf01
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
end of insertion by faianf01
lt_note_text-line = 'test prgram for email'.
APPEND lt_note_text.
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
check_send_authority = 'X'
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDIF.
COMMIT WORK AND WAIT.Hi!
Add the actual body right after the line, you have created the Multipart object.
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(this.text); //body of message
Multipart mp = new MimeMultipart();
// Adding the body
mp.addBodyPart(mbp1);
//adding attachments
//... and so on...-Raine- -
Can´t send emails with pdf attachments - why?
Since i moved all my accounts to my new airbook (OS X 10.8.2) everything works fine BUT i am not able to send emails with pdf attachments.I have an exchange and a mac.account - but they both won`t work.
The emails stay put in the local ausgang? exit box and won`t move away unless i delete them.
i checked the accounts, the activity - all says it works fine - but it doesn`t!
Maybe in the *deep* of my mac is one thing that says no pdf - but where can i find it?
I appreciate every helpful hint :-)
greetingsit tries to send the email for about five minutes and than gives the message *server doesn't work* you want to try another? repeat? or later?
when i change the server e.g. from exchange to mac - tries again and without further notice i find the message in the outbox - even when i click that one and *send* again - nothing changes......
I already tried to name the attachments in.pdf - i also change the pdf to jpeg - nothing works - all emails i write after that go immediately to the outbox - so when i want to send messages at all i need to delete the ones with the attachment or send the other ones manually
Please notice in the activity window there is a lot of traffic :-) but it doesn`t help
i even closed all other programmes like excel,safari and stuff - but still
and i still have al lot of free GB on my airbook....
any idea???? -
Can't delete email with a 9 mb attachment from iphone
can't delete email with a 9 mb attachment from iphone(3gs, software v 4.3.1) -- every time i try to delete the email with a swipe it shows the red delete button on the right but then freezes for a while and then the delete button disappears but the email does not. when i go through edit function and mark it for deletion, the same thing occurs.
any advice??No. The modem is an Arris obtained from Comcast on 6/9/2014 after the prior one failed.
-
Hello! I have the Acrobat XI test version installed, got the registration Mail and confirmed it. When i have the program opened and try to convert the file from a pdf to a word and press the convert button, it shows a the message "application failed" (in german "Fehler bei der Anmeldung"). I hope have explained the issue on the right way with my bad english. Do you have a solution for it?? Best regards, Marcus Wenk
yes, you are right. it is the adobe reader via exportPDF. but it should be the acrobat. it was written on the internetpage...
-
Why is gmail blocking me from sending email with a "pages" document attached?
Why is gmail blocking me from sending email with a "pages" document attached? I've checked the document for viruses with "MacKeeper" and it's clean.
Google reads your emails, in case you did not know that. Unless you are sending an email containing content Google can extract and add to its vast database of personal information, Google has no use for it.
Google Mail is becoming progressively useless. It won't accept .zip attachments, at least not the last time I tried, it will eventually prevent you from using an email client unless you visit their web mail interface, and it will disable your account if you attempt to log in from someplace Google deems is not where Google thinks you ought to be.
Gmail is worth every cent you paid.
Get rid of MacKeeper. It is capable of doing nothing beneficial and will only cause problems. -
Can you email completed PDF form as attachment by clicking on hyperlink you create?
Can you email completed PDF form as attachment by clicking on hyperlink you create?
This is not something we currently support but you can add or vote on feature ideas:
http://forums.adobe.com/community/formscentral?view=idea
If you need to add a new idea click "Create an idea" under "Actions" in the top right.
Thanks,
Josh -
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 GalindoHi 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 -
Send email with PDF attachements (Smartform/SAP script)
Hello All,
I have 3 existing programs A, B & C whose output is in SAP Script/Smartform. Now I need to create new program D which needs to execute program A, B & C and then convert their smartform/SAP script output into PDF format and send email with attachements (PDF files). Any pointers how I can proceed. Thanks a lot.hi Sarita,
v_ctrlparams-no_dialog = 'X'.
v_ctrlparams-getotf = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Smartform name'
IMPORTING
fm_name = v_func_mod.
CALL FUNCTION v_func_mod
EXPORTING
control_parameters = v_ctrlparams
IMPORTING
job_output_info = v_joboutput
TABLES
t_nonsigner = t_nonsigner.
fill the document
doc_chng-obj_name = 'Descriptoipn'.
Fill the subject line
doc_chng-obj_descr = 'Manpowe'.
doc_chng-obj_descr = 'Reminder .
doc_chng-sensitivty = 'P'.
Fill the content of the mail
objcont = 'Dear all,'.
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
objcont =
'The manpower sign-off is pending for the list of employees as per th' &
'e attached sheet.'
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
objcont =
'Please click on the following link for the manpower sign-off:'.
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
DESCRIBE TABLE objcont LINES entries.
READ TABLE objcont INDEX entries.
doc_chng-doc_size = ( entries - 1 ) * 255 + STRLEN( objcont ).
Creating the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = entries.
objpack-doc_type = 'RAW'.
APPEND objpack.
Creating the document attachment
(Assume the data in OBJBIN are given in BMP format)
LOOP AT v_joboutput-otfdata INTO wa_otfdata.
APPEND wa_otfdata TO objbin.
CLEAR wa_otfdata.
ENDLOOP.
DESCRIBE TABLE objbin LINES tab_lines.
objhead = 'NonSignerDetails.otf'. APPEND objhead.
Creating the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'OTF'.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = 'NonSignerDetails'.
objpack-doc_size = tab_lines * 255.
APPEND objpack.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objcont
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
hope this will help u..
regards,
Santosh Thorat
Maybe you are looking for
-
I was trying to draw a tables with 11 rows and 3 rows as a starts to try to make address labels. Downloading an Avery template didn't work. I opened the Inspector on a word processing blank page but none of the selections worked. "Body rows" and "
-
How do I transfer bookmarks from my XP PC to a new laptop with Linux Mint?
I'm currently using a 7 year-old laptop with Windows XP. I bought a new one and I plan to install Linux Mint. Do I follow the same instructions for transferring between computers when they have different OS?
-
Mac Mini OS X version 10.8.2 I can't empty trash
I can't empty my trash there's a message and click "all remove all items" then nothing!!! How could I do?
-
How to repalce audio track in PR or AE?
Assume that I recorded my voice and detected my voice frequency and waves,then i wanna replace an audio of a video im my voice frequency and it will perform my voice,it sounds like my voice.do anyone know how many softwares i need? and i to process.t
-
Hi Is it possible to have if condition in ADF like af:foreach in my page i need to change th field based on some codition if the condition is date i need to put date input combo , like that Pls advice