Mass Invoice Printing (BYD)

SAP Business ByDesign allow for you to print multiple invoices via this customization.

Mass Invoice Printing

In this post we are going to Implement the ability to print multiple invoices with a single button click.

You will need

1.SAP Business By Design Instance (contact us, if you need one)
2.SAP BYD Development SDK (contact us, if you need one)
3. SAP Print Manager Software (contact us, if you need one)

Create Business Object, Screen & Script

Create Business Object

  1. Log into SAP Cloud Application Studio as a developer user.
  2. Choose your solution from “My Solution” window.
  3. In Solution Explorer Right Click on your solution-> Select Add ->New Item.
  4. Choose Extension -> Business Object Extension from Add new item dialogue box.
  5. Click Add (New Business Object Selection window will open)
  6. Choose NameSpace as http://sap.com/xi/AP/CustomerInvoicing/Global.
  7. Choose Business Object as CustomerInvoice.
  8. Click OK.

Create Screen

  1. Right Click CustomerInvoiceExtension BO
  2. Click Enhance Screen.
  3. Check CustomerInvoiceSOWL(Object Work List) from Enhance Screen Window as shown in the below screenshot.
  4. Click OK

Create Script

  1. Right Click CustomerInvoiceExtension BO
  2. Click Create Script file.

Check the box for Action Validation: Release script file from Create Script file window Your Solution should look like this.

Configure SAP Business ByDesign

  1. Logon into SAP Business ByDesign as a Business User.
  2. Application and User Management -> Print Queues -> New
  3. Enter Queue ID as Customer_invocing
  4. Assigned User: Click New button and create new user
  5. Click Save and Close.

Scripting

  1. Double click Release Action file which we generated earlier.
  2. Copy & Paste this code.
    import ABSL;
    import AP.IS.NumberRange.Global;
    import AP.Common.Global as apCommonGlo;
    import AP.Common.GDT as apCommonGDT;
    import BASIS.Global as basisGlobal;
    import DocumentServices.Global;
    
    if (this.Status.ReleaseStatusCode == "3") //Release
    {
     var Useraccountid : UserAccountID;
     var PDF : basisGlobal:BinaryObject;
     var title = "CustomerInvoiceDoc";
     
     // This block check whether attachments available or not 
     if (this.DocumentOutputRequest.IsSet())
     {
     
     var docOPReqItem = this.DocumentOutputRequest.Item;
     
     if (docOPReqItem.Count() > 0)
     {
     title = docOPReqItem.GetFirst().DocumentName;
     if (docOPReqItem.GetFirst().ItemPreview.IsSet())
     {
     if (!docOPReqItem.GetFirst().ItemPreview.PreviewBinaryObject.IsInitial())
     {
    //Assign the content
     PDF.content = docOPReqItem.GetFirst().ItemPreview.PreviewBinaryObject.content; 
     }
    }
     }
     }
    
    // PD002 is a assigned user which we created in previous step.
    
    Useraccountid.content = "PD002";
     
     /*
     Useraccountid : This is assigned user id
     Title : Title of the document
     Numberic value(1) : No of copies
     PDF : Content of file
     "Customer_Invoice" : Print queue ID which we created in previous step
    */
    var PrintDocument = OutputManagementUtilities.CreatePrintQueueItem(Useraccountid, title, 1, PDF, "Customer_Invoice");
     return false;
    }
    else
    {
     return true;
    }
  3. Save & Activate Script file.

Add standard button on Customer Invoice screen

  1. Double click CustomerInvoiceSOWL.owl in Solution Explorer.
  2. Choose ButtonArea -> click Add Custom Action from Extensibility Explorer.
  3. Add Custom Actions dialogue box will open. (Enter this detail)
    1. Choose Custom Action as Release
    2. Action Type as Multiple
    3. Button Text as Print
    4. Button ToolTip as Print Invoice
    5. Instance Binding as /Root/CustomerInvoice
    6. Check Save Before Execution.
    7. Click Apply
  4. Save & Activate

Configure SAP Print Manager

  1. Download & Install SAP Print Manager.
  2. Configure your tenant with SAP Print Manager.
    1. Choose Runtime system -> New (Edit Runtime System window will open.)
      1. Name: Tenant Name for user reference
      2. Protocol: HTTPS
      3. Host: myxxxxx.sapbydesign.com
      4. Port: 443
      5. User / Password:
      6. Check Test Connection
      7. Click OK.
  3. Double click on highlighted “Printer Ques”.
  4. Configure SAP Print Manager with your printer(s).(Note: Five printers can configure with SAP Print Manager)

Testing

  1. Open SAP Business ByDesign as a Business User.
  2. Choose Customer Invocing -> Invoice Documents.
  3. Select only “Released” invoices. You can select more than one invoice at a time. (Ctrl+Click)
  4. Click Print button. (This is a custom button, which we created earlier).

Debugging/Troubleshooting

Contact Us!

Hope you enjoyed the article, if you need help with any custom development please don’t hesitate to reach out to us.

We have skills in:

Integrating SAP BYD with your software
Customizing SAP BYD font-end & back-end
And much more…

 

1 thought on “Mass Invoice Printing (BYD)

  1. Excellent post. I was checking continuously this blog and I am impressed! Very useful information specially the last part 🙂 I care for such information a lot. I was seeking this particular info for a long time. Thank you and good luck.

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2020 Copyright :mindsight