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: 

error while trying send emai with attachment

Former Member
0 Kudos
2,503

Hello,

I am facing an error while trying to send email with attachment (spreadsheet).

Error is: "Error in calling 'SBCOMS_SEND_REQUEST_CREATE' in 'SO_DOCUMENT_SEND_API1' with Sy-subcr = 1".

Do I need to configure the sender email address or some configuration at the sender system?

I followed the example given in the below link.

http://wiki.sdn.sap.com/wiki/display/ABAP/HowtowriteanABAPProgramtoplaceanExcelfileinapathandsenditasan+Attachment

Could you please help on this?

Thanks & regards,

Ravish

18 REPLIES 18

Former Member
0 Kudos
296

Hi,

If you are using SO_DOCUMENT_SEND_API1 then after execution of mail sending transaction, open parallel session and check SU53 if you have authorization to send mail or not.

If you don't have authorization then get the same and try again, also tell your basis to check SCOT and SMTP configurations.

hope it will help you.

Regards,

Umang mehta

Former Member
0 Kudos
296

Hi ,

The error you are getting is TOO_MANY_RECEIVERS. Check whether how many receviers you are passing in the code.

Test for one .

0 Kudos
296

Thanks for replies guys.

While calling the FM 'SO_DOCUMENT_SEND_API1', the sy-subrc is 6 i.e. "x_error"

Could you please help me on finding the root cause for this?

Further, could you please throw some light on the configurations maintained for the SMTP and SCOT.

and my requirement is to send a spreadsheet as an attachment and not pdf or anyother file format.

Thanks & regards,

Ravish

Edited by: RavishOjha on Feb 2, 2011 2:25 PM

Former Member
0 Kudos
296

Follow the link below to get a clear idea:

http://www.abapmadeeasy.com/2011/02/sap-abap-sample-program-to-convert.html

Regards,

Uttam Agrawal

Edited by: uttamagrawal on Feb 2, 2011 9:44 AM

Edited by: uttamagrawal on Feb 17, 2011 7:53 PM

Former Member
0 Kudos
296

Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of code

Thanks & Regards,

Uttam Agrawal

<<blog self promotion removed>>

Edited by: uttamagrawal on Feb 2, 2011 9:57 AM

Edited by: uttamagrawal on Feb 2, 2011 9:58 AM

Edited by: Rob Burbank on Feb 2, 2011 12:23 PM

Edited by: Matt on Feb 22, 2011 10:49 AM

0 Kudos
296

Thanks for your reply.

Same error 6 I am getting after implementing this report.

Cud u please throw some light on error 6.

Thanks,

Ravish

0 Kudos
296

Did u change the receiver maid id for the function module.

In the said example Receiver mail id is set as XXX. Set a valid mail ID and see.

Regards,

Uttam Agrawal

0 Kudos
296

Hi,

Yes, I changed the mail id and made it xyz @ gmail.com.

Is it possible to send emails outside SAP system?

Any specific settings for the same?

Thanks & regards,

Ravish

0 Kudos
296

If you would like to send Email to external mails from SAP, you need to pass the Receiver type "u" (you can check in parameter "RECEIVERS" in FM)

0 Kudos
296

Hi RavishOjha,

maybe you could consider using the class CL_BCS and its affiliates. Check the BCS* demo reports in system, .blogs and wikis here.

If you do so, unfortunately this could be last time you have any trouble with mail sending in ABAP.

If you love the trouble, stay with SO_DOCUMENT functions

Regards,

Clemens

0 Kudos
296

Hi Clemens,

Thanks for your reply.

lets say that I use the class CL_BCS to get this done.

But my doubt is adding attachment to the email body.

My requirement is to add attachment of type 'spreadsheet' with email.

In the older function module, we could specify the document type as 'XLS' to get this, but in this new apparoch I am not sure about the spreadsheet attachments.

Could you please throw some light on the building a spreadsheet during the process of sending email (do I need to use the specific FM 'GUI_DOWNLOAD' to save the spreadsheet to save the spreadsheet on the app. server and then pick up the file and add as attachment)?

Thanks & regards,

Ravish

0 Kudos
296

Hi Ravish,

sure you can create local excel using [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf], load as binary and attach.

More elegant, future-oriented and advanced is the [excel-from-scratch-approach abap2xlsx by Ivan Femia|http://wiki.sdn.sap.com/wiki/display/ABAP/abap2xlsx]

Regards,

Clemens

0 Kudos
296

Thanks Clemens!

As I understand that the suggested soln refers to using DLLs, but I would want to bypass that approch and use something already provided as standard SAP Class/FMs to solve that. Is there anything possible within that domain of sap provided standard tools rather than DLLs?

Appreciate your solns.

Thanks & regards,

Ravish

0 Kudos
296

Hi Ravish,

so sorry, this is not a chat session. Using [google|http://www.google.com/search?hl=en&source=hp&q=cl_bcsexcelattachment&aq=f&aqi=&aql=&oq=] I found pieces of useful code like [Eswar Rao Boddeti'|; instantly.

Who am I to do the work you get paid for?

Regards,

Clemens

0 Kudos
296

Further, I found that CL_BCS also uses same old function modules 'SO___' to do the job.

But, we need to have the entries for file types/Object types maintained in the TSOTD table.

e.g. I am trying to send attachment as XLS but the same OBJ TYPE shud be maintained in the TSOTD table.

Thanks,

Ravish

0 Kudos
296

Now, I am trying to execute the standard report BCS_EXAMPLE_7 which has similar fucntionality of sending an excel sheet as attachment in the email.

But the error thrown is same X_ERROR.

Acually, the error is thrown whenever there is an attachment with the email (even in the standard reports e.g. BCS_EXAMPLE_X)

however, when an email is sent without an attachment, then its going thru!!!

What cud this issue be? Any pointers? Are there any specific settings for sending attachment with email in the BASIS?

Thanks & regards,

Ravish

0 Kudos
296

Hi Ravish,

Please once try attaching another type of file . Also check RAW setting in SCOT. There in scot INT->SMTP Click Display then click on SET button right to Internet. There you can check settings for Output Format file type.

Regards,

Singh

Former Member
0 Kudos
296

Hi

Go to SCOT tcode,SMTP->INT-> if there no (*) available under INT then add your mail address under INT by creating Address area from menu bar.

Hope it helps.