04-04-2011 12:12 PM
I have to send email from ABAP program to around 45000 employees .
I am using :
-
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOCUMENT_DATA
DOCUMENT_TYPE = 'HTM'
COMMIT_WORK = 'X'
TABLES
OBJECT_CONTENT = W_OBJECT_CONTENT
RECEIVERS = W_RECEIVER
-
W_RECEIVER is populated with all employee mail ids.
This takes long time to send emails.
Pls guide some methods if available to improve response time.
Thanks in advance.
04-05-2011 4:30 PM
Hi,
Why are u sending 45000 mail at one time. When SAP server connect to SMTP server it is try to fetch all receiver list to SMTP server and it slow down SMTP server too. So, Better to send 100-500 employees in batch at a time.
It will improve the performance little bit.
04-04-2011 12:46 PM
45000 will take a very long time...Is there no all-employee distribution list inside your email system that could be the single address from SAP?
04-05-2011 10:32 AM
Thank you friend.But I have to dynamically exclude some employees according to record maintained in control table, so your idear can not work.
04-04-2011 3:11 PM
Yikes, do what BreakPoint suggested. Or even break it down further to several department level group addresses. Can Outlook or whatever email client you're using hold 45000 entries?
As far as performance, have you checked the RSCONN01 program for its load distribution and parallel processing capabilities?
04-05-2011 10:34 AM
Thank you.But I have doublt that "Will it take total lump sum time less than the time taken for all at once?"
04-04-2011 7:42 PM
HI
The best soultion is to divide employees according to their department / company or any other basis and then run.
04-05-2011 10:38 AM
hi ,
It should not take more than 3 to 4 minutes .
DATA: wf_report_for_date(10) TYPE c, " To store date in DD.MM.YYYY format.
wf_variant TYPE sy-slset. " To store variant name used in background job.
* CONCATENATE wf_cntdt+6(2) '.' wf_cntdt+4(2) '.' wf_cntdt+0(4) INTO wf_report_for_date.
* MOVE sy-slset TO wf_variant.
CALL FUNCTION 'WWW_LIST_TO_HTML'
EXPORTING
list_index = 0
TABLES
html = lt_html.
maildata-obj_name = 'ZP017A'.
* IF pr_plant EQ '7100' OR pr_plant EQ '7200' OR pr_plant EQ '7300' .
* maildata-obj_descr = 'Daily Production Performance - MCD-Mundhwa'.
CONCATENATE 'DIE ELEMENTS FOR REMOVING DELETION INDICATOR' wf_report_for_date '-' wf_variant 'Mundhwa' INTO maildata-obj_descr SEPARATED BY space.
* ENDIF.
* wa = 'PRE FORGING OPERATION NOT INCLUDED FOR HAMMERS.' .
* append wa to lt_html .
* clear wa.
* write: / .
wa = 'This is an Auto Generated mail from the SAP system. Please DO NOT reply.'.
APPEND wa TO lt_html.
IF so_mail[] IS NOT INITIAL.
LOOP AT so_mail.
mailrec-receiver = so_mail-low.
mailrec-rec_type = 'U'.
mailrec-com_type = 'INT'.
* mailrec-copy = 'X'.
mailrec-notif_del = ''.
mailrec-notif_ndel = ''.
APPEND mailrec.
ENDLOOP.
ENDIF.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
commit_work = 'X'
TABLES
* object_header = 'ZP024'
object_content = lt_html
receivers = mailrec
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.
regards
Deepak.
04-05-2011 10:47 AM
Hi,
It is not program problem. It is due to program which run in background for fetch data from SAP server to SMTP server.
It is schedule by BASIS people for execute in background.
Discuss with your basis people for increase the frequncy of program execution.
04-05-2011 11:39 AM
Yes, it is sap-smtp connection which taking time.One solution can be increase the program frecuency.
04-05-2011 11:04 AM
Hi Dipak
After your calling FM - 'SO_NEW_DOCUMENT_SEND_API1'
call one more FM - QCE1_CONVERT
which can converts ur doc to attachable format so that hopefully u can save time.
Try it out.
Regards,
Sreeram
04-05-2011 12:02 PM
Hi,
I think it would be easier to send this mail to a receiver list on your mail server, where the list should be exceuted to send the informations to all receivers without sending the complete list of receivers to every single employee.
If you have 45000 employes I suppose you have several team lists or employee lists defined in your internal mail system on your mail server.
Maybe you can use several team lists to cover the whole list of employees you want to inform!
Regards,
Klaus
04-05-2011 12:26 PM
You have to execute a program after "CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'"
SUBMIT rsconn01 WITH mode EQ 'INT' AND RETURN.
Regards
04-05-2011 4:30 PM
Hi,
Why are u sending 45000 mail at one time. When SAP server connect to SMTP server it is try to fetch all receiver list to SMTP server and it slow down SMTP server too. So, Better to send 100-500 employees in batch at a time.
It will improve the performance little bit.
04-06-2011 6:34 AM
Thanks all for help.
I broke the recipient list into batch and created background job for each batch to run parallal and finally it reduces my overall time to 70 to 80 % .
Thanks again.