Skip to Content
0

Bulk Printing for Standard Business Objects

May 07 at 08:58 AM

41

avatar image

Hi,

I’m trying to create a Bulk Printing possibility for example for printing Customer Invoices. The idea is a user selects several Customer Invoices from the list, hits “Print” button and all documents should be printed out via SAP Cloud Print Manager.

I tried to use

https://blogs.sap.com/2017/05/30/mass-printing/

https://blogs.sap.com/2016/06/28/how-to-send-pdfs-to-print-queue-with-absl/

Below my code used for ActionValidation-Release

import ABSL;
import AP.Common.GDT ;
import BASIS.Global as basisGlobal;
import DocumentServices.Global;
var Useraccountid : UserAccountID;
var PDF : basisGlobal:BinaryObject;
var FormTemplateCode:OutputRequestFormTemplateCode;


var FormTemplateLanguage;
Useraccountid.content = "PRT_002";
// Retrieve the attachment document’s content and
assign to the PDF variable

foreach (var doc in this.AttachmentFolder.Document){
               PDF.content=doc.FileContent.BinaryObject.content;
               PDF.mimeCode=doc.FileContent.BinaryObject.mimeCode;
               PDF.fileName="CustomerInvoiceDoc.pdf";
               var PrintDocument= OutputManagementUtilities.CreatePrintQueueItem(                                                                   Useraccountid,
              PDF.fileName,
              1,
              PDF,
              "CustomerInvoicing" //Queue name
               );
}



But after clicking button I can see only a message: “Your entries have been saved” and no any visible result. The Print Queue is empty. Nothing goes into.

In debug mode I can see the following

4:41:21 PM [1:I] Enter CustomerInvoice_EXT.xbo-Release.absl (CustomerInvoice, CustomerInvoice / YXXXXXXXX_) with key ID INV-ID

4:41:31 PM [1:I] Association CustomerInvoice.CustomerInvoice.AttachmentFolder.Root 1 Record(s) Returned

4:41:31 PM [1:I] Association CustomerInvoice.CustomerInvoice.AttachmentFolder.Root.AttachmentFolder.Document 1 Record(s) Returned

4:41:31 PM [1:I] Association CustomerInvoice.CustomerInvoice.AttachmentFolder.Root.AttachmentFolder.Document.AttachmentFolder.FileContent 1 Record(s) Returned

4:41:31 PM [1:I] Association CustomerInvoice.CustomerInvoice.AttachmentFolder.Root.AttachmentFolder.Document.AttachmentFolder.FileContent 1 Record(s) Returned

4:41:31 PM [1:I] Validation Return Code True

4:41:31 PM [1:I] Exit CustomerInvoice_EXT.xbo-Release.absl

The thread 'ABSL Session 1' (0x1) has exited with code 0 (0x0).

I’m concerned about this last line as it might be a sign of the issue, but didn’t find anything related after googling.

I also tried to use

OutputManagementUtilities.GetPDF to get a binary content and

OutputManagementUtilities.CreatePrintQueueItemWithFormTemplate

Without any luck, but it’s also not my usecase

Anyway, I will appreciate if someone can say where I can find FormTemlateCode, which is

//Code is Form Template Header Code

As it states in Documentation (SAP Cloud Applications Studio 1802) for the standard templates. I managed to guess some of them, but it would be good if I can find a list or at least an identifier somewhere on the screen.

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

0 Answers