How to Generate 2D Barcode / QR Code in Oracle Reports (Doc ID 1678110.1)

How to Generate 2D Barcode / QR Code in Oracle Reports (Doc ID 1678110.1)

APPLIES TO:

Oracle Reports Developer – Version 11.1.1.1.0 and later
Information in this document applies to any platform.

GOAL

Generate an Oracle Report output with 2D Barcode / QR Code image.

SOLUTION

NOTE: The sample program in this article is provided for educational purposes only and is NOT supported by Oracle Support Services. It has been tested internally and works as documented. Oracle can not guarantee that it will work in all possible configurations, so be sure to test it thoroughly in your test environment before deploying it.

 

Since 10gr2 , it is possible to import Java classes in Oracle Reports.

Reports Builder Online Help :
The Java Importer enables you to access the rich environment of the Java programming language from your reports.
 Using the Java Importer, you can automatically generate PL/SQL packages and procedures to access Java classes and then program with the generated PL/SQL in your reports.

Open Source Java Libraries exist to generate 2D Barcode / QR Code / Data Matrix  : XZing , QRGen , Barcode4J , …

The example below is based on the Open Source Java libraries : XZing and QRgen :

XZing   https://github.com/zxing/zxing
QRGen https://github.com/kenglxn/QRGen

To download the Jar files core-1.7.jar , javase-1.7.jar, and qrgen-1.2.jar used in this example please follow the following steps:

[1] core-1.7.jar and javase-1.7.jar files can be downloaded at :

ZXing  https://github.com/zxing/zxing/wiki/Getting-Started-Developing#just-need-a-jar under the following section:
Just Need a JAR?  
    If you just need a pre-built JAR file, you can always find compiled resources from the Maven release repository, including recent snapshot/nightly builds.

[2] qrgen-1.2.jar can be downloaded at :

QRGen  https://github.com/kenglxn/QRGen#get-it under the following section:
Get it:
    QRGen consists of three modules: core, javase and android. Everything is available from Maven Central Repository.

Note :
1. The example below is written using the Windows platform syntax. The same example can be implemented on “UNIX” platforms.
2. The Jar file names may be different according to the versions of ZXing and QRGen used.
3. The java classes in some jar files of the latest versions of ZXing / QRGen have been generated by the java Compiler 7.
The JDK provided by default in ORACLE_HOME\jdk is the JDK 6.
Classes compiled with the Java compiler 7 cannot be used with the JDK 6The jar files used in this example (core-1.7.jar , javase-1.7.jar , qrgen-1.2.jar) have been used with the default JDK provided in ORACLE_HOME\jdk for FMW 11gR1 and 11gR2

 

The following are the steps to build a report to generate 2D barcodes

Step 1 . Create the Java code file qrcode.java

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Arrays;
import net.glxn.qrgen.QRCode;
import net.glxn.qrgen.image.ImageType;public class qrcode {
public static void main(String[] args) {
/* This is an example */
try {
generate (“http://www.oracle.com” , “c:\\temp\\qrcode_temp.gif”);
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void generate(String qrcodetext , String imagefilename)
throws Exception
{
ByteArrayOutputStream out = QRCode.from(qrcodetext).to(ImageType.GIF).stream();
FileOutputStream fout = new FileOutputStream(new File(imagefilename));
fout.write(out.toByteArray());
fout.flush();
fout.close();
}
}

Step 2 . Copy the jar files core-1.7.jar , javase-1.7.jar, and  qrgen-1.2.jar in the directory %ORACLE_HOME%\reports\jlib

Step 3 . Compile this java class using the java compiler in %ORACLE_HOME%\jdk\bin

set CLASSPATH=%ORACLE_HOME%\reports\jlib\core-1.7.jar;%ORACLE_HOME%\reports\jlib\javase-1.7.jar;%ORACLE_HOME%\reports\jlib\qrgen-1.2.jar
%ORACLE_HOME%\jdk\bin\javac qrcode.java

Step 4 . Copy the file qrcode.class generated in Step 3. in %ORACLE_HOME%\reports\jlib directory

 

Step 5 . Make sure REPORTS_CLASSPATH environment variable includes %ORACLE_HOME%\reports\jlib folder where qrcode.class file is located
Step 6 . Import the java class qrcode in the RDF

Step 7 . Create a Formula column in the Reports calling the Java Code :

function CF_1Formula return Char is
image_file_name VARCHAR2(1000);
begin
image_file_name := SRW.CREATE_TEMPORARY_FILENAME ;
qrcode.generate (:DATA , image_file_name);
return(image_file_name);
end;

Step 8 . In the Reports layout , create a Field with the properties :

Source : <The Formula Column created in Step 7>
Read from File : Yes
File Format : Image
Step 9 . Modify the Reports Server configuration in order to add/modify the classPath Reports engine attribute :

<engine minEngine=”1″ maxIdle=”30″ maxEngine=”1″ id=”rwEng” engLife=”50″ class=”oracle.reports.engine.EngineImpl” classPath=”D:\oracle\fmw11r1\oracle_fr\reports\jlib;D:\oracle\fmw11r1\oracle_fr\reports\jlib\core-1.7.jar;D:\oracle\fmw11r1\oracle_fr\reports\jlib\javase-1.7.jar;D:\oracle\fmw11r1\oracle_fr\reports\jlib\qrgen-1.2.jar”>

The classPath attribute value should contain (at least)  the 3 jar files required (core-1.7.jar , javase-1.7.jar and qrgen-1.2.jar) and the directory containing the class qrcode.class created in Step 3.

If you want to test the RDF in the Reports Builder , the 3 jar files required (core-1.7.jar , javase-1.7.jar and qrgen-1.2.jar) and the directory containing the class qrcode.class created in Step 3 must be added (if necessary) to REPORTS_CLASSPATH

The file QRCODE.zip in attachment contains the files :

qrcode.java : the java source of the class qrcode
qrcode.class : the class qrcode
qrcode.rdf  : a RDF in which qrcode.class has been imported and a Formula has been created to call this java code.
qrcode.pdf : a PDF generated using qrcode.rdf

REFERENCES

BUG:8401811 – ENH: NEED ABILITY TO DISPLAY AND PRINT TWO-DIMENSIONAL (2D) BARCODES
NOTE:1269490.1 – Support For 2D Barcode in Oracle Reports
NOTE:1554189.1 – Is it Supported to Upgrade the JDK in the ORACLE_HOME of an 11gR1 or 11gR2 Forms & Reports Installation to JDK 1.7.0_XX ?
NOTE:278044.1 – How to Debug REP-1401 when Executing Reports with Barcode Java Code

Advertisements

Dynamic Ref Cursor Examples

CREATE OR REPLACE PROCEDURE REFCUR(L_P_EMPNO IN EMP.EMPNO%TYPE) IS
TYPE EmpCurTyp IS REF CURSOR;
L_REFCURSOR_CHECK EmpCurTyp;
L_V_SQL_STRING VARCHAR2(200);
v_ename emp.ename%TYPE;
v_dname dept.dname%TYPE;
BEGIN
L_V_SQL_STRING := ‘SELECT E.ENAME, D.DNAME
FROM EMP E,DEPT D
WHERE E.DEPTNO=D.DEPTNO
AND E.EMPNO = :L_P_EMPNO’;

OPEN L_REFCURSOR_CHECK FOR L_V_SQL_STRING USING l_p_empno;
LOOP
FETCH l_refcursor_check INTO v_ename, v_dname;
EXIT WHEN l_refcursor_check%NOTFOUND;
DBMS_OUTPUT.PUT_LINE (v_ename || ‘ works in ‘ || v_dname);
END LOOP;

CLOSE L_REFCURSOR_CHECK;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE (SQLERRM);
END REFCUR;

Oralce Forms 6i: Change MDI form’s icon

To change oracle forms 6i MDI icon file do the following steps:

1. Download “d2kwutil_6_0_6_0” utility from d2kwutil_6_0_6_0.zip
2. Attach library “D2KWUTIL.pll” to the form.
3. Place “d2kwut60.dll” at Forms Bin Folder.
4. Write the Following Cone in New-Form-Instance trigger.

Declare
Icon_Id PLS_INTEGER:=0;
Begin
Win_Api_Session.Change_MDI_Icon(Win_Api_Utility.Get_Active_Window, 'C:\LOGO.ICO', Icon_Id);
End;

4.Compile & Genetrate and save both the PLL & .FMB then Run the form & Test.

What is Subledger Accounting for Cost Management? (Doc ID 466513.1)

APPLIES TO:

Oracle Cost Management – Version 12.0.0 and later
Oracle Inventory Management – Version 12.0.0 and later
Oracle Purchasing – Version 12.0 and later
Information in this document applies to any platform.
Checked for Relevance 17-OCT-2010

 

ABSTRACT

This document describes the SLA process in the Cost Managment product area.

This is a simple overview of what the new functionality is and how it impacts on Inventory, Purchasing, Work in Process transactions and the transfer of the costs to GL.

HISTORY

Author : Laura Miller
Create Date 09-NOV-2007
Update Date 16-MAR-2012

DETAILS

Subledger Accounting Cost Management -Overview

Subledger accounting in R12 is an enhanced accounting process. The SLA process allows customers to customize the process for specific events.

***IMPORTANT NOTE***:

If there are NO rules entered into the SLA engine, the accounts defined the traditional way will be used to generate the journal entries posted to General Ledger. The only difference is that the Transfer to GL is run via the Create Accounting process. The process can be run for draft or final.

Upgrade to R12 SLA is automated and migrates the legal accounting data for the current fiscal year. The customer can migrate Cost Management SLA for historical transactions for a selected number of periods.
With SLA, account generation is now centralized as opposed to each application being responsible for its own accounting. This causes the setup steps for SLA to be the same across products, i.e., Payables, Receivables, and Cost Management.

Benefits of SLA include:
– For customers users define and manage accounting parameters in once centralized place. Users do not have to have different setups for each subledger application.
– Gives customers flexibility to address different and changing accounting requirements to meet business needs
– Allows users to define all components of the journal entry in a simple way as opposed to generating accounting through logic embedded in the accounting programs.
– Allows users to change accounting rules in response to new legal requirement changes in business practices or acquisition of new companies.
– Users can easily control and modify accounting rules. SLA tracks all changes and ensures the programs creating the journal entries are using the latest rules. This is called Compilation and is a PL/SQL package that validates and checks the rules that are being used.
– SLA rules can be date based. So journal entries can be created according to rules depending on accounting date of the transaction.

SLA Engine
SLA uses a rules-based accounting engine that posts entries into GL. The rules used
by the engine are user defined. The rules are stored in a common repository for all subledger applications.
A subledger application would be a product area, such as Inventory, Payables, Receivables, Purchasing, etc. The R12 SLA process has created a common accounting process to be used across all applications.

This allows the customer to have a single method for defining accounting behaviors. For R12, the subledger application for Inventory and Purchasing are combined into the subledger Cost Management.
The SLA process allows for the display of the inventory valuation accounts to be seen for a user defined date range. The engine also allows the accounting department maintain control over accounting and chart of accounts.

When rules are created, the rules engine will override user entered accounts that might be incorrect. This is important to control user errors that can occur within a period. The rules will automatically redirect the costs to the correct account. The rules can be created for most item attributes to allow for granularity of costs if the customer requires this level of detail.

Pre-R12 Accounting Process:
A transaction is received and accounted for in the local subledger
-or-
A transaction is costed and accounted for in the local subledger
The transaction is specifically passed to GL via the Transfer to GL process.
View Accounting Windows will then show the details for these transactions.
R12 Subledger Accounting Process:
After the Rules are established, the Cost Management SLA responsibility allows for the creation of the user-defined accounting data. The request group related to this process includes all SLA processes as well as standard accounting processes. A transaction would be received or costed.

The transaction will then be passed to GL via the Create Accounting Cost Management program. The process categories for this include:
Inventory
Manual
Receiving
Third Party Merge
Work in Process

The Create Accounting – Cost Management request creates accrual journal entries, accrual reversals, and multi-period journal entries.
To transfer the details to GL:
1- Set the parameter in the Create Accounting to Yes
2- If parameter is set to No, then the Transfer to GL process must be run manually.

View Accounting Windows will then allow the details be displayed for these transactions.
To View Accounting Events
Cost Management SLA Responsibility
SLA > Inquiry
Tools Menu Options
Then select Accounting Events, Journal Entries, or Journal Entry Lines to open.

The Transaction Number refers to various event classes including, receiving accounts, PO number for Period End Accruals, transaction id from rcv_transactions, accrual write offs, material account events transaction_id from mtl_material_transactions, WIP account events transaction_id from wip_transactions. Also you can view the Account Journal Entries and Accounting Events from the following View Transaction Windows:
View Receiving Transactions
View Material Transactions
View Resource Transactions

The Use of the Tools > Options is only available if SLA is being used for the transaction. If there is no SLA being used, the distributions button will show the transaction details.

For the Cost Management application, Oracle ships three application accounting definitions. These include:

1- Cost Management – US GAAP
2- Cost Management Encumbrance US GAAP with Encumbrance Accounting
3- Federal costing Supports Federal requirements

The Cost Management application accounting definition comes shipped with the standard accrual accounting method. When the customer creates a new ledger, they have to associate it with the subledger accounting method to be used.

All setups to use preR12 functionality are automatic. The default base setup is US GAAP. This uses the traditional account definitions. This is delivered and works out of the box.

Specific Steps for SLA:

Responsibility: Cost Management – SLA
1. Create Account Derivation Rule (ADR)
2. Copy Journal Line Definition (JLD).
3. Assign ADR to JLD’s Journal Line Type (JLT).

*Perform above steps for all JLDs.
*Following are one time setups:

4. Copy Application Accounting Definition (AAD) and set chart of accounts.
5. Assign JLDs created (in step 2) to corresponding Event Class and Event Type.
6. Validate AAD. Either through screen (‘Validate’ button) or using Concurrent program (‘Validate Application Accounting Definition’).
7. Resolve any issues determined during validation. Verify output file.
8. Copy Subledger Accounting Method (SLAM) and set chart of accounts.
9. Locate and end date (Oracle owned) AAD assigned to this SLAM.
10. Assign SLAM to Ledger.

SLA uses events for processing transactions. An event is the recording of a change of status in the transaction life cycle, i.e., invoice approved, payment received, period closed, etc. This allows for a clear separation between transactions and accounting representation. Events are the bridge between transactions and journal entries, so product teams are involved for coordinating actions based on event models.

4 Main Entities for Cost Management (preseeded):
Material Accounting Events
WIP Accounting Events
Receiving Accounting Events
Write Off Accounting Events

Profile Options for SLA:
SLA: Enable Subledger Transaction Security in GL
SLA: Enable Data Access Security in Subledger
SLA: Additional Data Access Set
SLA: Allow Reports Journal source Override
*These first 4 are used by GL for overall setup of SLA for GL

SLA: Enable Diagnostics
This is only enabled when there are errors in the Create Accounting process.
The value is set to Yes and then the Create Accounting process is run again. The details are then captured and can be reported in the Transaction Objects Diagnostic Report. Because of performance issues, the profile option needs to be reset right away to turn this off and the System Administrator can run the Purge Transaction objects Diagnostics process to clean up the tables.

CST: Receiving Accounting Option
This profile option controls whether the Receiving Transactions Processor creates the accounting entries online or if the transaction accounting entries need to be created via the Create Accounting process.

Cost Management- SLA Responsibility
This is a new responsibility that allows for the setup of SLA and also to access the Create Accounting Cost Management process. The Create Accounting process that can be used for receiving transactions are Create Accounting Cost Management    …  Use Process Category = Receiving
OR
Create Accounting Receiving.

This last process, Create Accounting Receiving, is part of Purchasing responsibility and can only be run for receiving transactions.

For Accrual reconciliation:
—————————
The R12 Accrual reconciliation process will use the accounting entries from SLA as SLA is the source of truth for the real accounting entries. Hence the accrual load can not report any transactions prior to SLA upgrade start date.

Most users processing the receiving transactions would use instead of the Create Accounting – Cost Management is run via the Cost Management SLA responsibility.  This responsibility should have more security and restrictions from users.

Project Manufacturing and SLA-
For the GL posting option set to manufacturing, the cost collector will continue to post the transaction information just as before. The cost collector will pick the account information from mtl_transaction_accounts and wip_transaction_accounts. So if the user has set up any account derivation rules in SLA, they will not be respected by the cost collector.

For the other setup option, i.e when GL posting is set to Projects, depending on whether the auto accounting option has been set to yes or no, the accounts will be passed in or not passed in. If the auto accounting rule option has been set to Yes, no accounts will be passed to Oracle Projects by the cost collector. In this case, the user is responsible for setting the auto accounting rules in Oracle projects setup to derive the accounts. If the auto accounting option has been set to No, the accounts will continue to get passed in just as before (from MTA and WTA).
However, the cost collector will pass in the distribution link from MTA and WTA to Oracle projects. This distribution link will enable Oracle projects to link the distributions created in SLA tables back to the MTA and WTA tables. The distribution links are stored in the columns inv_sub_ledger_id and wip_sub_ledger_id in the MTA and WTA tables.

Periodic Average Costing and SLA – Presently there is no support for SLA for Periodic Average Costing. This is on the enhancement list but as of 12.1.1, this is not supported but is still under review from product development.

Some Reports that have been changed:
CSTRSCCR Supply Chain Cost Rollup
CSTREIVR – Elemental Inventory Value Report

With Implementation of Subledger Accounting Architecture feature in R12, the role of Cost Group/Sub Inventory is limited to maintaining the Unit Cost in the Reports. All the Account Generation for Transaction will be taken care by SLA Engine rules. So all account-related information has been removed from the valuation reports.
The following cost hook is impacted: CSTSCHKB.pls. The SLA setups will take the place of the std_cost_dist_hook, which allows the user to modified the accounts that are used for distributions. This will no longer be used as the user can use standard SLA process for this.

Troubleshooting suggestions:
1- Review logfile for the Create Accounting Cost Management
2- Enable FND: Debug to provide more details
3- Review the Transaction Objects Diagnostic Report
4- Confirm transactions are costed successfully via cost Manager
5- Check if the Create Accounting Cost Management process is successful when using traditional accounts.
6- Run the Subledger Period Close Exceptions Report and review errors, if any.


 

For additional information, please review the following notes:

802966.1 SLA Data Flow and Table Links
471057.1 SLA Cost Management Overview
876190.1 R12: FAQ on Transfer to GL in R12
740215.1 How To Transfer Transactions To GL (Summary) in Cost Management

REFERENCES

NOTE:876190.1 – R12: FAQ on Transfer to GL in R12
NOTE:802966.1 – SLA Data Flow and Table Links

How to use Barcode in Oracle E-Business Suite R12 XML Publisher

How to use Barcode in Oracle E-Business Suite R12 XML Publisher

 

This article explains how you can add barcode fields to your report using Oracle E-Business Suite R12 XML Publisher.

You can download the How to use Barcode in Oracle E-Business Suite R12 XML Publisher PDF Document from the following link:

 

How to use Barcode in Oracle E-Business Suite R12 XML Publisher