Problem in Attachement of the Email
Hi, I need to send an external email along with an attachement i.e. a text file with many records in it.
All things are working smoothly except that the records in the attached text file rae coming in a single line while the records in the internal table should come in seperate line. I have checked the internal table and all the records are fine and with seperate index but while giving the reference of the internal table of records to the function module, it prints all the records on the same line rather than printing on the new lines.
Please help. Thanks in advance.
<b>see the below code and compare yours it was working fine and send a attach fille of txt with several lines from tyhe internal table</b>
*& Report ZEMAIL_ATTACH *
*& Example of sending external email via SAPCONNECT *
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_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
* Populate message body text
perform populate_email_message_body.
* Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls 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_XLS_DATA_TABLE
* Build data table for .xls document
FORM build_xls_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 con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
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 con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_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
reward points if it is usefull ....
Girish
Similar Messages
-
How can I print only the attachment without the email content
How can I print only the attachment without the email content. Every time I send to print, It prints the email itself with the attachment- can I cancel that?
Hello Riklama,
When you first open the attachment (e.g. on your phone) than you can mail only that attachment. Works fine with my husbands blackberry.
Elsy -
Read attachment in the email adapter in PI 7.11
Hello Experts
I am working on as scenario where I would be receiving source payload as an attachment in the email, and I need to read the attached payload and map it to the target structure
please let me know how can i read the attachment as part of the payload
Thanks
PRHi,
have a look at my article:
The specified item was not found.
Regards,
Michal Krawczyk -
Attachment of the email and PDF
When transfer the outllook emails to PDF package, the attachment of the email will not tranfer to PDF, but still keep as word format, how to transfer these attachment also to PDF?
When print the PDF package which tranfered from the emails, only the first email could be print out, how to print out all pages of emails together with their attachment?Ok, so what do I do then? My Question is this. I am using Pages to create email flyers for my business. I have been Exporting them into a PDF File, but they as you say, send as attachements. I need to know how to send them in an email, as an email and not as an attachement.
What do I do to save and send them differently. I know it can be done since I get craploads of Junk mail everyday that look like that. Please help, I have a deadline to meet approaching very soon. Thanks!!!!!!!!!!!!!!! -
Hello I have a problem in my phone The email request with Psoard forgotten I bought the phone by bringing the two years I have Vetorh with carton I want to help you thank you
Hi mylenebar!
Here is an article that will help you remove the desired photos from your phone:
iTunes: Syncing photos
http://support.apple.com/kb/ht4236
To delete synced photos and videos from your device
In iTunes, click the Device button in the upper right corner. (If viewing the iTunes Store, click the Library button in the upper-right corner first.)
Click the Photos tab in the resulting window.
Choose "Selected albums" and deselect the albums or collections you want to delete.
Note: To delete all synced photos, deselect "Sync Photos from" and, when asked, click "Remove photos."
Click Apply.
Thanks for coming to the Apple Support Communities!
Cheers,
Braden -
Whenever I send a email from iPad mail app with an attachment from pages or numbers, the receiver is getting only attachment in the email. They are getting the email content. How to troubleshoot this issue.
Someone is probably sending spam with your address forged on the To: line. Could be one of your old contacts with a Windows machine has a virus that's doing it. It's also possible your e-mail account has been hacked, though I'd think such a hacker would be a bit more purposeful.
For more information, see:
http://www.reedcorner.net/guides/macvirus/is_it_malware.php#spam
* Disclaimer: links to my pages may give me compensation, and should not be taken as endorsement of my services by Apple. -
Since I upgraded to Lion, my photos are not attached to emails. Example: I select photos in iphoto, click Share and send the email.
Recipients tell me that there is 'nothing attached, no photo attached." Can you help?This doesn't work for me at all. I tried entering exactly the same information that I used to set up my regular email account and I'm still getting an error message. I even tried switching to using my gmail account and neither one worked. Then it got hung up and had to repair my database! I have a lot of photos on my Mac (thank goodness they're backed up) and I was really sweating it for a moment.
Apple is so easy until it's not. I find this to be really aggrevating and I'm irritated that it hasn't been fixed. In fact I did an online search and someone described this same problem in detail and it was exactly what was happening to me. Same error messages.
I'm frustrated that Apple keeps updating it's operating system and then we go through these glitches.
And while I'm at it, I have never had such a frustrating time using my login information as I have to get into this forum! Why do they make it so difficult? There's just something about the way it's worded that get's me messed up every time. Meanwhile, at least get iPhoto fixed! -
Not able to open MS Excel attachment in the email Using SO_NEW_DOCUMENT_ATT
Hi, I am not able to open the attached MS excel in the mail its giving error as "Problems came up in the following areas during load Table". My requirement is to send a colored excel as attachment through mail when the program is executed in background. For this i have reffered the following link " http://wiki.sdn.sap.com/wiki/display/Snippets/FormattedExcelasEmailAttachment". That is i have used the XML method for this . I would be thankful if you can let me know where i am doing the mistake For refference i am pasting my code: * Send mail when executed in background mode IF sy-batch eq 'X'. PERFORM send_mail_bkgrnd. ELSE. " Foreground mode PERFORM build_layout. PERFORM build_field_cat. PERFORM display. ENDIF. FORM SEND_MAIL_BKGRND . PERFORM process_xml_data. PERFORM disatch_mail. ENDFORM. " SEND_MAIL_BKGRND &---- *& Form PROCESS_XML_DATA &---- FORM PROCESS_XML_DATA . DATA lv_xlwidth TYPE i. * Creating a ixml Factory l_ixml = cl_ixml=>create( ). * Creating the DOM Object Model l_document = l_ixml->create_document( ). * Create Root Node 'Workbook' l_element_root = l_document->create_simple_element( name = 'Workbook' parent = l_document ). l_element_root->set_attribute( name = 'xmlns' value = 'urn:schemas-microsoft-com:office:spreadsheet' ). ns_attribute = l_document->create_namespace_decl( name = 'ss' prefix = 'xmlns' uri = 'urn:schemas-microsoft-com:office:spreadsheet' ). l_element_root->set_attribute_node( ns_attribute ). ns_attribute = l_document->create_namespace_decl( name = 'x' prefix = 'xmlns' uri = 'urn:schemas-microsoft-com:office:excel' ). l_element_root->set_attribute_node( ns_attribute ). * Create node for document properties. r_element_properties = l_document->create_simple_element( name = 'TEST_REPORT' parent = l_element_root ). l_value = sy-uname. l_document->create_simple_element( name = 'Author' value = l_value parent = r_element_properties ). * Styles r_styles = l_document->create_simple_element( name = 'Styles' parent = l_element_root ). * Style for Header r_style = l_document->create_simple_element( name = 'Style' parent = r_styles ). r_style->set_attribute_ns( name = 'ID' prefix = 'ss' value = 'Header' ). r_format = l_document->create_simple_element( name = 'Font' parent = r_style ). r_format->set_attribute_ns( name = 'Bold' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Interior' parent = r_style ). r_format->set_attribute_ns( name = 'Color' prefix = 'ss' value = '#92D050' ). r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss' value = 'Solid' ). r_format = l_document->create_simple_element( name = 'Alignment' parent = r_style ). r_format->set_attribute_ns( name = 'Vertical' prefix = 'ss' value = 'Center' ). r_format->set_attribute_ns( name = 'WrapText' prefix = 'ss' value = '1' ). r_border = l_document->create_simple_element( name = 'Borders' parent = r_style ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Bottom' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Left' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Top' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Right' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). * Style for Data "Color properties are set over here r_style1 = l_document->create_simple_element( name = 'Style' parent = r_styles ). r_style1->set_attribute_ns( name = 'ID' prefix = 'ss' value = 'Data' ). r_border = l_document->create_simple_element( name = 'Borders' parent = r_style1 ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Bottom' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Left' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Top' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Right' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). * Worksheet r_worksheet = l_document->create_simple_element( name = 'Worksheet' parent = l_element_root ). r_worksheet->set_attribute_ns( name = 'Name' prefix = 'ss' value = 'Sheet1' ). * Table r_table = l_document->create_simple_element( name = 'Table' parent = r_worksheet ). r_table->set_attribute_ns( name = 'FullColumns' prefix = 'x' value = '1' ). r_table->set_attribute_ns( name = 'FullRows' prefix = 'x' value = '1' ). * Column Formatting DO 32 TIMES. CASE sy-index. WHEN 1. lv_xlwidth = '300'. WHEN 2. lv_xlwidth = '300'. WHEN OTHERS. lv_xlwidth = '300'. ENDCASE. PERFORM clmn_formatting USING lv_xlwidth. ENDDO. * Blank Row r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). * Column Headers Row r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). r_row->set_attribute_ns( name = 'AutoFitHeight' prefix = 'ss' value = '1' ). * VC. No. r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'VC No.' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). * Source r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'Source' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). DO 30 TIMES. * * TPLGRP r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = '' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). ENDDO. * Blank Row after Column Headers r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). DO 32 TIMES. r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). ENDDO. * Data Table CLEAR gs_output. LOOP AT gt_output INTO gs_output. r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). DO 32 TIMES. CASE sy-index. WHEN 1. a_dvalue = gs_output-vc_number. WHEN 2. a_dvalue = gs_output-source. WHEN 3. a_dvalue = gs_output-tplgrp_01. WHEN 4. a_dvalue = gs_output-tplgrp_02. WHEN 5. a_dvalue = gs_output-tplgrp_03. WHEN 6. a_dvalue = gs_output-tplgrp_04. WHEN 7. a_dvalue = gs_output-tplgrp_05. WHEN 8. a_dvalue = gs_output-tplgrp_06. WHEN 9. a_dvalue = gs_output-tplgrp_07. WHEN 10. a_dvalue = gs_output-tplgrp_08. WHEN 11. a_dvalue = gs_output-tplgrp_09. WHEN 12. a_dvalue = gs_output-tplgrp_10. WHEN 13. a_dvalue = gs_output-tplgrp_11. WHEN 14. a_dvalue = gs_output-tplgrp_12. WHEN 15. a_dvalue = gs_output-tplgrp_13. WHEN 16. a_dvalue = gs_output-tplgrp_14. WHEN 17. a_dvalue = gs_output-tplgrp_15. WHEN 18. a_dvalue = gs_output-tplgrp_16. WHEN 19. a_dvalue = gs_output-tplgrp_17. WHEN 20. a_dvalue = gs_output-tplgrp_18. WHEN 21. a_dvalue = gs_output-tplgrp_19. WHEN 22. a_dvalue = gs_output-tplgrp_20. WHEN 23. a_dvalue = gs_output-tplgrp_21. WHEN 24. a_dvalue = gs_output-tplgrp_22. WHEN 25. a_dvalue = gs_output-tplgrp_23. WHEN 26. a_dvalue = gs_output-tplgrp_24. WHEN 27. a_dvalue = gs_output-tplgrp_25. WHEN 28. a_dvalue = gs_output-tplgrp_26. WHEN 29. a_dvalue = gs_output-tplgrp_27. WHEN 30. a_dvalue = gs_output-tplgrp_28. WHEN 31. a_dvalue = gs_output-tplgrp_29. WHEN 32. a_dvalue = gs_output-tplgrp_30. ENDCASE. PERFORM fill_data_val_excel USING a_dvalue. ENDDO. CLEAR gs_output. ENDLOOP. * Creating a Stream Factory l_streamfactory = l_ixml->create_stream_factory( ). * Connect Internal XML Table to Stream Factory l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ). * Rendering the Document l_renderer = l_ixml->create_renderer( ostream = l_ostream document = l_document ). l_rc = l_renderer->render( ). * Saving the XML Document l_xml_size = l_ostream->get_num_written_raw( ). ENDFORM. " PROCESS_XML_DATA &---- *& Form DISATCH_MAIL &---- FORM DISATCH_MAIL . DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE. DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE. DATA: objbin LIKE solix OCCURS 10 WITH HEADER LINE. DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE. DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE. DATA: doc_chng LIKE sodocchgi1. DATA: tab_lines LIKE sy-tabix. DATA: l_num(3). DATA: subj_date(10) TYPE c. * Mail Subject data lv_date TYPE d. lv_date = sy-datum. CONCATENATE lv_date6(2) '-' lv_date4(2) '-' lv_date+0(4) INTO subj_date. CONCATENATE 'SAP Application Usage Report ' subj_date INTO doc_chng-obj_descr SEPARATED BY space. * Mail Contents objtxt = 'Dear User,'. APPEND objtxt. CLEAR objtxt. APPEND objtxt. CONCATENATE 'Please find the attached SAP Application Usage Report for ' subj_date INTO objtxt SEPARATED BY space. " Mail Contents APPEND objtxt. CLEAR objtxt. APPEND objtxt. objtxt = 'Thanks & Regards,'. APPEND objtxt. objtxt = 'Himanshu Kanekar'. APPEND objtxt. DESCRIBE TABLE objtxt LINES tab_lines. READ TABLE objtxt INDEX tab_lines. doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ). * Packing List For the E-mail Body objpack-head_start = 1. objpack-head_num = 0. objpack-body_start = 1. objpack-body_num = tab_lines. objpack-doc_type = 'RAW'. APPEND objpack. * Creation of the Document Attachment LOOP AT l_xml_table INTO wa_xml. CLEAR objbin. objbin-line = wa_xml-data. APPEND objbin. ENDLOOP. DESCRIBE TABLE objbin LINES tab_lines. objhead = 'SAP Login Details'. APPEND objhead. * Packing List For the E-mail Attachment objpack-transf_bin = ''."'X'. objpack-head_start = 1. objpack-head_num = 0. objpack-body_start = 1. objpack-body_num = tab_lines. CONCATENATE 'SAP_Login_Details' subj_date INTO objpack-obj_descr SEPARATED BY space. objpack-doc_type = 'XLS'. objpack-doc_size = tab_lines * 255. APPEND objpack. * Target Recipent CLEAR reclist. reclist-receiver = reclist-rec_type = 'U'. APPEND reclist. * 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_txt = objtxt contents_hex = objbin receivers = reclist EXCEPTIONS too_many_receivers = 1 document_not_sent = 2 operation_no_authorization = 4 OTHERS = 99. ENDFORM. " DISATCH_MAIL
Refer:
http://www.sap-img.com/abap/sending-mail-with-attachment-report-in-background.htm
http://www.saptechies.com/sending-mail-with-attachment-report-in-background/ -
Can we have more than one attachement to the "Email with Attachment" activity
Guys,
I have a requirement in which the process has n number of approvers in the flow, and each approver can add attachments to the form in the list<document> variable which carries the attahced documents.
At the end of the process i am supposed to send a email with all the attached files to a help desk team.
I know that the Email with attachment activity supports one attachment. is there any posibility or other activity that i can use to send an email with any number of attachments?Hi Ashok
The service you want is called "Send with Map of Attachments". This service is not on the toolbar.
If you drag on the Define Activity step and type "email" in the Find box you will see under Foundation that there are 3 email services.
Choose Send with Map of Attachments.
For help on this service see: http://help.adobe.com/en_US/livecycle/9.0/workbenchHelp/help.htm?content=000570.html
Diana -
Problem in Attachment of the Mail
Hi, I want to send the data in Internal Table as a text attachment to the SAP User Inbox. Problem I am facing is that, the records should go Line by Line i.e. each record should start from a new line but problem I am having is that, the next record starts in the same line where previous record has ended.
E.g. records should appear like this in file :
1. AAA XXX YYY ZZZ
2. XXX YYY ZZZ AAA
rather it is appearing like :
1. AAA XXX YYY ZZZ2. XXX YYY ZZZ AAA
I am giving the Code here to generate attachment and Mail I have used. Please help.
Data Declaration
data : begin of itab occurs 0,
ws_line(600) type c,
end of itab.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
DATA : receiver TYPE somlreci1-receiver VALUE 'AHUJR0'.
DATA : BEGIN OF itab_str,
text(290) TYPE c,
END OF itab_str.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objbin LIKE itab_str OCCURS 0 WITH HEADER LINE,
objhex LIKE solix OCCURS 0 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
Function Called to Prepare & send mail
PERFORM ml_addrecp USING receiver 'B'. "receiver contains SAP User Id
PERFORM doconv TABLES itab objbin. "itab is the table containing Data
PERFORM ml_prepare USING 'X' 'txt' grn_file. "grn_file is the name of attachment file
PERFORM ml_dosend.
Form ml_addrecp
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_addrecp
Form doconv
FORM doconv TABLES mypdf STRUCTURE itab_str
outbin STRUCTURE itab_str.
Loop And Put Data
LOOP AT mypdf.
outbin = mypdf.
APPEND outbin.
CLEAR: outbin.
ENDLOOP.
ENDFORM. "doconv
Form ml_prepare
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
ENDIF.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
ENDFORM. "ml_prepare
Form ml_dosend.
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
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.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_dosendHi Ravi,
I also had the same problem, the solution to this is.... Instead of giving the TXT type to the attachment give as 'RAW' it will work... it is working for me... note the place for the comment CHANGE I HAVE DONE in the code given by you...
objpack-doc_type = 'RAW'. '' for the attachment instead of TXT...
Eg...
Packing Info Attachment
*att_type = whatatt_type.. '" CHANGE I HAVE DONE
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
*objpack-doc_type = att_type. " CHANGE I HAVE DONE
objpack-doc_type = 'RAW'. " CHANGE I HAVE DONE
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
ENDFORM. "ml_prepare -
We have to read the attachment in the email
Hi All,
We have requirement that we have to read the Email from particular Emailid we will get an XML as an attachment and we have to read the attachment with in the email and we have to store the values into database.
Can any one help in this issue....urgent
Thanks in advance,
Regards,
Nagaraju .DI think that is the default behaviour of pop, i do not know how to set a kind of 'leave copy on the server' option. You could switch to the imap protocol if there is an imap server available. You can then choose:
<PostReadOperation>
<MarkAsRead/>
</PostReadOperation>
or
<PostReadOperation>
<DeleteMessage/>
</PostReadOperation>
To change this edit your ns_emails.xml file and fill in the IncomingServerSettings section.
The Reply To is the email address that the sender of the email indicates as address to use in case you would reply to his message.
Kind Regards,
Andre -
Duplicate enties getting attached in the email excel
HI,
When am trying to send the details in the excel duplicate entries are getting attached in the excel though the internal table has the correc value.The list is displaying the contents such as 1-255 are correct entries and 256-511 are the duplicate entries.
Instead of attaching in the excel if am displaying in the contents of email the details are getting displayed correctly.Please help to correct this duplicate entries in the excel.Code is as follows
TABLES: edidc,somlreci1.
TYPE-POOLS: slis,sscr.
TYPES: BEGIN OF gt_edidc,
docnum TYPE edidc-docnum,
status TYPE edidc-status,
credat TYPE edidc-credat,
idoctp TYPE edidc-idoctp,
mestyp TYPE edidc-mestyp,
rcvprn TYPE edidc-rcvprn,
END OF gt_edidc.
DATA:gi_edidc TYPE STANDARD TABLE OF gt_edidc.
DATA:gw_edidc TYPE gt_edidc.
SELECTION-SCREEN:BEGIN OF BLOCK b01 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_credat FOR sy-datum .
SELECT-OPTIONS: s_mailid FOR somlreci1-receiver OBLIGATORY
NO INTERVALS.
SELECTION-SCREEN:END OF BLOCK b01.
INITIALIZATION.
s_credat-low = ' '.
s_credat-high = sy-datum - 2.
APPEND s_credat.
start-of-selection.
SELECT docnum status idoctp mestyp rcvprn FROM edidc INTO CORRESPONDING
FIELDS OF TABLE gi_edidc
WHERE credat IN s_credat AND ( status EQ 64 OR status EQ 30 ).
IF no idoc selected for the given idoc date give the error message.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'No idoc selected for the given input'.
ENDIF.
DATA: lv_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: lv_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: lv_objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: lv_objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: lv_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: lv_doc_chng LIKE sodocchgi1.
DATA: lv_tab_lines LIKE sy-tabix.
data: lc_dsn_totals TYPE string.
DATA: gv_date_mmdd(10) TYPE c.
DATA: gv_message(50) TYPE c.
lv_doc_chng-obj_descr = 'IDoc Error Status'.
lv_objtxt = 'Please Find the Attached IDOC Error List'.
APPEND lv_objtxt.
lv_objtxt = 'Have a good day'.
APPEND lv_objtxt.
Mail Contents
DESCRIBE TABLE lv_objtxt LINES lv_tab_lines.
READ TABLE lv_objtxt INDEX lv_tab_lines.
*attaching the data excel sheet to be sent as the email.
CONCATENATE 'IDOCNUMBER' 'STATUS' 'BASIC TYPE' 'MESSAGE TYPE' 'PARTNER'
cl_abap_char_utilities=>newline INTO lv_objbin-line separated by
cl_abap_char_utilities=>horizontal_tab.
append lv_objbin.
LOOP AT gi_edidc INTO gw_edidc.
CONCATENATE gw_edidc-docnum gw_edidc-status gw_edidc-idoctp
gw_edidc-mestyp gw_edidc-rcvprn
cl_abap_char_utilities=>newline INTO lv_objbin-line
separated by cl_abap_char_utilities=>horizontal_tab.
APPEND lv_objbin.
ENDLOOP.
APPEND INITIAL LINE TO lv_objbin.
lv_doc_chng-doc_size = ( lv_tab_lines - 1 ) * 255 + STRLEN( lv_objtxt ).
CLEAR lv_objpack-transf_bin.
*OBJPACK-TRANSF_BIN = 'X'.
lv_objpack-head_start = 1.
lv_objpack-head_num = 0.
lv_objpack-body_start = 1.
lv_objpack-body_num = lv_tab_lines.
*OBJPACK-BODY_NUM = 1.
lv_objpack-doc_type = 'RAW'.
lv_objpack-obj_name = 'Mail'.
lv_objpack-obj_descr = 'First Mail'.
lv_objpack-doc_size = lv_tab_lines * 255.
APPEND lv_objpack.
Creation of the entry for the compressed document
DESCRIBE TABLE lv_objbin LINES lv_tab_lines.
CLEAR lc_dsn_totals.
IF sy-langu = 'E'.
CONCATENATE 'IDOC_TOTALS_' sy-datlo '_' sy-timlo INTO lc_dsn_totals.
endif.
*CLEAR OBJPACK-TRANSF_BIN.
lv_objpack-transf_bin = 'X'.
lv_objpack-head_start = 1.
lv_objpack-head_num = 0.
lv_objpack-body_start = 1.
*OBJPACK-BODY_NUM = TAB_LINES.
lv_objpack-body_num = lv_tab_lines.
lv_objpack-doc_type = 'CSV'.
lv_objpack-obj_name = 'ATTACHMENT'.
lv_objpack-obj_descr = lc_dsn_totals.
lv_objpack-doc_size = lv_tab_lines * 255.
APPEND lv_objpack.
*Create the list of recipients
LOOP AT s_mailid.
lv_reclist-receiver = s_mailid-low.
lv_reclist-rec_type = 'U'.
APPEND lv_reclist .
ENDLOOP.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lv_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = lv_objpack
object_header = lv_objhead
contents_bin = lv_objbin
contents_txt = lv_objtxt
receivers = lv_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc = 0.
MESSAGE s000 WITH 'Email succesfully delivered'.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ELSE.
MESSAGE s000 WITH 'Error while sending email'.
ENDIF.Your code is tough to understand in the way you posted .....
make sure you are clearing the data in some internal tables.... or make sure you are using the correct table for email body and to excel
if at all if you are using header line clear: itab[] will clear the whole table.. -
Message when opening the attachement in the email
Hi,
Am trying to send a attachement to mail.The contents of the email are fine but when i tried to open the attachement its poping up a information message as "Error has detected that "details.xls" is a SYK file but cannot load it.Either it has a error or it is not a SLK format.Click OK to open the file".How to get rid of this error?Hi,
May be try checking this.
In your system, in the CONTROL PANEL -> FOLDER OPTIONS.
I am not sure but try this.
Regards,
Santhosh. -
Can read attachment of the email
I installed Snow Leopard on my iMac.
However, I found out that I could not read multi-page tif or jpg files attached to the mails.
There is no problem for OS X 5.8 Leopard.
I moved the files to the desktop and tried to open them by using preview, but still can't open them.
How come to the OS X 6.0 Snow Leopard that it could not perform such simple function?
Can any one tell me how to do?Hello and welcome to the Discussions.
I know about multi-page PDF, but not sure what you mean by multi-page tiff or JPEG? Clarification, please, including the source of these files? Would they be something that would require Flip4Mac to open (don't know why) or something similarly incompatible until a new update?
Ernie -
I keep getting "undelivered mail returned to sender" that comes with an attachment. i do not open the attachment but i get email returned from people that i have not emailed in years. I also have current people that tell me they receive email from me and there is nothing on the email and it is a repetative thing for them and for me. I have scanned my computer and it keeps telling me there are no viruses but i keep getting these emails. can anyone help me please!
Someone is probably sending spam with your address forged on the To: line. Could be one of your old contacts with a Windows machine has a virus that's doing it. It's also possible your e-mail account has been hacked, though I'd think such a hacker would be a bit more purposeful.
For more information, see:
http://www.reedcorner.net/guides/macvirus/is_it_malware.php#spam
* Disclaimer: links to my pages may give me compensation, and should not be taken as endorsement of my services by Apple.
Maybe you are looking for
-
Confirmation of Production order with out goods issue
Dear All In one of the post the solution is given as below. "<b>Try using user exit "EXIT_SAPLCORF_102" to check goods issue at the time of confirmation using CO11N.</b>" But .. 1. How and where to find this user exit 2. What code to add inside this
-
[solved]URxvt and Xdefaults configurations not used
Yesterday I noticed that my middle-mouse button paste from URxvt had stopped working, and today I noticed that seemingly all my configurations (besides fonts) aren't being used in URxvt. If I run "source .Xdefaults" from a running URxvt, I get the e
-
TS3274 New IPAD Power plug gets hot
I have a one week old new IPAD. The power plug that comes with the IPAD gets very hot upon charging (the bulk portion that gets into wall socket). I had IPAD2 and never faced this issue? Should I take it to an Apple Shop for replacement?
-
Trying to access output on bridge
I am unable to access output on bridge
-
Portal eventing: hiding iView?
Hi all, I've made 2 portal components: a search iView and a result iView. When I enter searchcriteria in the search iView and click the search button, the result iView shows me the results (via EPCM event). Now, I'm wondering if it's possible to hide