JMJ CLOUD
  • Home
  • Projects
  • Blog
  • About Us
  • Contact Us

Our Blog

APEX Office Print – Is it the APEX printing solution we have all been waiting for?

11/16/2018

1 Comment

 

Introduction

APEX and APEX Office Print
​I have been using APEX since version 4. I have used it to develop extensions to E-Business Suite, Oracle ERP Cloud and also for Custom Applications. During this whole time, I have come to dread the question that clients almost always ask, “How do I print from APEX”? In this post I will tell you why I think APEX Office Print (AOP) gives APEX developers a chance to respond to that question with their heads held high.

​What is APEX Office Print?

APEX Office Print offers a solution for generating highly formatted documents and reports in Word, Excel, PowerPoint, HTML and Plain Text formats. It comes in an on-premise and cloud version. You send AOP a template and a JSON payload and it returns a formatted document. On the backend, AOP is architected as a web service which means it is completely technology agnostic (one of its key differentiators). It means you can use AOP from any technology that can call a web service (not just APEX). It is called APEX Office Print for a reason though so let’s talk about that. AOP comes with a Plugin for APEX which provides tight integration with a number of APEX components (e.g. Interactive Report, Interactive Grid). Using this integration, downloading an Interactive Report to Excel can be as simple as adding a button to an APEX page and creating a template with a single tag. Read on to see some more in-depth examples that explore many other capabilities of this interesting product.

​Why is it Different?

The obvious product to compare AOP with is Oracle’s BI Publisher. For me, the primary differentiator for AOP is its availability in the Cloud. This makes it accessible from just about anywhere. In fact, I am working at a client now where we are using AOP in the Cloud from APEX on-premise and from APEX running on Exadata Express. There is even talk at the same client of calling AOP from a native iOS App.
 
Other AOP differentiators include:
  • Tight integration with APEX.
  • JSON data payloads (as opposed to the bulkier XML that BI Publisher uses).
  • Powerful and easy to follow templating syntax.
  • Comprehensive demo APEX application. This was a great help when I learned AOP.
  • Reasonably priced (especially when compared to BI Publisher).

Use Cases

I won’t be diving too deep, but I do want to demonstrate some ways we are using AOP for our clients. Hopefully, these examples will illustrate why you should consider AOP as part of your APEX printing strategy.

Inspection Report
One of our clients’ needs to produce documents (in pdf and Word) detailing the inspection of product before it is shipped to the customer. The document shows order details, material condition information and up to a hundred readings taken from a digital quality gauge. The document is printed at the plant and then emailed to the customer. With so much information coming from many different sources, we decided to use the following approach to generate the document:
  1. In APEX, the user selects the job to print, checks the output format (pdf or Word) and clicks a custom ‘Print’ button.
  2. Behind the ‘Print’ button, we call a custom PL/SQL procedure does the following:
    • Calls a function to generate the JSON payload for the report. This function calls a number of functions and procedures to gather the data necessary for the report.
    • Fetches the appropriate AOP template from a database table for the user’s logged in language.
    • Calls the AOP procedure ‘aop_plsql_pkg’ with the JSON and the template. The ‘aop_plsql_pkg’ gathers the template and JSON and calls the AOP web service which returns a BLOB with the formatted document.
    • Downloads the output to the users’ computer (optionally emails the document to the user).
 
Note: In the above example we have not used the AOP APEX Plugin at all. This illustrates you can use the ‘aop_plsql_pkg’ package to call AOP directly from PL/SQL.

Generic Interactive Report Excel Downloads
The example illustrates AOPs tight integration with APEX via their Dynamic Action Plugin. One of our clients has an APEX application with over 150 pages. Amongst these pages are about 50 interactive reports and interactive grids. If we wanted to develop an ‘.xlsx’ download for all of these reports using BI Publisher, we would have had to:
  1. Develop 50 different BIP templates and upload them to the ‘Report Layouts’ section in ‘Shared Components’ in our APEX App.
  2. Create a copy of the 50 underlying SQL statements for each of the reports to the ‘Report Queries’ section in ‘Shared Components’ in our APEX App.
  3. Add code to each of the 50 pages to call these BI Publisher reports.
The duplication of the report SQL is the exact opposite of ‘DRY’ and represents as significant increase in maintenance and upgrade costs.
 
AOP to the Rescue
Using AOP, we can create a single Excel template with the company logo, a nicely formatted title block and a single token ‘{&interactive}’. This template can be used for all 50 of our interactive report Excel downloads.
APEX Office Print Template
AOP Template
​By adding the code below to our APEX pages, we can use this template on any interactive report in our application, significantly cutting down on the number of templates we need to maintain.
Picture
Picture

​Code from the Init PL/SQL Block:

    
The above code does the following:​
  1. Sets the download filename using a global variable.
  2. Sets a global variable with APEX Items so they can be referenced in the AOP template.
  3. Sets the formatting for the table headings in the output and even sets alternating row colors.

Sample Output:
Picture

Employee Document Receipt Confirmation
My final example shows how you can use AOP in the Cloud to generate highly formatted documents from on-premise or Cloud based applications. In this instance, the customer requested that their employees be able to confirm receipt of key documents (e.g. NDA, Employee Handbook) in the Cloud and also generate a pdf copy of their acceptance for the employee to download. In addition to this, they also wanted to generate a copy of the pdf to attach to the employees HR record in EBS on-premise.
 
APEX running on Exadata Express was used to show the employee the document and to call AOP to generate a pdf of the document acceptance for the employee to download.
One accepted, the on-premise system pulled in the acceptance to the local database, and then used the same AOP template to generate another pdf copy of the document acceptance and attached it to the employees official HR record in EBS.

Architecture
Picture

​Other Use Cases

Here are some other potential use cases for AOP:
  • Using AOP from a button in APEX to generate a report and email it instead of downloading it.
  • Calling the AOP web service from a native iOS App in order to generate a pdf to display to the user on an iPad.
  • Calling the AOP web service from a customer portal (built in a non-Oracle technology) to generate a pdf copy of an invoice for a customer.

​Room for Improvement?

There are a couple of things I would like to see from AOP in the future:
  • Ability to store templates in the Cloud e.g. AWS S3 and have AOP go directly to the Cloud to get the template.
    • You can store templates in S3 today and reference them via a URL. The problem is AOP makes a call from your local database to get the template before the AOP web service is called.
    • Ideally, we would pass a template URL and a JSON document to AOP. AOP would then fetch the template directly from S3, without the extra round trip.
  • Free development mode credits.
    • Developing a template-based report is an iterative process. You often go through many iterations of changing the template, running the report, changing the template and running the report again. A complex report could take more than 100 iterations. This can quickly eat into the monthly AOP plan quota.
    • I would like to see a development mode that did not count against your quota. I would even be OK if the result was watermarked in development mode.

Conclusion

We have only been using AOP for three months, but we have already used it to build several mission critical documents and reports. It has been reliable, performant and fills most of the printing gaps left by Oracle in the base APEX product. If it continues to develop at the rate it is today, I believe it will become the go to solution for reporting from APEX. At time of writing a free tier was introduce giving you 100 free credits per month. I encourage you to go try it out!

Author

Jon Dixon, Co-Founder JMJ Cloud

1 Comment
Juergen Schuster link
11/17/2018 03:26:12 am

Was curious what you wrote because I also have intensive experience with AOP. Very well written, easy to understand. I agree with everything you wrote (although didn't get the AWS part :-)

Also great idea with the free development iterations and the watermark :-)

Reply

Your comment will be posted after it is approved.


Leave a Reply.

    RSS Feed

    Popular Posts

    - APEX Dog Food
    - Cloud ERP & APEX Mashup
    - Modernizing EBS with APEX
    - Easy APEX_WEB_SERVICE
    - Running APEX in RDS
    - ORDS What & Why?

    Categories

    All
    APEX
    AWS
    Fusion Cloud ERP
    INTEGRATION
    MS GRAPH
    OCI
    ORDS
    PaaS
    RAD
    REST
    SOAP

    Archives

    October 2021
    February 2021
    January 2021
    October 2020
    September 2020
    June 2020
    May 2020
    April 2020
    February 2020
    January 2020
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    September 2017
    August 2017
    July 2017
    June 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016

Company

About
Contact
Blog
  • Home
  • Projects
  • Blog
  • About Us
  • Contact Us