Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Email sending program takes long time

Former Member
0 Likes
3,742

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.

1 ACCEPTED SOLUTION
Read only

ravi_lanjewar
Contributor
0 Likes
2,398

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.

13 REPLIES 13
Read only

Former Member
0 Likes
2,398

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?

Read only

0 Likes
2,398

Thank you friend.But I have to dynamically exclude some employees according to record maintained in control table, so your idear can not work.

Read only

brad_bohn
Active Contributor
0 Likes
2,398

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?

Read only

Former Member
0 Likes
2,398

Thank you.But I have doublt that "Will it take total lump sum time less than the time taken for all at once?"

Read only

Former Member
0 Likes
2,398

HI

The best soultion is to divide employees according to their department / company or any other basis and then run.

Read only

deepak_dhamat
Active Contributor
0 Likes
2,398

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.

Read only

ravi_lanjewar
Contributor
0 Likes
2,398

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.

Read only

0 Likes
2,398

Yes, it is sap-smtp connection which taking time.One solution can be increase the program frecuency.

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
2,398

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

Read only

Former Member
0 Likes
2,398

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

Read only

0 Likes
2,398

You have to execute a program after "CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'"

SUBMIT rsconn01 WITH mode EQ 'INT' AND RETURN.

Regards

Read only

ravi_lanjewar
Contributor
0 Likes
2,399

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.

Read only

0 Likes
2,398

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.