Application Development 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: 

Outgoing Mail: Mail containing attachment breaks up into multiple emails to the recipient

m4abrams
Participant
0 Kudos

Hi,

I have a weird issue in SAPConnect. I have created a program to email 3 attachments (2 Tax Documents + 1 Instructional File) to the employee.

I have moved the program to Production where it has started acting funny.

The program uses SAPConnect to send the email to the employees. The class used is  cl_document_bcs.

Issue

The mails when finally reaching the recipients (1 in 50 cases or so) the email breaks into 2 separate emails and gets sent as 2 separate mails, with one of the attachment missing and 1 attachment repeated. I can view the list of failed cases using Tcode SOST.

Hoping you could shed some light on why this is happening.

Thanks

Abraham

1 ACCEPTED SOLUTION

former_member220028
Active Contributor
0 Kudos

Hi,

as the Mails are already displayed as splitted mails in transaction SOST i have the feeling that the bug has to be in the programm. unfortunately i never sent mails via class cl_document_bcs. But solving ur issue by "wait"-statement makes me belive that maybe a "commit-work" or "commit work and wait" would help.

Also the bug can be in the class itself. Maybe u can create a new object of the class for each email u send? Or use a "initialize"-method. If this solves the bug it has to be inside the class.

did u try try such things for troubleshoot already?

Did u debug the mail-creation in class cl_document_bcs?

maybe write OSS-Note or search OSS for related issues.  i just searched for the class cl_document_bcs and found Note: 1055473.

regards

Stefan

10 REPLIES 10

Jelena
Active Contributor
0 Kudos

Sorry, it's not clear - do you see the same effect in SOST (i.e. separate emails) or does this happen on the recipient side? In the last case I doubt this is a programming issue.

0 Kudos

Hi Jelena,

Thank you for replying.

The issue is seen both in SOST and in the recipient side.


Scenario

The email would contain 3 attachments :- Instructional PDF (I) , Tax A Form (A) and and Tax B  Form (B),

The part 1 of the split email would contain attachment I, and part 2 would contain attachment I and A. The attachment B was always missing in this case.

If 10 mails were sent at a time, there would be no problems whatsoever. But if this was increased to 12 there were always cases of email splitting.

My Solution

The only solution I could come up with until now was to write a WAIT statement in my program after sending 10 mails, and then resume till next 10 mails are sent.

I know mine is not a good solution , and was hoping for a better solution in this forum.I have attached a screen shot if that helps.

Thanks

Abraham

former_member220028
Active Contributor
0 Kudos

Hi,

as the Mails are already displayed as splitted mails in transaction SOST i have the feeling that the bug has to be in the programm. unfortunately i never sent mails via class cl_document_bcs. But solving ur issue by "wait"-statement makes me belive that maybe a "commit-work" or "commit work and wait" would help.

Also the bug can be in the class itself. Maybe u can create a new object of the class for each email u send? Or use a "initialize"-method. If this solves the bug it has to be inside the class.

did u try try such things for troubleshoot already?

Did u debug the mail-creation in class cl_document_bcs?

maybe write OSS-Note or search OSS for related issues.  i just searched for the class cl_document_bcs and found Note: 1055473.

regards

Stefan

0 Kudos

I havent modified the program with the WAIT statement as of yet.

But sounds like COMMIT WORK AND WAIT seems to be a better idea.

When using the CL_DOCUMENT_BCS I create a new object for every new email. So that part has already been done.

Just wanted to know, Is there a size specified for outgoing mails, after which the mail gets split by SAP itself?

Thanks
Abraham

0 Kudos

This message was moderated.

0 Kudos

This message was moderated.

0 Kudos

This message was moderated.

0 Kudos

Hi Stefan,


can you please explain what u mean by "sending email at same time".

  • can u explain what ur programm is doing in detail?

This is what my pgm does:-

1) It uploads 3 documents (A. B & I as mentioned in my previous post). And mails these 3 documents to the employees using the email id maintained in SAP. The email body is fetched from SO10,

2) The program uses CL_DOCUMENT_BCS to send emails.

3) Selection Screen has a parameter for employee number (PERNR). The user passes the list of PERNR and executes the program.

4) Expected Output: Email must be sent with 3 attachments for the list of all employees passed by user in selection screen.


  • where do you send something at same time?
  • can u explain what ur programm is doing in detail?

Success: If the user passes 10 employees in the seln screen and runs the pgm we will be able to send 10 successful emails at a time. NO SPLITS.

FAIL: If the user passes more than 10 employees in the seln screen and runs the pgm we will definitely see emails being split with attachment_B discarded.


when you see a emailsplit - can you reproduce the bug by sending the emails again. is it always the same splitting?

Reproducing the BUG

After running these failed split cases again in my program (10 at a time) the emails were sent correctly. NO EMAIL SPLITS happened as long as the number of emails sent at a time were = 10 or less.


  • did u check the total sum of email size since last splitt?
  • did u debug class CL_DOCUMENT_BCS

No I havent checked the total sum of email size.

No I havent debugged class CL_DOCUMENT_BCS. Will start debugging asap.

Thanks

Starlet Abraham

Jelena
Active Contributor
0 Kudos

Rather a strange issue... I have a program that reads files, attaches them and sends emails and it definitely sends more than 10 emails at a time with no issue (albeit with just two attachments). The code is largely based on this blog and is very simple.

This code concludes the email and there is even no 'WAIT' addition:


* Don't need a Return Status E-mail

 

CALL METHOD send_request->set_status_attributes

EXPORTING

i_requested_status = 'E'

i_status_mail = 'E'.

sent_to_all = send_request->send( i_with_error_screen = 'X' ).

COMMIT WORK.

I would just add 'COMMIT AND WAIT' and see if it resolves the issue. Not sure how to explain this clearly but production systems usually run on more powerful servers with processes running in parallel. So that's where all the funky problems usually start - stuff just runs too fast and things kind of run into each other. (Sorry, I know it's not a very professional description but it's just not my expertise.)

It seems that there is no specific pattern (e.g. larger attachment size) in the split emails, so if the WAIT still doesn't help you might want to post the code here.

0 Kudos

Guess will have to fix my 'funky problem' with 'COMMIT AND WAIT' statement.

Still hoping to see someone else who has faced a similar issue.