Email Attachment with display template
Hi All,
I would like to send an E-mail with attachments like Table and the iChart.
I have the Sql query with selected columns and the display template.
I would like to attach the display template(iChart) and the Selected Table fields. Is it possible to do this.
my BLT Actions are 1. PDF Document
2.SQL Query with selected columns
3. PDF Table
4.Email
where can i insert the ichart in the above series?.
Thanks
Muvva
Use a Chart action block with your query and display templates to generate an encoded image. Create a PDF Document. Use the PDF Image action block to attach the chart encoded image to your PDF. Create your email with a PDF attachment. And send your email.
Good luck,
Mike
Similar Messages
-
Get file name of an email attachment with sql query
Hi all,
How can I get the file name of an email attachment with a sql or pl/sql query?
Thanks in advance.
Edited by: JonasZzZz on Sep 14, 2009 10:52 AMHi, anynone? please..
-
Email attachment with .txt file (first line blank in the file)
Hi all ,
Iam trying attach .txt file to email , the file that iam accessing from server . But first line blank (extra) even though i dont have blank line in original file .Can any help me out to resolve this issue?
<u>Example</u> original file
12345 aa pq
<u>Email attachment file</u>
-> This line
12345 aa pq
This is my code:
REPORT ZTEST_FILE .
DATA:BEGIN OF t_upload occurs 0,
matnr LIKE zwplcsmev-matnr,
zwgehrrg LIKE zwplcsmev-zwgehrrg,
zwgehrct LIKE zwplcsmev-zwgehrct,
zwgbev LIKE zwplcsmev-zwgbev,
zwpldt LIKE zwplcsmev-zwpldt,
zwacdt LIKE zwplcsmev-zwacdt,
END OF t_upload.
*DATA: maildata type sodocchgi1.
*DATA: mailtxt type table of solisti1 with header line.
*DATA: mailrec type table of somlrec90 with header line.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA:REC(80) TYPE C.
DATA g_mask(20) TYPE c VALUE ',., ..'.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA:P_ERROR(3).
DATA:P_REFO(3).
DATA: gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1.
selection-screen begin of block b1 with frame title text-001.
parameters:p_file type localfile.
parameter:p_email type ad_smtpadr.
selection-screen end of block b1.
--At Selection-Screen- -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'TB_LIMIT_WS_FILENAME_GET'
EXPORTING
def_filename = p_file
mask = g_mask
mode = 'S'
title = 'INPUT FILE'
IMPORTING
filename = p_file
EXCEPTIONS
selection_cancel = 1
selection_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
START-OF-SELECTION.
PERFORM process_file.
if p_error = 'X' AND P_REFO <> 'X'.
PERFORM populate_message_body.
ENDIF.
IF P_REFO = 'X' AND P_ERROR <> 'X'.
it_message = 'Please find Attached file'.
APPEND it_message.
PERFORM send_attachment tables it_message
it_attach
using p_email
'Crest to Plc Data'
'TXT'
p_file
changing gd_error
gd_reciever.
ENDIF.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
END-OF-SELECTION.
*& Form process_file
text
FORM process_file.
*CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
DATA :l_path TYPE string.
l_path = p_file.
CONSTANTS: con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB
con_cret type c value cl_abap_char_utilities=>newline.
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE encoding default.
if sy-subrc = 0.
do.
read dataset p_file into IT_ATTACH.
IF SY-SUBRC NE 0 .
EXIT.
ELSE.
T_UPLOAD = IT_ATTACH.
CONCATENATE con_cret it_attach INTO it_attach .
append it_attach.
clear it_attach.
P_REFO = 'X'.
APPEND T_UPLOAD .
clear t_upload.
ENDIF.
ENDDO.
else.
p_error = 'X'.
ENDIF.
ENDFORM. "process_file
*& Form populate_message_body
text
FORM populate_message_body.
w_doc_data-obj_name = 'TEST'.
w_doc_data-obj_descr = 'Crest to Plc Data'.
w_doc_data-obj_langu = sy-langu.
it_message = 'File Not Found'.
APPEND it_message.
t_receivers-receiver = p_email.
t_receivers-rec_type = 'U'.
append t_receivers.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = w_doc_data
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = it_message
object_content = 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.
if sy-subrc = 0.
commit work.
SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
else.
MESSAGE s027(vv) WITH 'E-mail not sent'.
endif.
ENDFORM. "populate_message_body
*& Form send_attachment
text
FORM send_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
w_doc_data-doc_size = 1.
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
clear t_attachment.
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
if sy-subrc = 0.
commit work.
SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
else.
MESSAGE s027(vv) WITH 'E-mail not sent'.
endif.
Populate error return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. "send_attachmentJust copy the code below and execute . I just checked and found the exact values on attachment with no blank lines. This is more simple than the one u have written , just include ur data upload logic . For ITAB values to be attached i have written a simple logic to retrive from EKPO. Just copy this code and execute. u will understand then.
I understand that ur initial requirement was to attach the file directly and not to upload and attach. If u still want to go for the old requirement then check out the code(2nd program of the two that i have sent) that i have sent u on ur previous post.
REPORT ZEMAIL_ATTACH .
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_TXT_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .TXT speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .TXT documnet attachment'
'TXT'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_TXT_DATA_TABLE
Build data table for .txt document
FORM build_txt_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY SPACE . "con_tab.
CONCATENATE con_cret it_attach INTO it_attach." Use this if req.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY SPACE ."con_tab.
CONCATENATE con_cret it_attach INTO it_attach." Use this if req.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_txt_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
execute this code and i hope that will help u.
regards,
Barath. -
Hi
Can somebody help or give me the step how to sent an emai with a BLOB?
lI found that you can encrypt a message, but could not figure out how to assign a password. I guess that is why. Is there an Adobe product that can allow you to encrypt an email attachment and assign a password?
Charlene C. Jackson
Executive Assistant to Lawrence D. Garr, Esq.
Garr Tax Law, PLLC
1875 Eye Street, NW
Suite 500
Washington, DC 20006
202-650-0335 – office
202-478-5018 – fax
[email protected]<mailto:[email protected]>
Confidentiality Statement
This email message and any attached files are confidential and are intended solely for the use of the addressee(s) named above. This communication may contain material protected by attorney-client, work product, or other privileges. If you are not the intended recipient or person responsible for delivering this confidential communication to the intended recipient, you have received this communication in error, and any review, use, dissemination, forwarding, printing, copying, or other distribution of this email message and any attached files is strictly prohibited. Garr Tax Law, PLLC reserves the right to monitor any communication that is created, received, or sent on its network. If you have received this confidential communication in error, please notify the sender immediately by reply email message and permanently delete the original message. -
Email attachment with didnt used EXPORTING TO MEMORY
Hi Expert,
For my development I cant using below abap code because I getting short dump when trying to execute the SAP Standard Program "RM06WCD1". When trying other program that is working fine.
SUBMIT (report_name)
USING SELECTION-SET p_var
EXPORTING LIST TO MEMORY AND RETURN.
So I trying to use it with FM "Job Open" and FM "Job Close" and it was working fine with the following submit statement.
SUBMIT (report_name)
USING SELECTION-SET p_var
VIA JOB l_name NUMBER l_number AND RETURN.
and I using this fm "RSPO_RETURN_ABAP_SPOOLJOB" to get the data from the spool.
But I stuck in develop in emailing with the htm attachment part. I have no idea on how to split my line item because the content will be different based on the report that calling.
Have any expert here got any idea on the way to solve for this issue?
Thanks.Hi,
I don't understand what your issue is exactly. RSPO_RETURN_ABAP_SPOOLJOB returns the lines of a spool of type "ABAP list" in an internal table. Each line of the internal table corresponds to one line, so what do you mean by "split"?
Or does RM06WCD1 generate a spool of type "SAPscript/Smart form"? In that case, you shouldn't use RSPO_RETURN_ABAP_SPOOLJOB, but use CONVERT_OTFSPOOLJOB_2_PDF to send it as mail. Moreover, a standard function allows to send directly outputs as a mail.
BR
Sandra -
Creating email attachment with 255 char per record
Hi,
We want to generate an email with excel attachment through ABAP program. To do the same, we are trying to use FM 'SO_DOCUMENT_SEND_API1'.
It looks like it only allows 255 characters per record however we want include upto 700 chracters per record. Does anyone know a way out to overcome this problem?
Note - We do not want to wrap the text to next line.
Thank youHi:
I would advice to make the copy of this function module SO_DOCUMENT_SEND_API1 and change the packing_list-doc_size = '700'..
Hopefully it would be helpful to solve the problem.
Regards
Shashi -
Hi,
I like this iwork solution in icloud, but the integrity might be developed more. If I got an email to my icloud inbox, I can not open it with iworks application but it will be downloaded instead. It would be very useful to be able to open an attachment onsite, using one of the iworks app.
thanks
janosLet Apple know...
http://www.apple.com/feedback/ -
Can't access onscreen keyboard while sending email attachment with pages
Hi everyone! I desperately need your help.
When first downloaded the pages app on my Ipad, I was able to use the toolbar (on pages) and directly attach documents and send them as an email. Now, whenever I do it, I cannot tap to add an email address, subject, or message and the onscreen keyboard will not show up! The only thing I can tap is to cancel. Everything else works on Pages. I can tap on an area and the keyboard shows up. Plese help!!!
Thank you!!!Seems the Router must've gotten something set/reset wrong, not sure... maybe... Port Forwarding, or Firewall settings, or...
-
Email attachements with video won't play
I am slowly figuring out the palm pre i have my email account through msn, and i can not watch any attachments that have video cause i get a message saying that cant find a application that supports it and can not find a app that will play them, can anyone suggest something if one exists. thanks
Post relates to: Pre p100eww (Bell)I am not overly computer literate, but after the title of whatever was sent it just says mpg
-
Email with text attachment with line width 1250
Dear all,
I want to send the email with text attachment whose line width in text file is 1250. Kindly let me know how to send email attachment with more than 255 line width.
Regards,
Manoj
Moderator Message: Frequently Asked Question. Please search for available information before posting.
Edited by: kishan P on Apr 29, 2011 2:48 PMHi,
What ever text you are sending in the email, create a standard text for it using tcode SO10. In the program use the FM READ_TEXT to get the data into internal table which will be of length 132 char. If you want line widht of 255 chars convert using FM SX_TABLE_LINE_WIDTH_CHANGE as below,
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_dst = '255'
TABLES
content_in = it_data
content_out = it_mess_att
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
Use FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send email.
Hope this will help you.
regards,
Tulasi. -
Sending km document as an email attachment
Hi all,
I am trying to send a KM document as email attachment with the following peice of code. But I am getting FileNotFoundExceptio. Can anyone guide me as to where its going wrong. Any help will be appreciated.
String filePath = "";
ResourceContext ctx = new ResourceContext(getEP5User());
RID rid = RID.getRID("/documents/LRForms/0000000054.pdf");
IResource pdfResource =ResourceFactory.getInstance().getResource(rid, ctx);
filePath =
"irj\servlet\prt\portal\prtroot\com.sap.km.cm.docs\"
+ pdfResource.getRID().toString();
Properties props = new Properties();
props.put("mail.smtp.host", host);
Session session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(session);
Address toAddress;
Address fromAddress;
Address ccAddress;
Address bccAddress = new InternetAddress();
MimeMultipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
fromAddress = new InternetAddress("[email protected]");
message.setFrom(fromAddress);
toAddress = new InternetAddress("[email protected]");
message.setRecipient(Message.RecipientType.TO, toAddress);
message.setSubject("Subject");
messageBodyPart.setText("Please find attached the details.");
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filePath);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(source.getName());
messageBodyPart.setHeader("Content-Type", "application/pdf");
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
Transport.send(message);
On executing this code I am getting following exception.
MessagingException javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: IOException while sending message; nested exception is: java.io.FileNotFoundException
Thanks and regards,
JaydeepHi,
Did you check permissions/security zone settings on the folder/file?
Can you access the file directly from the browser?
Regards,
Omri -
Custom display template for search
HI
I have Created a custom Item Template as shown below.I want to map this with my custom result type but it is not working
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<title>News Item</title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:MasterPageDescription msdt:dt="string">$Resources:Microsoft.Office.Server.Search,DisplayTemplateDescription_SearchDefaultItem</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
<mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
<mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
<mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','SEDWMPNewsPublishDate':'SEDWMPNewsPublishDate','DisplayAuthor':'DisplayAuthor1','SiteTitle':'SiteTitle'</mso:ManagedPropertyMapping>
<mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded>
<mso:CrawlerXSLFile msdt:dt="string"></mso:CrawlerXSLFile>
<mso:HtmlDesignPreviewUrl msdt:dt="string"></mso:HtmlDesignPreviewUrl>
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>
<body>
<div id="StoraEnso_Item_Default">
<!--#_
if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
var id = ctx.ClientControl.get_nextUniqueId();
var itemId = id + Srch.U.Ids.item;
var hoverId = id + Srch.U.Ids.hover;
var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default_HoverPanel.js";
$setResultItem(itemId, ctx.CurrentItem);
if(ctx.CurrentItem.IsContainer){
ctx.CurrentItem.csr_Icon = Srch.U.getFolderIconUrl();
ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
_#-->
<div id="_#= $htmlEncode(itemId) =#_" name="SEItem" data-displaytemplate="StoraEnsoDefaultItem" class="ms-srch-item" onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">
<h2 class="heading"><a href="_#= ctx.CurrentItem.Path =#_">_#= ctx.CurrentItem.Title =#_</a></h2>
<div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
<p>_#= Srch.U.processHHXML(ctx.CurrentItem.HitHighlightedSummary) =#_</p>
<div class="footer">
<dl class="desc">
<dt>SiteTitle</dt> _#= ctx.CurrentItem.SEDWMPNewsPublishDate =#_
<dd><a class="status" href="#">_#= ctx.CurrentItem.SiteTitle =#_</a></dd>
<dt>Author</dt>
<dd><a class="status" href="#">_#= ctx.CurrentItem.DisplayAuthor =#_</a></dd>
</dl>
</div>
</div>
<!--#_
_#-->
</div>
</body>
</html>
If you see in "managedPropertyMapping" I have added a new property "SEDWMPNewsPublishDate" and when I use in my html I am not getting the value.
I checked with fiddler and I found that This property is not getting mapped. Json object does return this property.However this property has value. I have tested with content search webpart nad my code also.it returns value.
Can anyone let me know is there any issue in the above rendering template code
On update to this, I was using resultscript webpart on the page to display data and I have created custom result type to modify the display.What I found that when I add the custom properties which I need, on result script webpart using as
follows
scriptWebPart.SelectedPropertiesJson = "[\"SEDWMPNewsPublishDate\",\"SEDWMPIntroduction\"]"
and save the changes then I start getting the value of my custom properties.
I don't know how the result type works in accordance with display templates and when does it gets applied on the search data.If anyone is aware please let me know.
If I can't use the display templates with custom properties then what is the use of ManagedPropertyMapping on display templates.Can anyone please make me understand?You need to update the js file also.You can upload the js file also.In js file you have a column "ManagedPropertyMapping" this denotes which managed property should come for item in search.
For uploading the js file you can use as follows under module
<File Path="ModSearchDisplayTemplates\x.js" Url="x.js" Type="GhostableInLibrary">
<Property Name="Title" Value="xjs" />
<Property Name="MasterPageDescription" Value="$Resources:Microsoft.Office.Server.Search,DisplayTemplateDescription_SearchDefaultItem" />
<Property Name="ContentType" Value="$Resources:TemplateContentType_Code_Name" />
<Property Name="DisplayTemplateLevel" Value="Item" />
<Property Name="TemplateHidden" Value="0" />
<Property Name="TargetControlType" Value=";#SearchResults;#" />
<Property Name="HtmlDesignLockedFile" Value="TRUE" />
<Property Name="ManagedPropertyMapping" Value="'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','FileExtension':'FileExtension','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SEDWMPNewsPublishDate00':'SEDWMPNewsPublishDate00','SEDWMPIntroduction':'SEDWMPIntroduction','SEDWMPNewsIsSticky':'SEDWMPNewsIsSticky','SEDWMPNewsPostThreadId':'SEDWMPNewsPostThreadId'"/>
</File> -
Attachment with no extension using SO_DOCUMENT_SEND_API1
Hi,
anyone know if it is possible to create a txt file email attachement with SO_DOCUMENT_SEND_API1 but NOT to have the attachment name with the '.txt' extension?
I would like the attachment to be 'filename.001' but when it is emailed it being sent as 'filename.001.txt'
thanks.Hi,
Have you tried like:
t_packing_list-doc_type = 'RAW'.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_data
* PUT_IN_OUTBOX = ' '
commit_work = 'X'
IMPORTING
sent_to_all = lv_flag
* NEW_OBJECT_ID =
TABLES
packing_list = t_packing_list -
Read PDF form from email attachment
Hope someone is able to help on this one...
We are using a pdf form at work to gather some feedback and the user will be submitting the form via email...
Using outlook 2003 I had a crack at writing a vba module to read the pdf form from the email attachment to update into an excel spreadsheet
Is it possible to read pdf forms from the email attachment with outlook vba? Or does the attachment need to be saved to a directory first?
I have in the past done a vba module to save the pdf form attachments to a directory and then using acrobat and it's in-built form data collection tool and exported as a csv, but this feedback form will be an ongoing thing that will be updated daily - and to minimise handling would like to run the outllook macro that reads straight from the email attachment instead of doing another 3 or so steps...
Below is the snippet I am using - it's a mashup of different code I've found on the net
Sub Feedback()
On Error GoTo Feedback_err
'Dim ns As NameSpace
Dim objNS As NameSpace
'Dim Inbox As MAPIFolder
Dim objFolder As Outlook.MAPIFolder
'Dim SubFolder As MAPIFolder
Dim objExcel
Dim oBook
Dim oSheet
Dim gApp As Acrobat.CAcroApp ' In Tools > References > Checked all Acrobat Libraries in VBA > Tools > References
Dim pdDoc As Acrobat.CAcroPDDoc
Dim jso As Object
Dim Item As Object
Dim Atmt As Attachment
Dim filename As String
'Dim i As Integer
Dim myOrt As String ' Added 13/1/2010
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
' Check subfolder for messages and exit of none found
If objFolder.Items.Count = 0 Then
'If SubFolder.Items.Count = 0 Then
MsgBox "There is no Feedback emails in this folder.", vbInformation, _
"Nothing Found"
Exit Sub
End If
' Check each message for attachments
Set objExcel = CreateObject("Excel.Application")
Set oBook = objExcel.Workbooks.Open("G:\Path\Filename.xls")
Set oSheet = objExcel.Worksheets(1)
oSheet.Range("A2").Select
Set gApp = CreateObject("AcroExch.App") ' make acrobat session
Set pdDoc = CreateObject("AcroExch.PDDoc")
Set jso = pdDoc.GetJSObject ' set the Javascript object via this way we can fill in the PDF document fields
For Each Item In objFolder.Items
For Each Atmt In Item.Attachments
If Right(Atmt.filename, 3) = "pdf" Then
Do
If IsEmpty(objExcel.ActiveCell) = False Then
objExcel.ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(objExcel.ActiveCell) = True
objExcel.ActiveCell.value = jso.getField("CurrentDocDate").value
objExcel.ActiveCell.Offset(0, 1).value = Item.Session.CurrentUser
objExcel.ActiveCell.Offset(0, 2).value = jso.getField("txtJobNo").value
objExcel.ActiveCell.Offset(0, 3).value = jso.getField("rbStatus").value
objExcel.ActiveCell.Offset(0, 4).value = jso.getField("rbFeedback").value
objExcel.ActiveCell.Offset(0, 5).value = jso.getField("txtComments").value
End If
Next Atmt
Next Item
oBook.Save
objExcel.Quit
Feedback_exit:
Set Atmt = Nothing
Set Item = Nothing
Set objNS = Nothing
Set pdDoc = Nothing
Set objExcel = Nothing
Set jso = Nothing
Exit Sub
' Handle Errors
Feedback_err:
MsgBox "An unexpected error has occurred." _
& vbCrLf & "Please note and report the following information." _
& vbCrLf & "Macro Name: Feedback" _
& vbCrLf & "Error Number: " & Err.Number _
& vbCrLf & "Error Description: " & Err.Description _
, vbCritical, "Error!"
Resume Feedback_exit
End Sub
I get a vba error 91 "Object Variable or With block variable not set"
Cheers
Benhi Phani,
with regard to your problem I would suggest you to please go thru this link.
Hope this would be helpful to you.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/offline%20interactive%20pdf%20form%20using%20e-mail.pdf
Thanks,
kris -
Hi,
Can we call a display template using by giving path in WebPages?
Query template i tried and was working. Want to know whether it is possible with Display template also.
Please help.
Thanks in advance
Muzammil P.TOk,
We can use Query Templates in Web pages rite, for example , <b>"http://localhost/Lighthammer/Illuminator?QueryTemplate=Samples/QueryTemplate/testQuery&Content-Type=text/xml"</b>If we are giving this URL in WebPage as a source, it will brings the desired output. The same output as what we get while using <b>TEST button in Query Editor</b>. If we need to add some styles into it, we can either use XSL or Display Template into it. Using XSL will looks as follows
<b>"http://localhost/Lighthammer/Illuminator?QueryTemplate=Samples/QueryTemplate/testQuery&Content-Type=text/xml&Param.1=%&StyleSheet=http://Localhost/LH/xsl/MyStyle.xsl"</b>
Instead of XSL, is it possible to use display template ? If yes, How?
I understand that the same thing is possible using Applet tag. But i need to know whether is this possible using URL or not.
Please help me out.
Thanks in advance
Muzammil P.T
Maybe you are looking for
-
XSLT Transformation ABAP to XML speacial treatment of empty elements
Dear All, I have created a deep abap structure which basically reflects the structure of my XML file which I would like to generate later. I have created a transformation via transaction SE80->create XSLT Program. I am also using the ABAP command cal
-
10.0.2 pdf fiels
Hi, In some instances, such as the widely used Blackboard university student learning system I am unable to open/download .pdf files using firefox 10.0.2 on Mac Lion 10,7.3. I can access these files using older versions firefox. Any known problems?
-
Hi guys, New Arch user here. I just finished setting up a base system and have Xorg installed. Now I'm trying to setup KDE. I installed the full KDE package and are trying to launch KDM. When I launch STARTX I'm taken into the default Xorg window m
-
Post with clearing and only clearing
hi, what is the difference between POST WITH CLEARING and CLEAR GL/CUSTOMER/VENDOR? fb05 is post with clearing whereas f-03, f-32 and f-44 are clearing. so what is the difference that 1 is POST with clearing and the other 3 are just clearing. thanks
-
MIS Report Issue (Report Painter)
Hi SAP gurus, USERS have been processing critical Management Reports which are developed through Report Painter. In the recent past when ever the USERS are processing the Reports they are getting different figures even though the parameters are same.