Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9069

Re: SAP Cloud SDK : Create/ Generate PDF using button and add into the attechment component in Custom Business Object

$
0
0

Hi Mithun,

 

your code looks correct regarding the generation of a PDF.

 

However, you have to add the binaryobject created to the Attachment object in code too.

 

We use the following code:

 

var ATTACHMENT_TYPE_DOCUMENT : DocumentTypeCode;

ATTACHMENT_TYPE_DOCUMENT.content = "10001";

 

if (this.AttachmentFolder.DocumentList.Where(n => n.AlternativeName == documentAlternativeName).Count() == 0) {

     // create PDF

     var FormTemplateLanguage = "E";

     var FormTemplateCode : OutputRequestFormTemplateCode;

     FormTemplateCode.content = SOLUTION_ID + "_SUFFIX";

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

     if (!pdfDocument.content.IsInitial()) {

          Trace.Info("document successfully created");

          if (!this.ItemAttachmentFolder.IsSet()) {

               Trace.Info("attachment folder not existent, thus create it");

               this.AttachmentFolder.Create();

          }

          var description : Description;

          description.content = "";

          description.languageCode = LanguageCode.ParseFromString("EN");

 

          this.AttachmentFolder.CreateFile(ATTACHMENT_TYPE_DOCUMENT, documentName, documentAlternativeName, description, pdfDocument);

     }

}


Viewing all articles
Browse latest Browse all 9069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>