Skip to Content
0

C4C - Email with attachment

Nov 07, 2016 at 11:26 AM

393

avatar image

Hello Experts,

I tried following the below blog, and I was able to send email successfully, However, attachments are not created.

Email with New Functionality:

https://blogs.sap.com/2015/02/03/new-email-functionality-for-tenants-1502-sp01/

The below code doesn't generate PDF so the flow within the if loop is never reached.


/// Attachment related
var Attachments : collectionof Platinum: Attachment;
var Attachment : Platinum: Attachment;
var ATTACHMENT_TYPE_DOCUMENT : DocumentTypeCode;
var FormTemplateLanguage = "E";
var FormTemplateCode : OutputRequestFormTemplateCode;

FormTemplateCode.content = "YGGQTH84Y_PAE";
ATTACHMENT_TYPE_DOCUMENT.content = "10001";

var pdfDocument = OutputManagementUtilities.GetPDF(this, FormTemplateCode, FormTemplateLanguage);
if (!pdfDocument.content.IsInitial()) {
Trace.Info("document successfully created");
Attachment.Binary=pdfDocument.content;
Attachment.FileName="hello.pdf";
Attachments.Add(Attachment);
}

Please support.

Thanks

Gayathri


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Pradeep Kumar N
Nov 08, 2016 at 02:54 AM
0

Hi Gayathri,

Variable Attachments is not initialized.

Also you could refer:

https://blogs.sap.com/2013/12/03/how-to-send-an-email-with-attachments-in-sap-cloud-application-studio/

Thanks, Pradeep.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Pradeep,

Thanks for your response.

But here -->

var pdfDocument = OutputManagementUtilities.GetPDF(this, FormTemplateCode, FormTemplateLanguage);

The above line doesn't return a PDF doc. For which, the FormTemplateCode and FormTemplateLanguage are set.

Is there any thing else..

Thanks

Gayathri.R

0
Pradeep Kumar N
Nov 08, 2016 at 10:06 AM
0

Hi Gayathri,

Check this:

https://archive.sap.com/discussions/thread/3627237

Thanks, Pradeep.
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Pradeep,

Jut now identified, I have passed the Form Group code instead of Form Template Header code. When i passed that the form got generated successfully,

Thanks for your support,

Gayathri

0