Friday, October 18, 2013

Set up Action for Post Concurrent Process

It's all from the Metalink doc 164085.1Enhancing and Automating Oracle Applications Concurrent Processing.

Many years ago I came across this document, when I was a novice young guy who kept reading technical document but did not understand a bit what it said.   I put it in my memory and hopefully in one day I can use this piece of info in my work. And it did.

In my last blog I did not mentioned how the invoices can be processed completely from end to end.  I just laid out the Java program which can manipulate the generated PDF files and delivery them to different places. The linkage between the concurrent program and this Java program is the custom print driver, as suggested in this very Metalink doc.

(1) Create a shell script / batch file which run this Java program.  For example:
#!/bin/bash
. /u01/appsapps_st/appl/envshellVCPDEMO_papaya.env
java -cp ./bin:$CLASSPATH com.symplik.oracle.ProcessInvoice $1 $2

The argument1 is the invoice PDF file, and argument2 is the print queue name.  This program will print this  PDF file to this print queue.  Test this script and make sure it works properly.

(2) Register a custom Printer Driver with this shell script as argument:


The must crucial part is the parameter passed to this shell script: $PROFILES$.CONC_REQUEST_ID.  It is the concurrent request ID when this printer driver is used.  This becomes the argument passed to the shell script to use.

Once you know the concurrent request ID, you can do queries to find out all the information for this particular concurrent request: log file, output file, argument values, etc in table FND_CONCURRENT_REQUESTS.  Or you can do further queries to fetch some business-related information based on the parameters used in this concurrent request.

This shell script is changed to process this info:

#!/bin/bash
# serve the APPLTOP profile
. /u01/appsapps_st/appl/PROD_server1.env
concReqID=$1
pdfFile=$APPLCSF/out/o$concReqID.pdf
printerName=`java -cp ./bin:$CLASSPATH com.symplik.oracle.GetInvoicePrinter $concReqID`
java -cp ./bin:$CLASSPATH com.symplik.oracle.ProcessInvoice $pddFile $printerName

The Class GetInvoicePrinter has a System.out.println of the print queue name, based on a given concurrent request ID.  In this class it runs some JDBC queries to fetch this value.

Create a custom Printer Style

Create a custom Printer Type and link the custom Style with the custom Driver

Create a new Printer which uses this custom Printer Type

Set the printer style and printer for the XML Publisher program with these custom values

When this program is invoked, one MUST SURE set the no. of copies to 1 (or any values other than zero). This "1" values will kick off the "printing" action, which is in turns run the custom shell script.






No comments :