Send Email an report
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
Thanks
Firstly 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
Similar Messages
-
Problem in Sending email from Reports Queue Manager
Hi
I am getting problem in sending email from reports queue manager.
It says that error in logging to mail server.
If any body knows the sol then pl help me out.
thanksHi
I am getting problem in sending email from reports queue manager.
It says that error in logging to mail server.
If any body knows the sol then pl help me out.
thanks -
Hi
I am trying to send emails with reports from BW 3.5. I do not want to use external SMTP servers.
I did some steps according help.sap.com document "External Sending in SAP System". I have problem with configuring RFC destinations for Mlunxsnd. I am supposed to put the filepath to Mlunxsnd program but I do not have one.
Where can I find it or maybe use another porgram instead?
BR/marekI have already done this. I tried to connect to Corporate Exchange server.
I've set SMTP node in SCOT transaction, but when I send message (system->short message) I got an error "Message cannot be transferred to node SMTP due to connection error (final)".
I do not kon what's going on thus SMTP node is set and SMTP service is active (trasaction SICF).
Has anybody met that problem?? All cues welcome.
BR/marek -
Send email when report has error status
Hi Gurus,
Is there any possible way through which i can send an email only when we come across an error report in B2B 10g.
Note: Error report means when the status of the report shows error at the console.
Any suggestions will be appreciated.
Regards
AyushHi Ayush,
If I got it right then you want to send Email notification in case an error occurs in Oracle B2B. You can definitely do it.
Monitor the error queue (by default IP_IN_Queue) and dequeue messages for B2BERRORUSER. using a BPEL/java utility. Using same utilities you may send Email notification.
Please let us know if you are lokking for something else.
Regards,
Anuj -
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/ -
Send email when report data updated on report server
Hii all
please clear me what this triggers functions from me??
i want to send report email to boss when report data updates on server
i have used this but neither subscription shows last run time nor email get sent.
how can i do this??
Dilip Patil..Hii all
please clear me what this triggers functions from me??
i want to send report email to boss when report data updates on server
i have used this but neither subscription shows last run time nor email get sent.
The so-called "trigger" is nothing than "when the snapshot has been updated". In other words: it's not the actual data that has changed but a new
snapshot has been created, which in turn has it's own schedule.
The wording "trigger" is a bad choice since when it has been introduced and has irritated many people since then.
For a custom solution check this thread:
Triggering Data Driven Subscriptions in SSRS
Andreas Wolter (Blog |
Twitter)
MCM - Microsoft Certified Master SQL Server 2008
MCSM - Microsoft Certified Solutions Master Data Platform, SQL Server 2012
www.andreas-wolter.com |
www.SarpedonQualityLab.com -
Send email to "reports to" via WF
Folks
I would like, via WF to send an email to any users "reports to" contact.
For example, a user creates an account. I would like via WF to send and email to his boss or the person who is configured as "reports to2 in the users object.
Thanks
PaulHi Paul,
Create a workflow with the following info.
Record Type - Account
Active - Y
Trigger Event - When new record saved.
WF Actions
Send Mail*
Active - Y
From - Current User
To - Relative User On Record - Account Owner's Manager
Subject - Include the subject that you want to displayed in subject of the mail.
Body - Include your Email msg body.
Hope that helps !
Thanks & Regards
Sablok -
Server 2012 - Send Email on Reboot
Hello all,
In Windows Server 2012, the 'send an email' action in task scheduler has been deprecated. For our 2008 and 2008 R2 servers, we used this feature to send an email to the IT department whenever Event ID 1074 appeared. Now, we do have VMWare (for virtual servers)
and our monitoring agent send emails to report when the machines go offline, but they don't always get caught and it's just nice to have the safeguard.
We have set up a script with the trigger being Event ID 1074. The script works if you launch the ps1 file manually or start the task manually, however, when you reboot the server the email does not get sent. The task scheduler shows the 'Last Run Result'
as being 'A system shutdown is in progress. (0x8007045B).
We are using a designated user with admin and 'logon as batch file' privileges and like I said, manually executing the script sends the email we are looking for.
The same script can be used with the trigger 'At System Startup' and it is successful, but we would prefer to do it when the system is going down rather than coming up.
Here is our script:
<# UPDATE variables for str SERVER AND LOCATION #>
$strServer = "OurServer"
$strLocation = "OurLocation"
$mailServer = "mail.server.com"
$mailSubject = “Reboot- $strServer”
$mailmessage = “The server, $strServer located in $strLocation has been rebooted. Based on System EventID 1074"
Send-MailMessage -To “OurEmail <[email protected]>" -From “$strServer <$[email protected]>" -SMTPServer $mailServer -Subject $mailSubject -Body $mailmessage
Any assistance/tips would be greatly appreciated.Hi KSllT,
In addition to the suggestion of tim .
Please check whether "system" account has access permission of the script folder .
Also you can try to set "run windows powershell scripts first" in shutdown properties :
Best Regards
Elton JI
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Reg: sending an email using report server
Hi,
i am using the below code to send an email using the report server.
When send button Click:
DECLARE
PL_ID ParamList;
repid REPORT_OBJECT;
v_rep varchar2(100);
rep_status varchar2(20);
l_host_name varchar2(50);
l_port_num varchar2(10);
l_server_name varchar2(50);
l_month_name varchar2(20);
l_from varchar2(50);
l_to varchar2(50);
l_cc varchar2(50);
l_property varchar2(1000);
l_sub_out varchar2(200);
l_sub varchar2(400);
L_BODY VARCHAR2(1000);
l_email_dir varchar2(50);
BEGIN
l_sub:=:block1.number||' '||replace(replace(:block1.desc,'&','ampersand'),'''','$quote');
if length(l_sub) >150 then
l_sub_out:=substr(l_sub,0,150);
else
l_sub_out:=l_sub;
end if;
l_host_name := (i used my host ip address local host);
l_port_num := '8889';
l_email_dir := 'C:\forms\';
l_from := [email protected];
l_cc := [email protected];
L_BODY:=' Please refer to the attached abc Report';
repid := find_report_object('PRINT_REPORT');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,'abc');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,MAIL);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'PDF');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,l_server_name);
go_block('abc_MAIL_TO');
first_record;
if :abc.email_address is not null then
loop
l_to:=:abc.email_address;
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER, 'paramform=no DISTRIBUTE=YES DESTINATION='||l_email_dir||'test.xml'||' '||
' p_2='|| TO_CHAR(:control.sessionid)||' '||'P_ID='||TO_CHAR(:block1.ID)||' '
||'P_LIST_TYPE='||'A'||' '
||'DISTRIBUTE=YES DESTINATION=test.xml'||' '
||'P_FROM='||''''||l_from||''''||' '
||'P_SEND='||''''||l_to||''''||' '
||'P_CC='||''''||l_cc||''''||' '
||'P_FILE='||'C:\testfile.txt'||' '
||'p_email_path='||l_email_dir||' '
||'P_BODY='||''''||l_body||''''||' '
||'P_NUM='||''''||'Email report: '||l_sub_out||'''');
v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
IF rep_status = 'FINISHED' THEN
null;
ELSE
message(rep_status);
message('Error when sending email to: '||l_to);
END IF;
if :system.last_record='TRUE' then
exit;
else
next_record;
end if;
end loop;
end if;
message ('Mail has been sent.');
END;
In the report:
I created all the required parameters and i wrote a trigger as
function AfterPForm return boolean is
dst_file text_io.file_type;
l_email_dir varchar2(50);
begin
dst_file := text_io.fopen(:p_email_path||'test.xml','w');
text_io.putf(dst_file, '<destinations>'||chr(13));
text_io.putf(dst_file, '<mail id="ex1" '||chr(13));
text_io.putf(dst_file, 'from="&P_FROM"'||chr(13));
text_io.putf(dst_file, 'to="&P_SEND"'||chr(13));
text_io.putf(dst_file, 'cc="&P_CC"'||chr(13));
text_io.putf(dst_file, 'subject="&<P_NUM>">'||chr(13));
text_io.putf(dst_file, '<body srcType="text">'||chr(13));
text_io.putf(dst_file,'<![CDATA>'||chr(13));
text_io.putf(dst_file, '</body>'||chr(13));
text_io.putf(dst_file, '<foreach>'||chr(13));
text_io.putf(dst_file, '<attach format="pdf" name="report.pdf" srcType="report" instance="all">'||chr(13));
text_io.putf(dst_file, '<include src="mainSection"/>'||chr(13));
text_io.putf(dst_file, '</attach>'||chr(13));
text_io.putf(dst_file, '</foreach>'||chr(13));
text_io.putf(dst_file, '</mail>'||chr(13));
text_io.putf(dst_file, '</destinations>'||chr(13));
text_io.fclose(dst_file);
return (TRUE);
end;
Then after compilation i click the button send. Then i got the message as
Mail has been sent to [email protected].
But i didn't receive any mail.
then i check the report job id. It was showing job was successful .
And i check whether the test.xml file was created or not. It has created the test.xml file as below:
<destinations>
<mail id="ex1"
from="&P_FROM"
to="&P_SEND"
cc="&P_CC"
subject="&<P_NUM>">
<body srcType="text">
<![CDATA Please refer to the attached abc Report]>
</body>
<foreach>
<attach format="pdf" name="report.pdf" srcType="report" instance="all">
<include src="mainSection"/>
</attach>
</foreach>
</mail>
</destinations>
I have 2 machines having dev 10g. one machine is working fine with this code. but in my machine it was not working.
Do any one of you had a solution for my case.
Thanks in advance.
Edited by: user648380 on Dec 29, 2009 5:59 PMSorry to all.
I made a mistake in the from email address.
Instead of gmail.com i had given gmail,com
I am really sorry about it. -
Need to Generate PDF file and send it to customer through email-ALV report
HI All,
I am having data in Internal table.
can we create PDF file with out having spool-request number.
My requirement is whenever user clicks on execute button the output is generated in PDF format automatically and then send it to customer through email.
I found few programs in SDN for generation PDF. But problem is everyone passing the spool request to the function module.
spool request will be generated whenever we click on print button.
Am I correct?.
Is there any other way to create spool request automatically. If so we can pass the this spool number to the function module.
Regards,
vinod.hi
For sending a mail, this code will help you.
Pls reward if help.
FORM send_mail_2 USING msgid msgno msgv1.
mailuser oder Gruppe like sy-uname default 'Ruckerk'.
DATA: express_hold_time LIKE sovaltime.
DATA: text LIKE sotxtinfo.
DATA: receiver LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
MESSAGE ZF100 (FTP an UDB fehlgeschlagen)
text-msgid = msgid.
text-msgno = msgno.
text-msgv1 = msgv1.
text-msgv2 = ' '.
text-msgv3 = ' '.
text-msgv4 = ' '.
express_hold_time
express_hold_time-days = 01.
express_hold_time-h_min_sec = 240000.
receiver
receiver-receiver = mreceivr.
Gruppe von Empfängern
receiver-rec_type = 'C'.
und Expressmeldung ausgeben
receiver-express = 'X'.
APPEND receiver.
CALL FUNCTION 'MESSAGE_SEND_AS_MAIL'
EXPORTING
msgid = text-msgid
msgno = text-msgno
msgv1 = text-msgv1
msgv2 = text-msgv2
msgv3 = text-msgv3
TABLES
receivers = receiver.
IF sy-subrc <> 0.
WRITE:/ 'hat nicht geklappt', 'SY-SUBRC =', sy-subrc.
ENDIF.
PERFORM print_error_report.
Fehlermeldung zum Abbrechen des Report's ausgeben.
MESSAGE e398 WITH 'Jobabbruch' msgv1.
ENDFORM. " SEND_MAIL_2
Another Program:
*& Report ZSENDEMAIL *
*& Example of sending external email via SAPCONNECT *
REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default '[email protected]' .
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form POPULATE_MESSAGE_TABLE
Adds text to email text table
form populate_message_table.
Append 'Email line 1' to it_message.
Append 'Email line 2' to it_message.
Append 'Email line 3' to it_message.
Append 'Email line 4' to it_message.
endform. " POPULATE_MESSAGE_TABLE
*& Form SEND_EMAIL_MESSAGE
Send email message
form send_email_message.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
append it_receivers.
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM -
How to send Oracle AS report automatically by email
Dear Gurus,
I would like to generate a Oracle report automatically and send it by Email. so for that I am trying by using below command
C:\home\BIN\rwclient server=rep_servername_FRHome report=C:\reportpath\report.rdf userid=username/password@aliasname desformat=pdf destype=mail desname=[email protected] Parameter1=xxxxx parameter2=xxxxxx parameter3=xxxx parameter4=xxxx
But I am getting below error.
REP-0177: Error while running in remote server
Executed successfully but there were some errors when distribute the output.
But if i tried to generate the output as a file in local machine its working fine and below comand is generating report on local desk
C:\home\BIN\rwclient server=rep_servername_FRHome report=C:\reportpath\report.rdf userid=username/password@aliasname desformat=pdf DESTYPE=file DESNAME=C:\report\reportname.pdf Parameter1=xxxxx parameter2=xxxxxx parameter3=xxxx parameter4=xxxx
My only problem is by using rwclient I am unable to send Email
Please help me on this.
Regards,
Satish Kumar SadhuDear Friends,
I have resolved the issue by putting my smtp server on servicename.conf -
Send Email Report with Publisher? and Job Manager...
Hi, i have a great Doubt, i try to send Email with a report, first i try to send with Publisher, this is all configurations.
Delivery Configuration
!http://lh3.ggpht.com/_V2lpPpulbm0/Slwm-4TLiJI/AAAAAAAACag/xZ5w57zkRnM/s800/BI%20Publisher.PNG!
Email Configuration
!http://lh5.ggpht.com/_V2lpPpulbm0/Slwm_PKsjVI/AAAAAAAACak/baCeaA9kV_s/s800/BI%20Publisher2.PNG!
Configuration Send Parameters
!http://lh5.ggpht.com/_V2lpPpulbm0/SlwroVMXh4I/AAAAAAAACao/0-UaglX4N5Y/s512/configuracionparametros.PNG!
But when i submit.. i have an error: "Must issue a STARTTLS comand first",*this error* means that Gmail Server not suporter?
Do you know Some Mail Company to Rrealize some test.
!http://lh3.ggpht.com/_V2lpPpulbm0/Slwm-8g_LJI/AAAAAAAACac/1CeWNWZLL18/s640/errorpublisher.PNG!
But... It is neccesary configurate Job Manager? why is necessary configurate Publisher and Job manager, is the same? or Each one is in use for a different thing, all forms i post my Job Manager configuration too.
!http://lh4.ggpht.com/_V2lpPpulbm0/Slwm-X7idrI/AAAAAAAACaU/eq_N_Rloqjs/s576/SchedulerConfiguration.PNG!
thanks all and sorry for Spam Images(I think You comprehension better me). i have an error: "Must issue a STARTTLS command first",this error means that Gmail Server not suporter? yes gmail will not support to send emails from this......because our accounts are free...
Try with your corporate mail ids it will work.
It is neccesary configurate Job Manager? why is necessary configurate Publisher and Job manager, is the same? or Each one is in use for a different thing Bi Publisher will not use Job manager mail settings.....If yes ,why we need to configure the mail settings in BIPublisher itself??
Two things are different......
thanks,
Saichand.V -
Schedule webi report to destination to Inbox AND send email notification
I'm writing a new process that will schedule a webi report. The output of the report needs to be delivered to multiple user's BO Inboxes AND an email notification (without the report attached) needs to be sent telling them that they have a new report to view in their Inbox. Trying to mimic how this is done via CMC Schedule - Notification and Destination tabs.
I can get it to deliver the report to the Inbox and I can get it to send an email seperately, but the problem I'm running into is that I can't get it to do both in the same process. Here is the code snippet that I've written. Any assistance would be appreciated.
// Retrieve the managed plugin
IInfoObjects managedInfoObjects = infoStore.query("Select SI_DEST_SCHEDULEOPTIONS, SI_PROGID From CI_SYSTEMOBJECTS Where SI_NAME = 'CrystalEnterprise.Managed'");
IInfoObject infoObject = (IInfoObject)managedInfoObjects.get(0);
IDestinationPlugin destinationPlugin = (IDestinationPlugin)infoObject;
IManaged managed = (IManaged)destinationPlugin;
// Set the destination to inbox
IManagedOptions managedOptions = (IManagedOptions)managed.getScheduleOptions();
managedOptions.setDestinationOption(IManagedOptions.CeDestinationOption.ceInbox);
managedOptions.setSendOption(IManagedOptions.CeManagedSendOption.ceCopy);
managedOptions.setIncludeInstance(true);
managedOptions.getDestinations().add(new Integer(ditUserID1));
managedOptions.getDestinations().add(new Integer(ditUserID2));
managedOptions.getDestinations().add(new Integer(ditUserID3));
scheduleInfo.getDestination().setFromPlugin(managed);
// Retrieve the smtp plugin. to send email notification
IInfoObjects smtpInfoObjects = infoStore.query("Select SI_DEST_SCHEDULEOPTIONS, SI_PROGID From CI_SYSTEMOBJECTS Where SI_PARENTID = 29 AND SI_NAME = 'CrystalEnterprise.Smtp'");
IInfoObject smtpInfoObject = (IInfoObject)smtpInfoObjects.get(0);
IDestinationPlugin smtpDestinationPlugin = (IDestinationPlugin)smtpInfoObject;
// Set to email notification on success
ISMTP smtp = (ISMTP)smtpDestinationPlugin;
ISMTPOptions smtpOptions = (ISMTPOptions)smtp.getScheduleOptions();
smtpOptions.setServerName("mailhost.XXXXX.net");
smtpOptions.setPort(25);
smtpOptions.setDomainName("XXXXX.com");
smtpOptions.setSenderAddress("XXXXX.com");
smtpOptions.setSubject("Indicative Data Update Reports");
smtpOptions.getToAddresses().add("XXXXX.com");
smtpOptions.setMessage("Test Message");
smtpOptions.setSMTPAuthenticationType(CeSMTPAuthentication.NONE);
scheduleInfo.getNotifications().getDestinationsOnFailure().add("New");
scheduleInfo.getDestination().setFromPlugin(smtp);
Edited by: Shannon Maret on Apr 21, 2009 7:02 PMOne thing to keep in mind is that "scheduling to SMTP" is different from "scheduling with email notification", and it looks like you're conflating the two. The ISchedulingInfo.getDestinations() is the access point for scheduling to SMTP and ISchedulingINfo.getNotifications() is the access point for scheduling with Notification.
> scheduleInfo.getNotifications().getDestinationsOnFailure().add("New");
You'd add the SI_PROGID of the SMTP Destination here, and work with the returned IDestination to set the destination parameters.
Sincerely,
Ted Ueda -
Hi all report that sends email shows popup window needs to be supressed
hi all
i have developed a report that sends email as an attachement, but this report pops up a window in the end ( it says 'no of objext sent') and there i have to press enter, but my report is running in the background (scheduled report) and therefore there should be no pop ups in the report.
question is how to avoid popup window in the following program.
below is my code
just enter your email id in the code and it will run anywhere.
TABLES: ekko.
*PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using " p_email
'Example .xls documnet attachment'
'XLS'
'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 1 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
class cl_abap_char_utilities definition load.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using "p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver value '[email protected]',
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.
thanx
rockyhi rocky,
pls comment the submit program form INITIATE_MAIL_EXECUTE_PROGRAM by default the email runs in background and there is no need to submit 'rsconn01' it again to that program where u actually get the pop-up...
try it
hope this helps
regards,
karthik -
Sending email with HTML report through a button
Hi,
I've noticed in APEX 4 there is a default option (through Action Menu -> Download Formats: email) to send an email with report in HTML format...
may I know how to accomplish it using a Button... seems like APEX is using javascript:gReport.email.show(); function to accomplish it but I don't know how to implement it...
Please advice
Thanks in advanceqwe12654 wrote:
GokhanAtil,
I've posted a sample on APEX.ORACLE.COM... LOGIN DETAILS ARE SAME AS ABOVE...
ON the page now I have both the SQL based report and interactive report...
On the top right you may see 2 icons.. one for downloading report in PDF (using SQL Report as the source) and the second for sending email (using interactive report, similar logic as what you've recommended)...
Is there a way I may be able to send report via email, using SQL report as the source (rather than interactive report)...?
You can always use APEX_MAIL to send emails.
http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_mail.htm
or the alternative option would be:
to convert all my SQL reports into interactive, would require a bit of efforts (I'll go with it if the above option is not available)... but would need to know how to download INTERACTIVE reports in PDF, excel and CSV formats using a button ... similar logic to what you've done for sending emails
Thanks again for all your assistanceIt's very easy to make buttons for downloading the interactive reports in HTML, CSV or PDF.
I have created a PDF button and put the link:
http://apex.oracle.com/pls/apex/f?p=40418:11:1316531694094700:PDF
"1316531694094700" is the value of p_instance. You can find it from HTML codes of your page:
<input type="hidden" name="p_instance" value="1316531694094700" id="pInstance">
You can change PDF to CSV or HTMLD (so your visitor download the report in CSV or HTML)
Best Regards,
Gokhan
If this question is answered, please mark appropriate posts as correct/helpful and the thread as closed. Thanks
Maybe you are looking for
-
Creation of Web Template for SAP R/3 Transaction
Hi , How can i create my Web Template for SAP R/3 transaction for publishing in ITS ? I have created my own Z transaction of (Module Pool ), <b> How can i create Template & run it through web . </b> Regards Sachin S M
-
DVD drive not detected (K9N2GM-FD)
For some reason my motherboard( K9N2GM-FD) is not detecting my DVD drive. Here is the setup I'm using: AMD Athlon 64 X2 5200 Brisbane 2.7GHz Kingston 2GB (2 x 1GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400) Dual Channel Kit Desktop Memory MSI K9N2GM-FD
-
32 bit bridge hitting 1 CPU in Logic?
Is anyone else experiencing this? I appears that all 32 bit bridge plugs are taxed to the same CPU (I'm using an 8-core). If that is the case, this is a drag...
-
Resizing Columns in Tree Table
hi all! Iam using TreeTable's in my application. It is already developed by somebody. Now what is my problem is when I try to resize the column the subsequent columns are not resizing. Can any body help me out to fix this issue Thanks in Advance
-
I am attempting to lock some user preferences in firefox 5.0.1 for windows XP. I have completed the following steps: 1. Created and converted "Mozilla.txt" to mozilla.cfg with proper ROT13 encoding as per http://kb.mozillazine.org/Locking_preferences