Business Requirement : When User require report output from jsp/Oa framework page then They have to Run concurrent program which is very tedious process for users and if user wants output in Excel/PDF/Word and in many other formats then they have to run concurrent program again and again for each different type of output file.
So Business requirement is that report output should be retrieved from Oa framework Page Just by single Button Click For Different Type Of Formats.
Sample Output :-
Solution : Creating Oa framework Report and Showing output of Report in Different Format We have to integrate oa framework and Xml Publisher.
For this solution first you have to create Oa framework page, Data Template and Data definition.
So Business requirement is that report output should be retrieved from Oa framework Page Just by single Button Click For Different Type Of Formats.
Sample Output :-
Solution : Creating Oa framework Report and Showing output of Report in Different Format We have to integrate oa framework and Xml Publisher.
For this solution first you have to create Oa framework page, Data Template and Data definition.
STEPS:-
-
Open Jdeveloper and create new project “oareport”.
-
Create view object using below query.
Field
|
Value
|
Package
|
oareport.oracle.apps.ak.server
|
Name
|
EmpVO
|
Query:
select employee_number,full_name,hr_general.decode_lookup('SEX',sex)sex,hr_general.decode_lookup('NATIONALITY',nationality)nationality from per_all_people_f
where trunc(sysdate) between effective_start_date and effective_end_date and current_employee_flag='Y' and rownum =1 |
-
Create Application Module.
Field
|
Value
|
Package
|
oareport.oracle.apps.ak.server
|
Name
|
XMLIntegrationAM
|
-
Click on Edit Application module on “XMLIntegrationAM” and move “EmpVO” to right side.
-
Right Click on Project and Create new oa component -> Page.
Field
|
Value
|
Package
|
oareport.oracle.apps.ak.webui
|
Name
|
XMLIntegrationPG
|
-
go to Structure of page -> Page Layout region and set Below Property
Field
|
Value
|
ID
|
MainRN
|
AM Definations
|
oareport.oracle.apps.ak.server.XMLIntegrationAM
|
Window Title
|
Welcome Page
|
-
Right Click on MainRN and click on Set new Controller Class.
Field
|
Value
|
Package Name
|
oareport.oracle.apps.ak.webui
|
Class
|
XMLIntegrationCO
|
-
Go to Controller and Add below code in processRequest of XMLIntegrationCO.java
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{ super.processRequest(pageContext, webBean); OAApplicationModule am= pageContext.getApplicationModule(webBean); am.invokeMethod("getEmpDataXML"); } |
-
Go to structure of Application module XMLIntegrationAM and open XMLIntegrationAMImpl.java file and add below method in File.
public void getEmpDataXML()
{ try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); OAViewObject vo = (OAViewObject)findViewObject("EmpVO1"); ((XMLNode)vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS)).print(outputStream); System.out.println(outputStream.toString()); } catch (Exception e) { throw new OAException(e.getMessage() + "Custom Error"); } } |
-
Right Click on XMLIntegrationPG and click on Run.
After completing loding of page Compiler Will Display Output.
Save above xml content to file.
Xml File Name: EmpData.xml
Save above xml content to file.
Xml File Name: EmpData.xml
<EmpVO>
<EmpVORow> <EmployeeNumber>4</EmployeeNumber> <FullName>Walker, Mr. Kenneth (Ken)</FullName> <Sex>Male</Sex> <Nationality>American</Nationality> </EmpVORow> </EmpVO> |
-
Go to structure of XMLIntegrationPG and add pageButtonBar region .
Field
|
Value
|
ID
|
ButtonRN
|
Region Style
|
pageButtonBar
|
-
Right Click on ButtonRN and add 3 new items with below property.
1)
Field
|
Value
|
ID
|
PrintWord
|
Item Style
|
SubmitButton
|
Prompt
|
Print Word
|
2)
Field
|
Value
|
ID
|
PrintExcel
|
Item Style
|
SubmitButton
|
Prompt
|
Print Excel
|
3)
Field | Value |
ID | PrintPdf |
Item Style | SubmitButton |
Prompt | Print PDF |
-
Right Click on MainRN in XMLIntegrationPG and add below new QueryRegion.
Field
|
Value
|
ID
|
QueryRN
|
Region Style
|
query
|
Construction
|
resultBasedSearch
|
Include Simple panel
|
true
|
-
Right Click on QueryRN and click Region using wizard and add new table region and add EmpVO in table.
-
Go to XMLIntegrationAM and change code of below method.
public XMLNode getEmpDataXML()
{ try { OAViewObject vo = (OAViewObject)findViewObject("EmpVO1"); XMLNode xmlNode = (XMLNode)vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS); return xmlNode; } catch (Exception e) { throw new OAException(e.getMessage() + "Custom Error"); } } |
-
Change controller class XMLIntegrationCO.java according to below Attached file.
Code : XMLIntegrationCO.java
-
Retrive $JAVA_TOP/oracle/apps/xdo Directory from server and place it in Jdeveloper because it is needed for some import.
-
Build Project and run XMLIntegrationPG but it will show blank output in output file on Clint machine but when you Deploy it to server and take output then it will show correct output.
-
create "oareport" directory on desktop from merging code of “myproject” and “my classes”.
Source Code : oareport.rar
-
Move "oareport" to $JAVA_TOP Directory.
-
Run below script to import oa framework page
java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/oareport/oracle/apps/ak/webui/XMLIntegrationPG.xml -username APPS -password apps -dbconnection " (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp) (HOST=192.168.1.200)(PORT=1521)) (CONNECT_DATA= (SID=vis) ) )" -rootdir $JAVA_TOP
-
Restart Server.
adoacorectl.sh stop
adoacorectl.sh start
adapcctl.sh stop
adapcctl.sh start
-
Create Data Definition.
Field
|
Value
|
Name
|
EmpDataDD
|
Application
|
Human Resources
|
Code
|
EmpDataDD
|
Start Date
|
Current Date
|
-
create Data Template
Name
|
EmpDataDT
|
Application
|
Human Resources
|
Type
|
RTF
|
Default File
|
EmpData.rtf
|
Default File Language
|
English
|
Code
|
EmpDataDT
|
Data Definition
|
EmpDataDD
|
Start Date
|
Current date
|
End Date
|
|
Sub template
|
No
|
Default File Territory
|
|
Default Output Type
|
PDF
|
Preview Format
|
PDF
|
File Name
|
EmpData.rtf
|
Language
|
English
|
RTF File
|
|
XML File
|
-
create below form function.
Field
|
Value
|
Function
|
XX_EMPLOYEE_DETAILS_PAGE
|
User Function Name
|
XX_EMPLOYEE_DETAILS_PAGE
|
Type
|
SSWA jsp function
|
HTML Call
|
OA.jsp?page=/oareport/oracle/apps/ak/webui/XMLIntegrationPG
|
-
Attach function To below menu.
Field
|
Value
|
Function Name
|
XX_EMPLOYEE_DETAILS_PAGE
|
User Menu Name
|
Employee Detail Menu
|
Menu Name
|
XX_EMPLOYEE_DETAILS_MENU
|
-
Create below Responsibility and attach Below Menu.
Field
|
Value
|
Responsibility Name
|
Employee detail Responsibility
|
Responsibility Key
|
XX_EMPLOYEE_DETAIL_RESP
|
Menu name
|
Employee Detail Menu
|
-
Attach Responsibility to your user.
-
Login to Your User and open page.
-
Click on Print Pdf .
-
Click on open It Will show Output in Pdf format.
-
Click on Print Word .
-
Click on open output will be shown in word format.
-
Search any employee number and click on print Excel.
-
Click on open output will show record for one Employee.
Comments
Thanks a lot for ur efforts.
Thank s a lot for sharing this article,absolut ely awesome.
But am getting an error while opening the report from application (after the page is completely developed from jDeveloper and have moved
everything to midtear).
the error is when i press one of the options like say PrintWord, am getting error " missing file .. \cabo\styles\ca che\swanEXTN-cu stom-2 3 6 2-en-ie-windows .css"
Don't have any clue about this.
Any suggestions in this regard is highly appreciated.
Th anks
I cannot run the page due to following error "Error(26,8): class XML Node", please provide me the import for this class.
Regards ,
Syed Laiq Uddin
keep up the good work Daksesh, hope to see more of your great work again soon.
warm regards
Abdulra hman
After deployment of the code on R12.0.6 I am getting the following error: Can you please advise about the missing class?
An exception occured.
URL=h ttp://xxxx.xxxx .com:8000/OA_HT ML/OA.jsp?page= /oareport/oracl e/apps/ak/webui /XMLIntegration PG&transactioni d=1010681421&la nguage_code=US& CallFromForm='Y '
javax.servle t.ServletExcept ion: oracle.classloa der.util.Annota tedClassNotFoun dException:
Missing class: __9__9_OA
Depe ndent class: oracle.jsp.runt imev2.JspPageIn fo
Loader: oc4j:10.1.3
Code-Source: /d01/ebsr12/app s/tech_st/10.1. 3/j2ee/home/lib /ojsp.jar
Configuration: in META-INF/boot.x ml in /d01/ebsr12/app s/tech_st/10.1. 3/j2ee/home/oc4 j.jar
This load was initiated at oacore.web.html .jsp990395144:0 .0.0 using the loadClass() method.
The missing class is not available from any code-source or loader in the system.
I received the below error : while running the page from Jdeveloper.
'c ould not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded)'
I opened the page using : notepad and found that it included the total HTML tags, which are used for generating the OA page.
Is it compulsory to register the page in Apps Instance ?
Please clarify.
-Srid har
I have a urgent requirement to implement the same in i-Supplier page. Perform all the steps as directed but getting error while I tried to open the PDF file after download. I have even checked after deploying your code into server but its not working. Please help to resolve the issue.
Regards ,
Sanjil Jain
RSS feed for comments to this post