Sending an email attachment for xls file
Hi all,
I am executing the reports in background, i am getting spool after executing. Just i need to convert the spool to xls format and email through attachment and mail to the user.The xls file should not be saved on local system.
I need your help.
Regards
Vinay.
see this link
to send xls as attachment.
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
Similar Messages
-
Email attachment for text file using ABAP with funny format output
Hi All,
I am developing an ABAP program to generate an email to an external email address by using Function Module FUNCTION 'SO_DOCUMENT_SEND_API1. There is an attachment included in this program. The attachment is generated by reading through a data file from an Application Server and place it in the internal table before attaching it to the function module.
Currently when I download the data file through SO01, I found that the data file looks a bit funny as below. It seems that all the letters are separated with an additional space in between.
Funny Output:
A B C D 1 2 3 A B C
Suppose Output:
ABCD 123 ABC
I am not too sure if there is any output format that I need to set in order to make it works?hi Sree Ram,
Thanks for your quick reply. The following is my code. I am not too sure if your reply will help to change the format of my data file or attachment sent through email.
Thanks.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_add
sender_address_type = ld_sender_add_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. -
when I send an email with a photoshop file attached, the recipient receives it "flattened". How do I change this?
I've sent psd files to various people without issues, however you might want to try something like www.filedropper.com to make sure it's not that they can't open your version of psd file.
You may also want to zip the file using the built in archiving software, simply right click (or control click) the file and choose Compress ...., then you can email it to the person as a compressed archive. That should preserve all the aspects of the file properly without any modifications. -
Error 829 in SOST tcode while sending an email attachment ??
Hi..
I am using the function module "SO_NEW_DOCUMENT_ATT_SEND_API1" to send an email attachment.
The program is getting executed successfully but when i see in SOST transaction, i am getting an error message.
Error number is 829 and it says " Internal error: SO_OBJECT_MIME_GET Exception: 2 "...
How do i resolve this error ....??Hi,
Please check this links will help you.
Error in SOST transaction for Mail Triggered from SAP
Re: need help in implementing a note -
Can u share me the link to send rescued email address for my forgotten security questions.
Go to https://expresslane.apple.com ; select 'More Products and Services', then 'Apple ID'. In the next page select 'Other Apple ID Topics' then 'Forgotten Apple ID security questions' and click 'Continue'.
-
I've just subscribed to adobe exportpdf. Can I simply send an email with the converted file?
THanks in advance
solromacI do not understand your question; what happens when you try?
[topic moved to ExportPDF forum] -
Read filename of email attachment for sender mail adapter
Hi All,
We have a requirement to read filename of email attachment received from Sender email adapter and send details to SAP by Proxy call.
Can we retrieve the filename of email attachment ?
Any help on this will be really useful.
Regards,
AshishHi,
>>>Can we retrieve the filename of email attachment ?
Please see the below link, it might be useful to you.
http://wiki.sdn.sap.com/wiki/display/XI/AdapterModulePI7.0GetAttachmentName
Regards,
P.Rajesh -
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,
I m running the custom concurrent program through pl-sql code and sending the output of the same conc program on to the email id of vendor.
When i was tryng to send the output in text file it was allowing me to send the text message as well as attachment.
But with the same code I want to send the pdf output.
so earlier I was using the UTL_MAIL.send_attach_varchar2 .
And for pdf attachment I am using the UTL_MAIL.send_attach_raw.
So custom program is generating the output but
while sending an email, it is not attaching the output into the email.
What could be the problem.
Please help as I needed it urgently.
revert me if anyone has any query.
Thanks,
Bluetooth_25No it's not generating the .pdf file.
It's only generating the .out file.
so is that the possibility that it is not attaching the pdf in email.
Here is my code:
/*Variable declaration*/
fhandle UTL_FILE.file_type;
flen NUMBER;
bsize NUMBER;
ex BOOLEAN;
vtextout RAW (32767);
UTL_FILE.fgetattr ('EMAIL_OUTPUT','o'||v_request_id ||'.out',ex,flen,bsize);
fhandle := UTL_FILE.fopen('EMAIL_OUTPUT','o'||v_request_id ||'.out', 'r');
LOOP
BEGIN
UTL_FILE.get_raw (fhandle,vtextout,flen);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
EXIT;
END;
END LOOP;
UTL_FILE.fCLOSE(fhandle);
FOR email_rec in c2_vendor_email_add(po_rec.po_header_id)
LOOP
UTL_MAIL.send_attach_raw
sender => '[email protected]',
recipients => email_rec.email_address,
subject => 'Testmail',
MESSAGE => 'This is test mail',
attachment => vtextout,
att_mime_type =>'application/pdf',
att_filename =>'o'||v_request_id ||'.out'
and i have one more question how to send an email to multiple recipients using utl_mail.send_attach_raw -
Removing extra spaces from email attachment of text file
Hi All,
I am having a question in opening email attachment file in text mode.
Whenever I am trying to open a CSV file in text mode after each row it adds blank spaces. These blank spaces are to complete the 255 characters on each row I guess.
My client doesn't want these space. So can anybody tell how to remove those spaces?
<removed by moderator> response would be helpful.
Thanks and Regards
Nishad
Edited by: Thomas Zloch on Apr 28, 2011 4:02 PM - priority normalizedHi,
There is no solution for this as u know that the data which you r sending in csv its actually getting populated from an internal table.
You cannot make your internel table dynamic for this requirment.
It should have a fixed length. Now if the data is less then also the length.
So u have identified correct that because of 255 the blank space is population, nothing is in your hand.
U have to convince the client, to make them understand where is the limitation.
Thanks & Regards
Prasenjit -
Block List ALV Output Send As Email Attachment
Hi, All The ABAP Gurus,
I have made a block ALV Report. I want that this output should be converted into .xls with HTML format and this should be send in email as attachment. This all will be made in a background job which will be scheduled daily.
How can I achieve this? I know that the output of classical report can be attached as pdf in email.But I want in Block ALV.
Thanks in Advance.
Regards,
Bharti Jain
Edited by: Bharti Jain on Jun 28, 2011 10:20 AMHi
Not 100 percent sure what you want to do here. I am confused by the .xls in html format. If you want the output in html you can submit the program and export the list to memory, Then retrieve the list and convert it to html. i have done this with the program 1sdbf12l/rv14akzy . see code below. This converts the output to html, you are left with a binary itab and size at the end of the routine and this can be attached to an email.
Submit Program and export the list to Memory
SUBMIT /1sdbf12l/rv14akzy USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE lt_params_new EXPORTING LIST TO MEMORY AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lt_list
EXCEPTIONS
not_found = 1
OTHERS = 2.
Convert the List to html
IF sy-subrc = 0.
DATA: it_html TYPE TABLE OF bapihtml WITH HEADER LINE,
it_html_out TYPE TABLE OF bapihtml WITH HEADER LINE,
lt_html TYPE TABLE OF bapihtml WITH HEADER LINE,
lv_html LIKE LINE OF it_html,
lv_html_out TYPE string.
DATA: lv_html_tab_wide(50000) TYPE c.
DATA: lineno TYPE i, length TYPE i, size TYPE i.
DATA: gui_codepage(4) TYPE n, " added for message 500824
is_unicode TYPE rststype-sel_ok.
DATA: convert_output TYPE xstring,
convert_buffer TYPE xstring.
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
listobject = lt_list.
CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
EXPORTING
REPORT_NAME =
template_name = 'WEBREPORTING_REPORT'
TABLES
html = it_html
listobject = lt_list.
DESCRIBE TABLE it_html LINES lineno .
DESCRIBE FIELD it_html LENGTH length IN BYTE MODE.
size = length * lineno.
CALL 'CUR_LCL' ID 'GUICP' FIELD gui_codepage.
CALL FUNCTION 'SCP_GET_CODEPAGE_PROPERTIES'
EXPORTING
codepage = gui_codepage
IMPORTING
can_unicode = is_unicode
EXCEPTIONS
codepage_unknown = 1.
IF sy-subrc <> 0.
CLEAR gui_codepage.
ENDIF.
IF is_unicode EQ 'X'. "in case of unicode, always use utf-8
gui_codepage = '4110'.
ENDIF.
CLEAR: convert_output, convert_buffer.
LOOP AT it_html INTO lv_html.
REPLACE ALL OCCURRENCES OF c_bg_def IN lv_html WITH c_bg_white.
CALL FUNCTION 'SCP_TRANSLATE_CHARS'
EXPORTING
inbuff = lv_html
outcode = gui_codepage
csubst = 'X'
substc_space = 'X'
IMPORTING
outbuff = convert_output
EXCEPTIONS
invalid_codepage = 1
internal_error = 2
cannot_convert = 3
fields_bad_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
message i020 raising download_error.
ENDIF.
CONCATENATE convert_buffer convert_output INTO convert_buffer IN
BYTE MODE.
CONCATENATE lv_html_out lv_html INTO lv_html_out.
ENDLOOP.
ev_html_string = lv_html_out.
i = 0.
DESCRIBE FIELD html_tab_converted LENGTH tablength IN BYTE MODE.
WHILE i < XSTRLEN( convert_buffer ).
dummy = XSTRLEN( convert_buffer ) - i.
IF tablength > dummy.
html_tab_converted-line = convert_buffer+i(dummy).
ELSE.
html_tab_converted-line = convert_buffer+i(tablength).
ENDIF.
i = i + tablength.
APPEND html_tab_converted.
ENDWHILE.
et_bin[] = html_tab_converted[].
ev_bin_size = size. -
Removing email attachement deletes original files ?
Hi,
I have a strange "bug" when trying to drag back an attachement file from an email that i'm writing to it's original folder. The original file is deleted without any questions and no trace of the file is left anywhere;
Ex.: Start a new mail, drag a file from desktop to the mail, drag back the file from mail to desktop. File on the desktop desapears !?!? and file apears to stays in the email. But if you try to drag it to somewhere else or send the email, you realize that you lost the original and the attached file also.
Does someone know how to recover the file ? or why this is happening ?
PS.: I found that this occurs when the file comes from windows profile folder and his childrens %SystemDrive%\Documents and Settings\"Username"...
PS.: Tried to do a recovery on the hard drive with GetDATA Back NTFS without luck
Thanks for the help !
Eric Tardiferic tardif wrote:
> Hi,
>
> I have a strange "bug" when trying to drag back an attachement file
> from an email that i'm writing to it's original folder. The original
> file is deleted without any questions and no trace of the file is left
> anywhere;
>
> Ex.: Start a new mail, drag a file from desktop to the mail, drag back
> the file from mail to desktop. File on the desktop desapears !?!? and
> file apears to stays in the email. But if you try to drag it to
> somewhere else or send the email, you realize that you lost the original
> and the attached file also.
>
> Does someone know how to recover the file ? or why this is happening ?
>
> PS.: I found that this occurs when the file comes from windows profile
> folder and his childrens %SystemDrive%\Documents and
> Settings\"Username"...
>
> PS.: Tried to do a recovery on the hard drive with GetDATA Back NTFS
> without luck
>
> Thanks for the help !
>
> Eric Tardif
>
>
I bet that would never happen for a sent mail. Does it?
It's probably because it's depending on the filehandle which you broke.
Honestly, I don't see this happening on any normal circumstances. In
fact you are the first I recall. -
i am tryng to open the Attached xls file in the mail but i cant save that file in to a specified location also thats my problem please sugest a solution for that
Having the same problem. Click mail, it bounces, a quick flash, then nothing. Also as a side note, Entourage as of this morning will no longer send mail to either of my work accounts, that is why I was trying mail. Also tried several other mail programs and the same result, can receive mails, but not send.
Have reset the router, cable modem, checked that I have the latest MS and Apple software loaded and it is all good. Very strange.
Ron -
The PDF is streamed from our webserver application to an IFRAME in Internet Explorer 9.
The headers Content-type (application/pdf), Content-disposition (random-unique-filename.pdf), Content-length are all set.
Acrobat Reader plugin opens up inside the IFRAME and presents the PDF without problems.
When our users try "Send file as email attachment" Outlook 2010 opens up and the file is attached - without the file extension.
The name of the attachment is the same name as the Java Servlet that delivered the streamed file.
If we save the streamed PDF to disc, open it in Acrobat and do the same maneuver - the file extension is added to the attached file name in Outlook.
Message was edited by: SolsonWe have the same problem !
Tested this today with adobe reader 9.5.x , file is attached as "filename.do.pdf"
If we use adobe reader 11.0.x file is attached as "filename.do"
If you use save file as , it does get the "pdf" extension automatically
Solution appreciated ! -
Convert spool to PDF and send as email attachment
When i try to convert SAP spool to PDF and send it as email attachment, size of PDF document becomes large as compared to size of the PDF cocument i download using the same spool.
I am using following FMs.
CONVERT_ABAPSPOOLJOB_2_PDF to convert spool to PDF
and
SO_NEW_DOCUMENT_ATT_SEND_API1 to send email with attchment.
some times size of attchment exceeds 2MB and email results in error in SAP connect (SOST).
Any idea on how to compress the PDF attchment??
ThanksHi Venkat,
Can you plesae assist me.
I have a requirement to convert spool to pdf
send an email to users
issue is that attachement is big cant go through
I have used compress, but when I open the pdf file error that file was not correclty decoded
please assist, anyone
Maybe you are looking for
-
After downloading the newest version, 10.6.1, whenever I open itunes I almost immediately get a "itunes has stopped working" error messsage, in which the only option is to hit the "close the program" button. Simply closing the error message closes t
-
I had created the BPM scenario excatly (I believe) as per the BLOG provided by Arpit (very helpful). It does pick the input file and gets the response (as seen from the payload) but does not write the output file. Tried several options for last 3 day
-
transfering/transcoding mxf to prores. one video dropped into the que automatically turns to n alert icon- ! any way i can get this vid to transfer? thanks!! A
-
Writting in MS Excel which containing no sheet
I am developing application for the taxation purpose . I have an excel workbook which is macro enabled , but there is not any worksheet . This is provided by Government of India for vat return etc . How can i write data in excel workbook without cont
-
When I try and copy a picture from this PDF the dimentions are reversed
I have this pdf of a map for a dungeons and dragons game I'm playing with some friends. The pictures on the pages are (for some reason) split into smaller pictures that I want to stitch together in photoshop late, but whenever I try and copy an image