Email through report
Hello All,
I have done the z report in which i have called a function module so_new_send o send an email.
I am able to post an email from report to SOST transaction but from there a mail is not triggered.The status of the email is waiting for communication service.
it keeps waiting for communication service. do i need to enable some thing.
Please help on this issue.
Thanks in advance
Hi Anu,
This code can help you.
*Convert the Spool into PDF and send to
*External Email ID
*Applies To:
*SAP 4.7/Above
*Article Summary
*This report program will execute the given program with the specified variant in background and
*convert the spool request into PDF and send it as attachment to the specified Email ID.
*By: Elini.P
*Title: ABAP
*Date: 29 Apr 2005
*This is the code:
REPORT zpp430_report_in_pdf NO STANDARD PAGE HEADING LINE-SIZE 255.
*& Report ZPP430_REPORT_IN_PDF
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
TABLES: tsp01.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_repid LIKE sy-repid, " Report to execute
p_linsz LIKE sy-linsz DEFAULT 132, " Line size
p_paart LIKE sy-paart DEFAULT 'X_65_132', " Paper Format
p_slset LIKE sy-slset, "Variant name
p_odescr LIKE sodocchgi1-obj_descr,
p_adescr TYPE so_obj_nam,
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i,
mc_valid(1) TYPE c.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des,
mi_rqident LIKE tsp01-rqident.
* Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
w_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
DATA:
mstr_print_parms LIKE pri_params.
* Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
* WRITE 'Hello World'.
* NEW-PAGE.
* COMMIT WORK.
* NEW-PAGE PRINT OFF.
* IF SY-BATCH EQ 'X'.
* PERFORM GET_JOB_DETAILS.
* PERFORM OBTAIN_SPOOL_ID.
*** Alternative way could be to submit another program and store spool
*** id into memory.
*submit ZSPOOLTOPDF2
* to sap-spool
* spool parameters %_print
* archive parameters %_print
* without spool dynpro
* and return.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
authority = space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
* in_archive_parameters = space
* in_parameters = space
layout = space
mode = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
IMPORTING
out_parameters = mstr_print_parms
valid = mc_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF mstr_print_parms-pdest = space.
mstr_print_parms-pdest = 'LOCL'.
ENDIF.
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
SUBMIT (p_repid) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS mstr_print_parms
USING SELECTION-SET p_slset
AND RETURN.
* Get spool id from program called above
PERFORM get_spool_number USING sy-repid sy-uname CHANGING mi_rqident.
* IMPORT w_spool_nr FROM MEMORY ID SY-REPID.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
IF p_delspl EQ 'X'.
PERFORM delete_spool.
ENDIF.
IF sy-sysid = c_dev.
WAIT UP TO 5 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
* ELSE.
* SKIP.
* WRITE:/ 'Program must be executed in background in-order for spool'
* 'request to be created.'.
* ENDIF.
* FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
MESSAGE s004(zdd) WITH gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM. "OBTAIN_SPOOL_ID
* FORM get_job_details *
FORM get_job_details.
* Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM. "GET_JOB_DETAILS
* FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = mi_rqident
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. "CONVERT_SPOOL_TO_PDF
* FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
* perform send_email using p_email2.
ENDFORM. "PROCESS_EMAIL
* FORM send_email *
* --> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
* Default subject matter
gd_subject = p_odescr.
gd_attachment_desc = p_adescr.
* CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'This is an automated report from SAP.'.
APPEND it_mess_bod.
it_mess_bod = 'Please do not reply to this mail id.'.
APPEND it_mess_bod.
*IT_MESS_BOD = 'For any clarification on the details of this report'
* APPEND IT_MESS_BOD.
* IT_MESS_BOD = 'please contact Business Planning. Thank you'.
* APPEND IT_MESS_BOD.
* If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
* Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
TABLES it_mess_bod
it_mess_att
USING p_email
p_odescr
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
CHANGING gd_error
gd_reciever.
ENDFORM. "SEND_EMAIL
* FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM. "DELETE_SPOOL
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* Send email
FORM send_file_as_email_attachment TABLES it_message
it_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.
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.
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_ATTACHMENT
*& Form GET_SPOOL_NUMBER
* text
* -->P_SY_REPID text
* -->P_SY_UNAME text
* <--P_MI_RQIDENT text
FORM get_spool_number USING f_repid
f_uname
CHANGING f_rqident.
DATA:
lc_rq2name LIKE tsp01-rq2name.
CONCATENATE f_repid+0(9)
f_uname+0(3)
INTO lc_rq2name.
SELECT * FROM tsp01 WHERE rq2name = lc_rq2name
ORDER BY rqcretime DESCENDING.
f_rqident = tsp01-rqident.
EXIT.
ENDSELECT.
IF sy-subrc NE 0.
CLEAR f_rqident.
ENDIF.
ENDFORM. " GET_SPOOL_NUMBER
Regards,
Arun Sambargi.
Similar Messages
-
How to send notification to email through report programme?
I am do not have idea how to do it please help me.
Hi Abbu,
try this code, that may help u.
Sending mail with attachment using Object Oriented Approach - Code Gallery - SCN Wiki -
How to send mail through report??
hi experts....
i want to create a report to send an email to department representative when pending PO is created.
can some1 tell me how is it possible to send an email through report?
thanks..Refer the following programs:
<b>Mail sent without attachment:</b>
REPORT Z34332_MAIL.
* Check the mail in T-code SBWP
* To check the send mail status T-Code SOST
data: it_packing_list type table of SOPCKLSTI1,
wa_packing-list like line of it_packing_list,
it_receivers type table of SOMLRECI1,
wa_receivers like line of it_receivers,
it_mailbody type table of SOLISTI1,
wa_mailbody like line of it_mailbody.
data: la_doc type SODOCCHGI1.
* mail header
la_doc-OBJ_DESCR = 'HI'.
* Describe the body of the message
CLEAR wa_packing-list.
REFRESH it_packing_list.
wa_packing-list-transf_bin = space.
wa_packing-list-head_start = 1.
wa_packing-list-head_num = 0.
wa_packing-list-body_start = 1.
* DESCRIBE TABLE gt_mara LINES wa_packing-list-body_num.
wa_packing-list-body_num = 1.
wa_packing-list-doc_type = 'RAW'.
APPEND wa_packing-list to it_packing_list.
* Add the recipients email address
CLEAR wa_receivers.
REFRESH it_receivers.
wa_receivers-receiver = 'PCSDEVL'.
wa_receivers-rec_type = 'U'.
wa_receivers-com_type = 'INT'.
wa_receivers-notif_del = 'X'.
wa_receivers-notif_ndel = 'X'.
APPEND wa_receivers to it_receivers.
* Mail Body
CLEAR wa_mailbody.
REFRESH it_mailbody.
wa_mailbody-line = 'How are you.'.
APPEND wa_mailbody to it_mailbody.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = la_doc
PUT_IN_OUTBOX = 'X'
* SENDER_ADDRESS = SY-UNAME
* SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
tables
packing_list = it_packing_list
* OBJECT_HEADER =
* CONTENTS_BIN =
CONTENTS_TXT = it_mailbody
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>
mail with attachment:</b>
REPORT Z34332_MAIL_WITH_ATTACHMENT1.
types: begin of t_mara,
matnr type mara-matnr,
matkl type mara-matkl,
mtart type mara-mtart,
meins type mara-meins,
end of t_mara.
data: gt_mara type table of t_mara,
wa_mara like line of gt_mara,
it_packing_list type table of SOPCKLSTI1,
wa_packing_list like line of it_packing_list,
it_receivers type table of SOMLRECI1,
wa_receivers like line of it_receivers,
it_mailbody type table of SOLISTI1,
wa_mailbody like line of it_mailbody,
it_attachment type table of SOLISTI1,
wa_attachment like line of it_attachment.
data: la_doc type SODOCCHGI1.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
* get material
select matnr matkl mtart meins
into table gt_mara
from mara
up to 25 rows.
* Populate the subject/generic message attributes
la_doc-obj_langu = sy-langu.
la_doc-obj_descr = 'Material Details' . "Mail Header
la_doc-sensitivty = 'F'.
la_doc-doc_size = 1.
* Add the recipients email address
CLEAR wa_receivers.
REFRESH it_receivers.
wa_receivers-receiver = 'PCSDEVL'.
wa_receivers-rec_type = 'U'.
wa_receivers-com_type = 'INT'.
wa_receivers-notif_del = 'X'.
wa_receivers-notif_ndel = 'X'.
APPEND wa_receivers to it_receivers.
* Mail Body
CLEAR wa_mailbody.
REFRESH it_mailbody.
wa_mailbody-line = 'Please find the attachment'.
APPEND wa_mailbody to it_mailbody.
* Mail attachmwnt
CLEAR wa_attachment.
REFRESH it_attachment.
CONCATENATE 'MATNR' 'MATKL' 'MTART' 'MEINS'
INTO wa_attachment SEPARATED BY con_tab.
CONCATENATE con_cret wa_attachment INTO wa_attachment.
APPEND wa_attachment to it_attachment.
LOOP AT gt_mara INTO wa_mara.
CONCATENATE wa_mara-matnr wa_mara-matkl
wa_mara-mtart wa_mara-meins
INTO wa_attachment SEPARATED BY con_tab.
CONCATENATE con_cret wa_attachment INTO wa_attachment.
APPEND wa_attachment to it_attachment.
ENDLOOP.
* Describe the body of the message
CLEAR wa_packing_list.
REFRESH it_packing_list.
wa_packing_list-transf_bin = space.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 0.
wa_packing_list-body_start = 1.
wa_packing_list-body_num = 1.
wa_packing_list-doc_type = 'RAW'.
APPEND wa_packing_list to it_packing_list.
* Create attachment notification
wa_packing_list-transf_bin = 'X'.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 1.
wa_packing_list-body_start = 1.
DESCRIBE TABLE it_attachment LINES wa_packing_list-body_num.
wa_packing_list-doc_type = 'XLS'. " To word attachment change this as 'DOC'
wa_packing_list-obj_descr = ' '.
concatenate wa_packing_list-doc_type 'file' into wa_packing_list-OBJ_DESCR
separated by space.
wa_packing_list-doc_size = wa_packing_list-body_num * 255.
APPEND wa_packing_list to it_packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = la_doc
PUT_IN_OUTBOX = 'X'
* SENDER_ADDRESS = SY-UNAME
* SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
tables
packing_list = it_packing_list
* OBJECT_HEADER =
CONTENTS_BIN = it_attachment
CONTENTS_TXT = it_mailbody
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif. -
Having problemn in sending a report email through forms
Hi ALL,
I am trying to send an email a report through forms
It works for me in client side
I am just passing parameters and working fine in Client side
I am using forms 6i,reports6i and Oracle 8i
If i run the same form in web it is not doing anything
Any help
The code is below
PROCEDURE send_report (name varchar2) IS
rpt_id REPORT_OBJECT := find_report_object('GENERIC');
v_rep VARCHAR2(100);
rep_status varchar2(20);
errcode number;
RPT_DES VARCHAR2(200) := '[email protected],[email protected]';
BEGIN
SET_REPORT_OBJECT_PROPERTY(rpt_id,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY (rpt_id,REPORT_DESTYPE,MAIL);
SET_REPORT_OBJECT_PROPERTY (rpt_id,REPORT_DESFORMAT,'PDF');
SET_REPORT_OBJECT_PROPERTY (rpt_id,REPORT_DESNAME,RPT_DES);
SET_REPORT_OBJECT_PROPERTY (rpt_id,REPORT_FILENAME,name||'.rep');
v_rep := RUN_REPORT_OBJECT(rpt_id);
do_key('clear_form');
EXCEPTION
when form_trigger_failure then null;
END;Hi,
on the Web you need to configure the Reports Server for sending emails, not the runtime.
Frank -
Email a Report through Report Parameter
Hi
I want to email a report through MAPI. There is Mail Parameter available in Destination Type list but when I run report after giving this Mail Parameter then message "Mail Sub System Initialization error" comes.
Pl help me out.
Thanks & Regards
PreetiI have same problem. Can you send me the solution if you are solved. Here's my mail -ID : [email protected]
-
Convert the spool to xls format and email through attachment to the user
Hi all,
When I execute a report in background, I get spool. I need to convert the spool to xls format and email through attachment to the user.The xls file should not be saved on local system.
If I use the Spool Recepient tab in SM37 it mails the spool list as .txt file to the mail receipient. But I need to send it as an .xls file.
Can any one help me on thisDid you get the solution? i have the same problem.
-
Emailing Crystal Report in email body as HTML
I'm having a problem sending emails in CR 2008 when the report is displayed as HTML in the body of the email.
This code works in my development environment but it doesn't work in the testing environment when CR 2008 is installed using a .msi with CR merge modules:
ExportOptions crExportOptions = new ExportOptions();
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.HTML40;
HTMLFormatOptions htmlOpts = ExportOptions.CreateHTMLFormatOptions();
htmlOpts.HTMLBaseFolderName = tempPath;
htmlOpts.HTMLFileName = fileName;
htmlOpts.HTMLEnableSeparatedPages = false;
htmlOpts.HTMLHasPageNavigator = false;
htmlOpts.UsePageRange = false;
crExportOptions.ExportFormatOptions = htmlOpts;
_reportDocument.Export(crExportOptions);
using (StreamReader r = File.OpenText(tempPath + "\\" + Path.GetFileNameWithoutExtension(_template.TemplateName) + "\\" + fileName))
html = r.ReadToEnd();
When _reportDocument.Export(crExportOptions) is called this error is thrown:
Invalid export options.
I'm I doing something wrong with code, or do I need to do change something in my testing environment to get this to work?
Testing Environment:
Windows 2003 Server
2008 CR SP1 Merge Modules
.Net 3.5 SP1
Thanks in advance,
DaveSince it works on your dev system then it is likely not a code issue. I suspect there is a runtime file difference between your dev and staging system. Use [Modules|https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip] to see if you can spot the difference. You'll need to run this on both systems while your app is running.
On your dev system, go through the procedure of exporting and emailing your report. Then run modules while the app is still running.
On your staging system, go through the same procedure until you get the error. Leave the error on the screen and run modules.
Finally, compare the two mdl log files using modules differences feature. -
EIS 6.5.1 Drill through Reports - Urgent
Hi all, Is there any limitaion on number of fields in the EIS drill through reports. It seems it accepts only 10 columns, rest of the column data is not properly displayed. Please update me on this.thanksSels
We ran into this problem a while ago. It seems that after 10 columns, formatting get really odd. We submited it as a bug a number of months ago.Glenn S.Narratus [email protected]
-
EIS 6.5.1 - Drill through report
Hi all,Is there any limitaion on number of fields in the EIS drill through reports. It seems it accepts only 10 columns, rest of the column data is not properly displayed.
We ran into this problem a while ago. It seems that after 10 columns, formatting get really odd. We submited it as a bug a number of months ago.Glenn S.Narratus [email protected]
-
so i had changed my email on itunes a while agobut today something popedup on my iphone screen so what can i do to change my email through my icloud on my iphone because it wont let e facetime and its making me madd????? PLEASE HELP ME FIX IT!?!!?!?!?!?
There is nothng special you can do without wifi being on.
Report it to the school and change the passwords for all accounts used on the iPod. Apple will not help with anything. -
Hi all I am trying to send email through forms
I am using the following command at when button pressed
But i couldn't see that email is going
any help please
Host('rwrun60.exe c:/example.rdf oracle/oracle@oracle
destype=mail desname= [email protected] desformat=pdf batch=yes');
Thanks for your help
ThanksFirstly you should try and run the command outside of Forms to see if the command works as expected.
You should also take a look at using the integrated functionality that Forms/Reports has, through either the run_product() or run_report_object() commands (note that run_product() is deprecated in the 9i release).
Hope this helps,
Danny -
Hi,
i got a email functionality requirement , i need to send the report output to recipient inbox as an attachment, through outlook.
i know how to send email from sap, but through outlook i am not aware,
how to send email through outlook.
can any one please help me.
Thanks In Advance
raagatiHi,
check below link.
How to send email from outlook to SAP inbox -
Sending email with report as attachment
Dear folks,
I'm using [this |http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] package to send emails through database, and it works.
My question is: how to attach report to email which is sent by this package?
Any help on this would be highly appreciated.
Regards,
AdnanadnanBIH wrote:
Dear folks,
I'm using [this |http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] package to send emails through database, and it works.
My question is: how to attach report to email which is sent by this package?
Any help on this would be highly appreciated.
Regards,
AdnanDear Adnan. I've written a blog post on this subject. You can view it from the following link:
http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/ -
Can we send bulk email through exchange server 2010
can we send bulk email through exchange server 2010
You can do this however not sure I would recommend that since if people complain they are getting spammed it could effect your production servers domain/IP, i.e. it could get black listed. Personally I always recommend using a different system for
email blast to protect my production IP addresses and also to keep the load off of exchange as well as email marketing systems have built in capabilities for reporting, opt in/out capabilities etc.
All of that said perhaps you can tell us more about what exactly it is you want to do and how often?
Search, Recover, & Extract Mailboxes, Folders, & Email Items from Offline Exchange Mailbox and Public Folder EDB's and Live Exchange Servers or Import/Migrate direct from Offline EDB to Any Production Exchange Server, even cross version i.e. 2003 -->
2007 --> 2010 --> 2013 with Lucid8's
DigiScope -
Send Email through abapprograming
hi
actualy i have a document and i want to send it to sombody inbox through email in sap-abap.
i need step by step creation of email through abaphi,
check this program, this program upload the file in 'BIN' binary form from presentation server into internal table and convert data in word formate and send as a mail to our inbox
Code
REPORT ztest_upload_worddata.
PROGRAM : ztest_upload_worddata *
PROGRAM TITLE : SALES ORDER REPORT *
AREA : SD *
AUTHOR : *
CREATED ON : 08/04/2008 *
OBJECT TYPE : abap object Report
DESCRIPTION : This report describes how to send a mail in "WORD
DOCUMENT" by uploading file from PRESENTATION
SERVER using GUI-UPLOAD.
*Tables *
TABLES: vbak.
Internal-tables *
DATA: BEGIN OF it_vbak OCCURS 0,
vbeln TYPE vbeln,
erdat TYPE erdat,
ernam TYPE ernam,
END OF it_vbak.
*DATA: it_vbak TYPE TABLE OF st_vbak WITH HEADER LINE.
Variables *
DATA: p_filename_str TYPE string.
PARAMETERS: p_mail TYPE ad_smtpadr OBLIGATORY DEFAULT
'enter concernd email here in single cotts'
*CLASS-DEFINITIONS *
DATA: send_request TYPE REF TO cl_bcs.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: exception_info TYPE REF TO if_os_exception_info,
l_uname TYPE salrtdrcpt,
l_bcs_exception TYPE REF TO cx_document_bcs,
l_send_exception TYPE REF TO cx_send_req_bcs,
l_addr_exception TYPE REF TO cx_address_bcs,
bcs_exception TYPE REF TO cx_bcs.
INTERNAL TABLES *
DATA: l_mailtext TYPE soli_tab.
DATA: l_mailhex TYPE solix_tab.
DATA: iaddsmtp TYPE bapiadsmtp OCCURS 0 WITH HEADER LINE.
DATA: ireturn TYPE bapiret2 OCCURS 0 WITH HEADER LINE.
VARIABLES *
DATA: mail_line LIKE LINE OF l_mailtext.
DATA: mailx_line LIKE LINE OF l_mailhex.
DATA: bapiadsmtp TYPE bapiadsmtp.
DATA: l_lines TYPE i.
CONSTANTS *
*CONSTANTS:
intelli_domain(20) TYPE c VALUE '@intelligroup.com'.
*CLASS cl_cam_address_bcs DEFINITION LOAD.
*CLASS cl_abap_char_utilities DEFINITION LOAD.
Constants----
CONSTANTS: c_tab(1) TYPE c VALUE
cl_abap_char_utilities=>horizontal_tab,
" Tab Character
c_cr(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
" Line Feed for End-Of_line
c_ext TYPE soodk-objtp VALUE 'BMP'. " doc Extension.
CLASS cl_cam_address_bcs DEFINITION LOAD.
CLASS cl_abap_char_utilities DEFINITION LOAD.
*DATA: CONTROL_PARAMETERS TYPE SSFCTRLOP,
OUTPUT_OPTIONS TYPE SSFCOMPOP,
JOB_OUTPUT_INFO TYPE SSFCRESCL,
JOB_OUTPUT_OPTIONS TYPE SSFCRESOP,
DATA: string_data TYPE xstring,
file_size TYPE i,
lines TYPE TABLE OF tline .
selection-screen *
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_filnam TYPE ibipparms-path.
SELECTION-SCREEN : END OF BLOCK b1.
at selection-screen on value-request *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filnam.
PERFORM fareeda.
*LOOP AT it_xstring into ls_xstring.
*concatenate imp_xstring ls_xstring into imp_xstring.
*ENDLOOP.
*& Form f4_help_p_filnam
text
--> p1 text
<-- p2 text
FORM fareeda .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_filnam
ENDFORM.
START-OF-SELECTION
START-OF-SELECTION.
Start-of-selection *
p_filename_str = p_filnam.
data: begin of it_bin occurs 0,
data(1028) type x,
end of it_bin.
*data : it_xstring type table of xstring,
ls_xstring like xstring,
data: imp_xstring type xstring.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_filename_str
filetype = 'BIN'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
IMPORTING
filelength = l_lines
header = string_data
TABLES
data_tab = it_bin
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = l_lines
FIRST_LINE = 0
LAST_LINE = 0
IMPORTING
BUFFER = imp_xstring
TABLES
binary_tab = it_bin
EXCEPTIONS
FAILED = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--Using SOLIX Converting string data
DATA: lt_solix TYPE solix_tab.
DATA: LT_SOLI TYPE SOLI_TAB.
DATA: docdata TYPE sood-objdes.
DATA: l_size TYPE sood-objlen.
CALL METHOD cl_document_bcs=>xstring_to_solix
EXPORTING
ip_xstring = imp_xstring
RECEIVING
rt_solix = lt_solix
TRY.
*-- Create persistent send request
send_request = cl_bcs=>create_persistent( ).
DATA: first(1) TYPE c.
CLEAR first.
DATA: lt_text TYPE soli_tab.
DATA: ls_text TYPE soli.
ls_text-line = 'THIS IS TEST DATA'.
APPEND ls_text TO lt_text.
CLEAR ls_text.
ls_text-line = 'THIS IS TEST DATA'.
APPEND ls_text TO lt_text.
CLEAR ls_text.
document = cl_document_bcs=>create_document(
i_type = 'txt'
i_text = lt_text
i_subject = 'subject' ).
Preparing contents of attachment with Change Log
PERFORM prepare_attachment.
DESCRIBE TABLE it_vbak LINES l_lines.
Size to multiplied by 2 for UNICODE enabled systems
l_size = l_lines * 2 * 255.
REFRESH l_mailhex.
move l_lines to l_size .
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = c_ext
i_attachment_subject = docdata
i_attachment_size = l_size
i_att_content_text = l_mailtext
i_att_content_hex = lt_solix.
i_attachment_header = LT_SOLI.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = c_ext
i_attachment_subject = docdata
i_attachment_size = l_size
i_att_content_text = l_mailtext
i_att_content_hex = lt_solix
i_attachment_header = l_mailtext.
*--Add document to send request
CALL METHOD send_request->set_document( document ).
*-- Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
*--Add sender
l_uname = sy-uname.
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
recipient = cl_cam_address_bcs=>create_internet_address( p_mail
*--Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'U'
i_copy = 'X'
i_blind_copy = ' '
i_no_forward = 'X'.
*--set send immediately flag
send_request->set_send_immediately( 'X' ).
*--Send document
CALL METHOD send_request->send( ).
COMMIT WORK.
CATCH cx_document_bcs INTO l_bcs_exception.
CATCH cx_send_req_bcs INTO l_send_exception.
CATCH cx_address_bcs INTO l_addr_exception.
ENDTRY.
*& Form PREPARE_ATTACHMENT
FORM prepare_attachment.
FIELD-SYMBOLS: <lfs_table>, " Internal table structure
<lfs_con>. " Field Content
DATA: l_text TYPE char1024. " Text content for mail attachment
DATA: l_con(50) TYPE c. " Field Content in character format
Columns to be tab delimeted
LOOP AT it_vbak ASSIGNING <lfs_table>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
TO <lfs_con>.
IF sy-subrc NE 0.
CONCATENATE c_cr l_text INTO l_text.
APPEND l_text TO l_mailtext.
EXIT.
ELSE.
CLEAR: l_con.
MOVE <lfs_con> TO l_con.
CONDENSE l_con.
IF sy-index = 1.
CLEAR: l_text.
MOVE l_con TO l_text.
ELSE.
CONCATENATE l_text l_con INTO l_text
SEPARATED BY c_tab.
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
ENDFORM. " PREPARE_ATTACHMENT
Reward Ponts To All Helpfull Answers
Regards
Fareeeda
Maybe you are looking for
-
Service tax value required updating while posting GR in MIGO transaction
Dear Friends, We have a following scenario where service tax value required updating while posting Goods Receipt MIGO transaction. 1. Purchase Order created for first line item where Qty. 1 and Net Rate Rs.1000/- so total Gross value will be Rs.1000/
-
Gcc 3.2.3 = gcc 3.3
I'm not too familiar with upgrading gcc... should it be completely transparent? or should I expect to run into some problems? I've moved to gcc3.3 from 3.2.3 and then I was trying to install openoffice and I get the following error from trying to run
-
Batch changes don't function. From simple commands like "rotate clockwise" to "lift and stamp" the command only affects to the last image in the group selected. Similar problems? Solutions? Suggestions? Thanks, Bruce
-
Leopard 10.5.3 broke my FCE
I just upgraded to 10.5.3 from 10.5.2. When I start FCE, the splash screen displays and then right when I think that I am going to see the browser window, etc., FCE shuts down with any error message. Any ideas?
-
Firefox recently started crashing
I am using windows 8.1 64bit These are the past 5 crash reports. I do notice the memory usage shoots up for no apparent reason. Nothing new has been installed on the computer in the past 6 months. Basically only updates are the standard windows, fire