Report output as email
Hi All,
I need to send report output as email text. is anybody has done this sort of work or any function module for this.
Please help if anyone knows it.
Cheers,
Lokesh
Hi
Check the code for similar requirement I was faced earlier.
Type for binary attachment table.
types: l_ty_tab_objbin type solisti1 occurs 0.
data: l_objbin type l_ty_tab_objbin.
Tables to hold PDF data
data: t_doctab type docs occurs 0,
t_line type tline occurs 0.
tables : soli. "SAPoffice: line, length 255
tables : zpsdsalrep. "ZPSDSALREP
data: l_email type soli-line.
data: l_email1 type soli-line.
data: l_adrnr like kna1-adrnr.
data: l_objky type nast-objky.
data: l_zzterrmg type zpsdsalrep-zzterrmg.
data: l_zsupervisor type zpsdsalrep-zsupervisor.
data: l_kunnr type kna1-kunnr.
data: l_kunnr1 type vbak-kunnr.
data: l_reclist like somlreci1 occurs 0 with header line.
data: l_objtxt like solisti1 occurs 0 with header line.
data: l_objpack like sopcklsti1 occurs 0 with header line.
data: l_doc_chng like sodocchgi1.
data: l_objhead like solisti1 occurs 0 with header line.
data: l_tab_lines like sy-tabix.
constants: k_true type boolean_flg value 'X'.
data: l_mail type somlreci1-receiver.
data: l_mail1 type somlreci1-receiver.
data:
l_l_mail2 TYPE somlreci1-receiver.
l_l_mail type somlreci1-receiver.
data: l_zzsalesrep type zpsdsalrep-zzsalesrep.
data: l_recipents type somlreci1-receiver.
constants: k_x(1) type c value 'X',
k_u(1) type c value 'U',
k_raw(3) type c value 'RAW'.
call function 'CONVERT_OTF_2_PDF'
EXPORTING
USE_OTF_MC_CMD = 'X'
ARCHIVE_INDEX =
IMPORTING
BIN_FILESIZE =
tables
otf = t_otfdata
doctab_archive = t_doctab
lines = t_line
exceptions
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
others = 3.
if sy-subrc <> 0.
write: / 'error', sy-subrc.
endif.
***/ Convert the PDF format to the table type required for the
**attachment.
call function 'QCE1_CONVERT'
tables
t_source_tab = t_line
t_target_tab = l_objbin
exceptions
convert_not_possible = 1
others = 2.
if sy-subrc <> 0.
write: / 'error', sy-subrc.
endif.
select single kunnr from vbak into l_kunnr1
where vbeln = nast-objky.
select single adrnr from kna1 into l_adrnr
where kunnr = l_kunnr1.
check sy-subrc is initial.
select single smtp_addr from adr6 into l_email
where addrnumber = l_adrnr.
SELECT SINGLE zzterrmg FROM zpsdsalrep INTO l_zzterrmg
WHERE zzsalesrep = l_kunnr1.
SELECT SINGLE zsupervisor FROM zpsdsalrep INTO l_zsupervisor
WHERE zzterrmg = l_zzterrmg.
SELECT SINGLE kunnr FROM kna1 INTO l_kunnr
WHERE sortl = l_zsupervisor.
SELECT SINGLE zsupervisor FROM zpsdsalrep INTO l_zsupervisor
WHERE zzsalesrep = l_kunnr1.
SELECT SINGLE zzsalesrep FROM zpsdsalrep INTO l_zzsalesrep
WHERE zzterrmg = l_zsupervisor.
SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
WHERE kunnr = l_zzsalesrep.
CHECK sy-subrc IS INITIAL.
SELECT SINGLE smtp_addr FROM adr6 INTO l_email1
WHERE addrnumber = l_adrnr.
SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
WHERE kunnr = l_kunnr.
CHECK sy-subrc IS INITIAL.
SELECT SINGLE smtp_addr FROM adr6 INTO l_email1
WHERE addrnumber = l_adrnr.
l_mail = l_email.
l_mail1 = l_email1.
l_l_mail2 = text-006.
l_l_mail = text-007.
Creation of the document to be sent
File Name
l_doc_chng-obj_name = 'SENDFILE'.
Mail Subject
concatenate text-001 nast-objky into l_doc_chng-obj_descr.
l_doc_chng-obj_descr = text-001.
Completing the recipient list
l_reclist-receiver = l_mail.
l_reclist-rec_type = k_u.
append l_reclist.
l_reclist-receiver = l_mail1.
l_reclist-rec_type = 'U'.
APPEND l_reclist.
l_reclist-receiver = l_l_mail.
l_reclist-rec_type = k_u.
append l_reclist.
l_reclist-receiver = l_l_mail2.
l_reclist-rec_type = 'U'.
APPEND l_reclist.
Mail Contents
l_objtxt = text-002.
append l_objtxt.
clear l_objtxt. " put in a blank line
append l_objtxt.
data: l_subject type solisti1.
concatenate text-003 '-' nast-objky into l_subject.
l_objtxt = l_subject.
append l_objtxt.
l_objtxt = text-004 .
append l_objtxt.
Calculate email size in bytes
describe table l_objtxt lines l_tab_lines.
read table l_objtxt index l_tab_lines.
l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + strlen( l_objtxt ).
Creation of the entry for the compressed document
for the email text
clear l_objpack-transf_bin.
l_objpack-head_start = 1.
l_objpack-head_num = 0.
l_objpack-body_start = 1.
l_objpack-body_num = l_tab_lines.
l_objpack-doc_type = k_raw.
append l_objpack.
Creation of the document attachment
(Assume that the data in OBJBIN is in BMP format)
describe table l_objbin lines l_tab_lines.
l_objhead = text-001 .
append l_objhead.
clear l_objpack.
**/ Creation of the entry for the compressed/attached document
l_objpack-transf_bin = k_true.
l_objpack-head_start = 1.
l_objpack-head_num = 1.
l_objpack-body_start = 1.
l_objpack-body_num = l_tab_lines.
l_objpack-doc_type = 'PDF'.
l_objpack-obj_name = text-005.
l_objpack-obj_descr = text-001.
l_objpack-doc_size = l_tab_lines * 255.
append l_objpack. "/ .
delete l_reclist where receiver = ''.
Sending the document
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1' " IN UPDATE TASK "/ .
exporting
document_data = l_doc_chng
put_in_outbox = k_x
tables
packing_list = l_objpack
object_header = l_objhead
contents_bin = l_objbin
contents_txt = l_objtxt
receivers = l_reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
if sy-subrc <> 0.
write: / 'unsuccessful', sy-subrc.
else.
concatenate l_mail ',' l_mail1 ',' l_l_mail into l_recipents.
syst-msgid = '8I'.
syst-msgno = '000'.
syst-msgty = 'S'.
syst-msgv1 = text-008.
skip.
syst-msgv2 = text-009.
syst-msgv3 = l_recipents.
clear: syst-msgv4. "syst-msgv2, syst-msgv3,
perform protocol_update.
write: / 'successful'.
endif.
**/Take_note it is a requirement to do a commit work for the
email to go into transaction SOST.
COMMIT WORK. "/Take_note .
if sy-subrc eq 0.
endif.
Regards,
Sreeram
Similar Messages
-
How to send the Report output thru email
Dear All,
Is there a way to send the output of a abap report thru mail. I am sure it is there.
My report output is as following.
Emp Code : A01234
Name: XYZ
Email-ID: [email protected]
Dear XYZ,
You have Rs....... as outstanding. Please clear all dues by ..(date).
Thankyou,
asdf.
Please advice how to accomplish this. Send a sample source code if possible.
Regards,
Alok.Below you can find the sample code for sending the report as email.
Do use this as cross reference..
DATA: reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 0 WITH HEADER LINE,
so_ali LIKE soli OCCURS 0 WITH HEADER LINE,
list_index LIKE sy-lsind VALUE 0,
packing_list LIKE sopcklsti1,
docdata LIKE sodocchgi1,
tab_lines TYPE i,
l_rqident LIKE tsp01-rqident,
att_type LIKE soodk-objtp.
objtxt[] = mail_text[].
IF p_skip_attach IS INITIAL. " INS SIR 3971 TODD
SYSTEM-CALL LOAD LISTLEVEL-STACK INTO wrkstack.
IF wrkstack[] IS INITIAL.
SKIP 2.
WRITE: /30 text-001 COLOR 5.
ENDIF.
ENDIF. " INS SIR 3971 TODD
Prepare Receipient List
REFRESH: reclist.
LOOP AT rcpnt_userids.
IF rcpnt_userids-l_adr_name NA '@'.
reclist-receiver = rcpnt_userids-usrnam.
reclist-rec_type = 'B'.
reclist-express = 'X'.
ELSE.
reclist-receiver = rcpnt_userids-l_adr_name.
reclist-rec_type = 'U'.
reclist-express = 'X'.
ENDIF.
APPEND reclist.
CLEAR reclist.
ENDLOOP.
Prepare Doc Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
docdata-obj_langu = sy-langu.
docdata-obj_name = 'ABAP Listing'.
docdata-obj_descr = subject.
docdata-sensitivty = 'O'.
Prepare OBJPACK
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
att_type = 'ALI'.
DESCRIBE TABLE so_ali LINES tab_lines.
READ TABLE so_ali INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( so_ali ).
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 = subject.
APPEND objpack.
SAP supplied API function module to send Message
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 = so_ali
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_reclist = 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 i398(00) WITH 'SAP Office API Error'
sy-subrc
ENDIF. -
Need to send the report output in email body.
Hi Friends,
I need to send the report output in body of the email but not as an attachment.
Requesting your suggestions. Please elaborated answers are expected.
Thanks & Regards,
S.Suresh Babu.If you are looking for same output to be available in the email body, i think this is not possible.
If you are just concentrated on the data, then you can do as below.
1. In your custom program, submit the actual report program via spool and by making use of that spool, read the spool content (We have function modules which can download the content from spool to the internal table), and by making use of this internal table, build the actual internal table as required which will be passed to email function module lets say SO_OBJECT_SEND etc..
2. You can make use of even LIST_TO_MEMORY and LIST_FROM_MEMORY function modules as well instead of spool, if you have data in the final internal table.
I am not sure, how can we handle in terms of logos if any.....or the data in the top of page related things...... -
Send report output via email as zipped attachment
Is it possible for the report output to be zipped before being attached to an email when running on a windows reports_server? On unix we theoretically have the ability to modify the mail.sh shell script that performs the mail operation for reports.
Hi Richard
This is a Reports 9i solution.
You may create a batch file that runs the report, compresses the file and invokes, say, a Java application that mails the given .zip file.
More "advanced" options would be:
You may create a pluggable destination that captures report output. Next, your code does the compresses the output file and mails it.
A simpler solution would be to run two reports. First, that creates the reports output file. In its AFTER_REPORT trigger, call Java method (thru. Java Importer), that picks up the output file and compresses it. Second, that uses XML distribution feature of Reports 9i and mails the .zip file as a file attachment using appropriate construct.
Regard
Sripathy -
Hi all,
I have developed a report whose output is directed to email. The problem is the output is sent as an attachment to emil. I want the report output to be sent in body of email rather than as an attachment.
Thanx in advance
MurthyHi Tanikella,
You could use the Reports Distribution feature. You can find the introduction to distribution here:
http://otn.oracle.com/products/reports/htdocs/getstart/examples/Distribution/index.html
For more detailed information you can go to the document on "Publishing Reports to the Web" - see the chapter on Creating Advanced Distributions, esp section 9.4.2.1 (Email with whole report as body)
http://otn.oracle.com/docs/products/reports/content.html
Navneet. -
Transfer Report output to email body
Hi,
I have some problems in transferring my report output into the email body. As i know, there is a function to transfer the report output to the email as attachment. But for my current requirement, i would like to transfer the report output the the email body. My current report output is in table form and as i transfer the report output to the email body, it should be the same format as the report output in the email body. I am using write function to show this report. May i know how should i go about solving this problem?
Appreciate if you could help.
Thanks.
Regards,
RachelHi Rachel,
Check this sample program which uses the standard FM for sending email .
zdp_solisti1 is a structure having fields naming LINE of type LCHR and its length being 2500.
*******Email declarations
data : gv_delimit TYPE c,
lv_lncnt1(5) TYPE c,
tempread(10) TYPE c VALUE 0,
objpack TYPE sopcklsti1 OCCURS 0 WITH HEADER LINE,
objhead TYPE zdp_solisti1 OCCURS 1 WITH HEADER LINE,
objbin TYPE soli OCCURS 0 WITH HEADER LINE,
objtxt TYPE zdp_solisti1 OCCURS 0 WITH HEADER LINE,
reclist TYPE somlreci1 OCCURS 0 WITH HEADER LINE,
doc_chng LIKE sodocchgi1,
tab_lines LIKE sy-tabix.
CLEAR GV_DELIMIT.
GV_DELIMIT = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
TEMPREAD = LV_LNCNT1.
REFRESH OBJTXT.
CONCATENATE 'The no. of error records are : ' TEMPREAD
INTO OBJTXT-LINE.
APPEND OBJTXT.
CLEAR OBJPACK. REFRESH OBJPACK.
CONCATENATE C_CODE
C_CMMT
C_COMMENT1
INTO OBJTXT-LINE SEPARATED BY GV_DELIMIT.
APPEND OBJTXT.
LOOP AT IT_DATA INTO WA_DATA.
CONCATENATE WA_DATA-ZCODE
WA_DATA-ZCOMMENT
WA_DATA-ZREASON
INTO OBJTXT-LINE SEPARATED BY GV_DELIMIT.
APPEND OBJTXT.
ENDLOOP.
CLEAR GV_DELIMIT.
CLEAR OBJPACK. REFRESH OBJPACK.
CLEAR DOC_CHNG.
TAB_LINES = 0.
OBJHEAD = REJFILE. APPEND OBJHEAD.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-OBJ_NAME = REJFILE.
MOVE TEXT-006 TO
DOC_CHNG-OBJ_DESCR.
DOC_CHNG-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 = 1. " 3.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
FOR ASCII TO BINARY OBJECT FUNCTION
TOTLINEXFER = 0.
TOTXFER = 0.
BINMAXLEN = 255.
REFRESH OBJBIN.
LV_CR = CL_ABAP_CHAR_UTILITIES=>CR_LF.
TGTMAXLEN = BINMAXLEN.
TGTLEN = 0.
LOOP AT OBJTXT FROM 2.
IF NOT OBJTXT-LINE CP 'The no. of records are '." AND
CONCATENATE OBJTXT-LINE LV_CR INTO BUFFER.
SRCOBJLEN = STRLEN( BUFFER ).
SRCOBJPTR = 0.
WHILE SRCOBJLEN > 0 .
XFERLEN = TGTMAXLEN - TGTLEN.
IF XFERLEN > SRCOBJLEN.
XFERLEN = SRCOBJLEN.
MOVE BUFFERSRCOBJPTR TO OBJBIN-LINETGTLEN.
TGTLEN = TGTLEN + SRCOBJLEN.
SRCOBJLEN = 0.
CLEAR BUFFER.
ELSE.
MOVE BUFFER+SRCOBJPTR(XFERLEN) TO
OBJBIN-LINE+TGTLEN(XFERLEN).
APPEND OBJBIN.
CLEAR OBJBIN-LINE.
TGTLEN = 0.
SRCOBJLEN = SRCOBJLEN - XFERLEN.
SRCOBJPTR = SRCOBJPTR + XFERLEN.
TOTLINEXFER = TOTLINEXFER + 1.
ENDIF.
TOTXFER = TOTXFER + XFERLEN.
ENDWHILE.
ENDIF.
ENDLOOP.
IF TGTLEN > 0.
APPEND OBJBIN.
TOTLINEXFER = TOTLINEXFER + 1.
ENDIF.
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TOTLINEXFER.
OBJPACK-DOC_TYPE = 'XLS'.
OBJPACK-OBJ_NAME = REJFILE.
OBJPACK-OBJ_DESCR = 'Rejected Entries File'.
OBJPACK-DOC_SIZE = TOTXFER.
APPEND OBJPACK.
REFRESH RECLIST.
MAIL1 = 'xxxxxxxx' " Email Address
RECLIST-RECEIVER = MAIL1.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
As per your requirement, In the above program you need to fill OBJTXT with the contents of your internal table as per your requirement. This is the data which is displayed as the body of your mail.
Hope this is helpful to you. If you need further information, revert back.
Reward all the helpful answers.
Regards
Nagaraj T -
Publishing crystal report output in Email body
Hi,
I had a very basic requirement to broadcast/publish the output of crystal report in the email body of mail recepient. I have not found any options for this ans im able only to generate pdf outputs.
Thanks,
Ariel.Hi,
I also have the same requirement cn any one help me out with this.
Regards,
Pratik -
Dear Friend.
I would be appreciate, if someone help me to sort out the following.
. How to send Oracle Report output(.RDF) to email thr Application.
and what are prerequisites required.
Our current Platform Details:
OS : NT
RDBMS : ORACLE 8.0 (SERVER EDITION)
FORMS : 6.0 VER.
REPORTS : 6.0 VER.
And also pls. clarify the following details.
1. Is it possible to email Non-character mode report
2. what kind of tool required to see the email attachment.
3. Is it required modem on each client machine to enable email output.
4. Server computer itself any modem is required to enable email output.
pls. do this help. As I am not familiar in this Area.
Pls.Pls. send the reply to mail id ([email protected])
Thanks in Advance.
laila syedThis forum is for Forms questions. Please ask your question on the Reports forum.
Regards,
Robin Zimmermann
Forms Product Management -
ORALCEL REPORT OUTPUT TO EMAIL
Dear Friend.
I would be appreciate, if someone help me to sort out the following.
. How to send Oracle Report output(.RDF) to email thr Application.
and what are prerequisites required.
Our current Platform Details:
OS : NT
RDBMS : ORACLE 8.0 (SERVER EDITION)
FORMS : 6.0 VER.
REPORTS : 6.0 VER.
And also pls. clarify the following details.
1. Is it possible to email Non-character mode report
2. what kind of tool required to see the email attachment.
3. Is it required modem on each client machine to enable email output.
4. Server computer itself any modem is required to enable email output.
pls. do this help. As I am not familiar in this Area.
Pls.Pls. send the reply to mail id ([email protected])
Thanks in Advance.
Laila SYED.Hello,
Since Reports 9.0.2, you just have to "declare" the smtp server in the reports
server configuration file:
http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b14048/pbr_conf.htm#i1007098
Example
<pluginParam name="mailServer">smtp01.mycorp.com</pluginParam>
then, execute your reports with :
destype=mail desname=[email protected]
Regards -
Send the Report output to email from spool
Hi All,
The following process which i am doing to send the report output(Executed in background) to my mail id.
I ran the report in Background and got the output in the spool. i opened the spool from the transaction SM37 and send the output to my external mail id via the following process
click Spool Request->forward-> send SAP data
here i am getting one POP up in there i gave my mail id and tick the check box on Express and click copy.
Now i received the output in my mail .
By doing the above process in the Quality server i am receiving the output in the mail as a PDF format that is correct.(Output is also correct).
But when i execute the same in production server i am receiving the output in the mail as HTML format. (output and format is totally wrong). I want to know why its coming as HTML format instead of PDF format.
Kindly help me regarding this.. Any configuration is there? If yes please let me know soon..
Regards,
Navaneeth...Hi,
use scon, double-click on SMTP, select internet
and compare the types of you both SAP-Systems.
Hope it helps.
Regards, Dieter -
Send the report output in Email in the case of HR ABAP
Hi
how can i send the output of report in email when i am doin the HR ABAP report .
This report will be sheduled to run automatically every day.
If any body can help please send the answer.
Thanks.hi,
u have to use excel sheet attachment with mail.
u can put internal table data into excel sheet...
sample code...for attachment u have to use objbin..
clear objbin.
refresh objbin.
t<b>his is heading purpose</b>
CONCATENATE 'Name' 'PS No.' 'Grade' 'Location' 'OD' 'DOB'
INTO objbin SEPARATED BY con_tab.
CONCATENATE con_cret objbin INTO objbin.
APPEND objbin.
loop at it_email into wa_email.<<<<----intenal table
this is actual data from internal table
CONCATENATE
wa_email-emp_ename
wa_email-emp_pernr
wa_email-persk
loc
wa_email-od
wa_email-dob
INTO objbin SEPARATED BY con_tab.
CONCATENATE con_cret objbin INTO objbin.
APPEND objbin.
CLEAR objbin.
reclist-receiver = email.
reclist-rec_type = 'U'.
reclist-receiver = 'TC12'.
reclist-rec_type = 'B'.
APPEND reclist.
CLEAR objpack.
att_type = 'XLS'.<<<<<--attachment type
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'Attachment'.
objpack-obj_descr = 'Report.xls'.
APPEND objpack.
*Function module to send email with an attachment
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X'
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 sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
MESSAGE s899(m3) WITH 'Mail sent successfully!'.
ENDIF.
i hope it will be useful,
regards
vivek -
Send Report output as Email attachment (PDF)
Hi Experts,
i am trying to send the contents of an internal table from my report as email using PDF attachment. I have coded the logic and i get the attachment in the email. When i try to open the attachement, i cannot open it.
The message i get is "_Adobe reader could not open the attachment "attach.pdf" because it is either not a supported file type or the file has been damaged(for example, it was sent as an email attachment and wasn't correctly decoded )._
Not sure where i went wrong.
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[] = it_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. "send_file_as_email_attachmentHello RnB,
You can check the mentioned link for the same:
[Simple Program to generate PDF from ABAP List Output.|http://www.abapmadeeasy.com/2011/02/sap-abap-simple-program-to-generate-pdf.html]
Regards,
Uttam Agrawal -
Display Report Output in Email Body (EBS).
Hi,
I was wondering if it is possible to display the output of a BIP report within the body of an email using bursting instead of having the report in an attachment.
Thanks in advance
CarlHi Carl,
I use the API directly:
// Parse RTF og lav XSL
ByteArrayOutputStream xsl;
xsl = new ByteArrayOutputStream(1024);
RTFProcessor rtfProc = new RTFProcessor(rtfPath);
rtfProc.setOutput(xsl);
rtfProc.process();
xsl.flush();
xsl.close();
// Lave rtf udfra xml og det nye xsl
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(output));
ByteArrayInputStream xmlStream = new ByteArrayInputStream(xml);
FOProcessor foProc = new FOProcessor();
foProc.setTemplate(new ByteArrayInputStream(xsl.toByteArray()));
foProc.setData(xmlStream);
foProc.setOutput(bout);
foProc.setOutputFormat(FOProcessor.FORMAT_RTF);
foProc.generate();
bout.flush();
bout.close();
I can change the output format to HTML (haven't tried) -> and then send the email with contenttype html. Can I email directly via the api ? -
Sending reports output to email
Hi ,
I would like to send output of a report to email insted of printer. Are there any setting to be done. We are running on 11i.
Thanks
KiranPlease see the user manual.
Oracle Alert User's Guide
http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115alrug.pdf
Also, see old threads which discuss the same topic -- http://forums.oracle.com/forums/search.jspa?threadID=&q=Send+AND+E-mail+AND+Alert&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Thanks,
Hussein -
Can a SAP report output by email in excel format?
we have some batch jobs for SAP reports running & sending the result to user by email every month, currently the format only in PDF file, is it possible to send the reports as mail attachments in xls format?
Edited by: hcy h on Feb 3, 2010 4:11 PMHi,
It is possible. Please refer to the code:
http://wiki.sdn.sap.com/wiki/display/ABAP/SendExternalMailwithattachment
Regards,
Naveen
Maybe you are looking for
-
[INFO] SOA Suite 10.1.3.4 Patch Set #7272722
SOA Suite의 각 component에 대해 10.1.3.4에서는 아래와 같은 bug들이 fix되었습니다. 10.1.3.4. PatchSet은 기존의 10.1.3.x 버전들의 패치들을 모두 포함하고 있으므로 한 번에 업그레이드가 가능합니다. 자세한 설치 방법 등은 Metalink와 patch document를 참조하시기 바랍니다. =================================================== 2.4 Oracle
-
Data socket communication protocol
I am using the Data Socket protocol to communicate between two computers. And it works great. But the customer is asking for names and functions of the signals. I have looked at the NI website and I haven't found anything that explains what happens b
-
Have a brand new 4S which is very warm to the touch?
I have just activated a new 4S which is very warm to touch?
-
I downloaded IOS 7 today and now iBooks won't function on my iPad 2. The app opens and it goes to the library but none of the books will open. Any suggestions?
-
Changing color of Image in PSE 8.0
I have a logo design that is black on white. I'd like to change the black to another color - in this case, blue. I wqas able to do it, but it ended up being quite convoluted. What are some simple ways to change the color of a selected area in Elem