In this article you will learn how to implement a process whereby the information entered by a user in screen can be emailed via PDF to the same user for their electronic signature. For example, in some scenarios, a new employee needs to sign in a form electronically which specifies
the company's policies, terms and conditions . After the employee is hired, then he/she logs into employee self service, and they select various options in a screen. Some of this information may be captured into custom table by embedding custom stack layout regions. After they click Submit button on the page, the business requirement is to email as a pdf attachment. Below is a sample code which gives a basic understanding on how to implement this scenario.
Below are the major steps which are involved in implementing the above functionality:
1) Create an XML publisher page with the required format which should be sent as a pdf attachment to the user.
2) Develop oaf page with the same format for the user to select and fill various options related to the policy.
3) Create a workflow to send the attachment to the user who submits the page.
Technically, we need to do as follows:
1) Save the data in the page into Unix box as a pdf file.
2) Save the pdf file into the blob column of a custom table
3) Send the pdf along with the notification to the user who submits the page.
Step 1
a) Create a custom table as follows:
CREATE TABLE XXX_NEWHIRE_INFO(
PERSON_ID NUMBER,
SEQUENCE_ID NUMBER,
OPTION_SELECT VARCHAR2(1),
DATE_SIGNED DATE,
FILE_DATA BLOB,
FILE_LOCATION BFILE,
FILE_NAME VARCHAR2(300),
FILE_DIR VARCHAR2(100),
FILE_TYPE VARCHAR2(30)
)
b) CREATE SEQUENCE XXX_SEQUENCE
INCREMENT BY 1
MINVALUE 1
START WITH 1
NOCACHE
c) Create an xml publisher template as below. The template contains the option box to select either of the two options before submitting the page. The template is also attached with the article. Check the properties of the Option1 and Option2 fields on how to set the option box value when selected and when not selected.
d) Register the template with template code as test_template
e) Create oaf page with server and webui business components
f) Create Application module and name it as "testAM"
g) Create viewobject as "testVO" and the query inside the viewobject should be like below:
SELECT d.option_select, d.date_signed, papf.person_id, d.file_name
FROM xxx_newhire_info d, per_people_x papf, FND_USER FUSER
where 1 = 1
AND FUSER.USER_ID = FND_GLOBAL.USER_ID
AND FUSER.EMPLOYEE_ID = PAPF.PERSON_ID
AND papf.person_id = d.person_id(+)
h) Attach VO to AM.
i) Create a page and name it as testPG. Specify all the properties of the page. Create a controller for the page and name it as testCO.
j) Create an oaf page layout similar to the template layout attached with 2 option buttons and a submit button. The names of the option buttons should be “option1” and “option2” and the name of the submit button should be “xxx_submit”.
k) Check the attachments for the code involved in the processRequest and ProcessFormRequest of the testCO controller.
l) The Java Code and the pl/sql code is required are in this URL
Comments
Regards
Shanti
Ca n you please let me know where i might have gone wrong....
Exce ption Details.
oracle.apps.fnd .framework.OAEx ception: java.lang.Class CastException
a t oracle.apps.fnd .framework.OAEx ception.wrapper Exception(OAExc eption.java:891 )
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processReque st(OAWebBeanHel per.java:603)
a t oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessRequest(OAW ebBeanContainer Helper.java:247 )
at oracle.apps.fnd .framework.webu i.OAPageLayoutH elper.processRe quest(OAPageLay outHelper.java: 1136)
Thank s
Pavan
2) Is the tmp directory setup properly in the config manager? please check this or check with DBA on this.
3) Make sure that you have proper permissions on that directory.
4) Make sure that there is enough space in that directory to save files.
check ed the permissions on that directory..had 777
i aslo deleted all the files from the tmp directory just to check if it has anything to do with the space.
I Have sent an email to the DBA's, to check if tmp directory is setup correctly in the config manager.
However i got this error, when trying to run this:
oracle.ap ps.fnd.framewor k.OAException: java.lang.NullP ointerException
at oracle.apps.fnd .framework.OAEx ception.wrapper Exception(OAExc eption.java:891 )
at oracle.apps.fnd .framework.webu i.OAPageErrorHa ndler.prepareEx ception(OAPageE rrorHandler.jav a:1145)
at oracle.apps.fnd .framework.webu i.OAPageErrorHa ndler.processEr rors(OAPageErro rHandler.java:1 408)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr ocessFormReques t(OAPageBean.ja va:2679)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:1682 )
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:508)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:429)
at _OA._jspService (OA.jsp:34)
at oracle.jsp.runt imev2.JspPageTa ble.service(Jsp PageTable.java: 317)
at oracle.jsp.runt imev2.JspServle t.internalServi ce(JspServlet.j ava:465)
at oracle.jsp.runt imev2.JspServle t.service(JspSe rvlet.java:379)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:853)
at com.evermind.se rver.http.Servl etRequestDispat cher.invoke(Ser vletRequestDisp atcher.java:727 )
at com.evermind.se rver.http.Servl etRequestDispat cher.forwardInt ernal(ServletRe questDispatcher .java:306)
at com.evermind.se rver.http.HttpR equestHandler.p rocessRequest(H ttpRequestHandl er.java:767)
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:259 )
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:106 )
at EDU.oswego.cs.d l.util.concurre nt.PooledExecut or$Worker.run(P ooledExecutor.j ava:803)
at java.lang.Threa d.run(Thread.ja va:534)
## Detail 0 ##
java.lang.Nu llPointerExcept ion
at com.oracle.apps .eglcust.pdfema il.webui.testCO .processFormReq uest(testCO.jav a:137)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java:81 0)
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java :363)
at oracle.apps.fnd .framework.webu i.OAPageLayoutH elper.processFo rmRequest(OAPag eLayoutHelper.j ava:1159)
at oracle.apps.fnd .framework.webu i.beans.layout. OAPageLayoutBea n.processFormRe quest(OAPageLay outBean.java:15 79)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java:1022)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java:988)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java:84 3)
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java :363)
at oracle.apps.fnd .framework.webu i.beans.form.OA FormBean.proces sFormRequest(OA FormBean.java:3 95)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java:1022)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java:988)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java:84 3)
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java :363)
at oracle.apps.fnd .framework.webu i.beans.OABodyB ean.processForm Request(OABodyB ean.java:363)
a t oracle.apps.fnd .framework.webu i.OAPageBean.pr ocessFormReques t(OAPageBean.ja va:2675)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:1682 )
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:508)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:429)
at _OA._jspService (OA.jsp:34)
at com.orionserver .http.OrionHttp JspPage.service (OrionHttpJspPa ge.java:56)
at oracle.jsp.runt imev2.JspPageTa ble.service(Jsp PageTable.java: 317)
at oracle.jsp.runt imev2.JspServle t.internalServi ce(JspServlet.j ava:465)
at oracle.jsp.runt imev2.JspServle t.service(JspSe rvlet.java:379)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:853)
at com.evermind.se rver.http.Servl etRequestDispat cher.invoke(Ser vletRequestDisp atcher.java:727 )
at com.evermind.se rver.http.Servl etRequestDispat cher.forwardInt ernal(ServletRe questDispatcher .java:306)
at com.evermind.se rver.http.HttpR equestHandler.p rocessRequest(H ttpRequestHandl er.java:767)
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:259 )
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:106 )
at EDU.oswego.cs.d l.util.concurre nt.PooledExecut or$Worker.run(P ooledExecutor.j ava:803)
at java.lang.Threa d.run(Thread.ja va:534)
at com.oracle.apps .eglcust.pdfema il.webui.testCO .processFormReq uest(testCO.jav a:137)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java:81 0)
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java :363)
at oracle.apps.fnd .framework.webu i.OAPageLayoutH elper.processFo rmRequest(OAPag eLayoutHelper.j ava:1159)
at oracle.apps.fnd .framework.webu i.beans.layout. OAPageLayoutBea n.processFormRe quest(OAPageLay outBean.java:15 79)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java:1022)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java:988)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java:84 3)
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java :363)
at oracle.apps.fnd .framework.webu i.beans.form.OA FormBean.proces sFormRequest(OA FormBean.java:3 95)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java:1022)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java:988)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java:84 3)
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java :363)
at oracle.apps.fnd .framework.webu i.beans.OABodyB ean.processForm Request(OABodyB ean.java:363)
a t oracle.apps.fnd .framework.webu i.OAPageBean.pr ocessFormReques t(OAPageBean.ja va:2675)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:1682 )
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:508)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:429)
at _OA._jspService (OA.jsp:34)
at com.orionserver .http.OrionHttp JspPage.service (OrionHttpJspPa ge.java:56)
at oracle.jsp.runt imev2.JspPageTa ble.service(Jsp PageTable.java: 317)
at oracle.jsp.runt imev2.JspServle t.internalServi ce(JspServlet.j ava:465)
at oracle.jsp.runt imev2.JspServle t.service(JspSe rvlet.java:379)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:853)
at com.evermind.se rver.http.Servl etRequestDispat cher.invoke(Ser vletRequestDisp atcher.java:727 )
at com.evermind.se rver.http.Servl etRequestDispat cher.forwardInt ernal(ServletRe questDispatcher .java:306)
at com.evermind.se rver.http.HttpR equestHandler.p rocessRequest(H ttpRequestHandl er.java:767)
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:259 )
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:106 )
at EDU.oswego.cs.d l.util.concurre nt.PooledExecut or$Worker.run(P ooledExecutor.j ava:803)
at java.lang.Threa d.run(Thread.ja va:534)
Thanks once again sir
and what updates are required..
how to find out duplicate records from the table?
Thanks,
MMYS
i followed the process and conduction my own trial and error to pinpoint the issue and i am getting some error during the template helper part.
try
{
TemplateHelpe r.processTempla te(((OADBTransa ctionImpl)pageC ontext.getAppli cationModule(we bBean).getOADBT ransaction()).g etAppsContext() , "XX_VMS", "test_template" , ((OADBTransacti onImpl)pageCont ext.getApplicat ionModule(webBe an).getOADBTran saction()).getU serLocale().get Language(), ((OADBTransacti onImpl)pageCont ext.getApplicat ionModule(webBe an).getOADBTran saction()).getU serLocale().get Country(), inputStream, (byte)1, null, pdfFile);
File file = new File(s_file pathname);
FileOutputStrea m fos = new FileOutputStrea m(file);
BufferedOutputS tream bos = null;
bos = new BufferedOutputS tream(fos);
bos.write(pdfFi le.toByteArray( ));
bos.close();
}
catch(Exception e)
{
response.setCon tentType("text/ html");
throw new OAException(e.g etMessage(), (byte)0);
}
and the error message i get
oracle.app s.fnd.framework .OAException: oracle.jbo.JboE xception: JBO-29000: Unexpected exception caught: java.lang.NoCla ssDefFoundError , msg=oracle/apps /fnd/cp/request /CpContext
at oracle.apps.fnd .framework.OAEx ception.wrapper Exception(OAExc eption.java:891 )
at oracle.apps.fnd .framework.OAEx ception.wrapper Exception(OAExc eption.java:867 )
at _OAErrorPage._j spService(OAErr orPage.jsp:34)
at com.orionserver .http.OrionHttp JspPage.service (OrionHttpJspPa ge.java:56)
at oracle.jsp.runt imev2.JspPageTa ble.service(Jsp PageTable.java: 317)
at oracle.jsp.runt imev2.JspServle t.internalServi ce(JspServlet.j ava:465)
at oracle.jsp.runt imev2.JspServle t.service(JspSe rvlet.java:379)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:853)
at com.evermind.se rver.http.Servl etRequestDispat cher.invoke(Ser vletRequestDisp atcher.java:727 )
at com.evermind.se rver.http.Servl etRequestDispat cher.include(Se rvletRequestDis patcher.java:11 9)
at com.evermind.se rver.http.Everm indPageContext. handlePageThrow able(EvermindPa geContext.java: 547)
at com.evermind.se rver.http.Everm indPageContext. handlePageExcep tion(EvermindPa geContext.java: 518)
at _OA._jspService (OA.jsp:64)
at com.orionserver .http.OrionHttp JspPage.service (OrionHttpJspPa ge.java:56)
at oracle.jsp.runt imev2.JspPageTa ble.service(Jsp PageTable.java: 317)
at oracle.jsp.runt imev2.JspServle t.internalServi ce(JspServlet.j ava:465)
at oracle.jsp.runt imev2.JspServle t.service(JspSe rvlet.java:379)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:853)
at com.evermind.se rver.http.Servl etRequestDispat cher.invoke(Ser vletRequestDisp atcher.java:727 )
at com.evermind.se rver.http.Servl etRequestDispat cher.forwardInt ernal(ServletRe questDispatcher .java:306)
at com.evermind.se rver.http.HttpR equestHandler.p rocessRequest(H ttpRequestHandl er.java:767)
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:259 )
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:106 )
at EDU.oswego.cs.d l.util.concurre nt.PooledExecut or$Worker.run(P ooledExecutor.j ava:803)
at java.lang.Threa d.run(Thread.ja va:534)
if you can please figure out where i did wrong.
at oracle.apps.eam .workorder.webu i.CreateUpdateW OPGCO.processFo rmRequest(Creat eUpdateWOPGCO.j ava:469)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java(Co mpiled Code))
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java (Compiled Code))
at oracle.apps.fnd .framework.webu i.OAPageLayoutH elper.processFo rmRequest(OAPag eLayoutHelper.j ava:1159)
at oracle.apps.fnd .framework.webu i.beans.layout. OAPageLayoutBea n.processFormRe quest(OAPageLay outBean.java:15 79)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java(Compiled Code))
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java(Inlined Compiled Code))
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java(Co mpiled Code))
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java (Compiled Code))
at oracle.apps.fnd .framework.webu i.beans.form.OA FormBean.proces sFormRequest(OA FormBean.java:3 95)
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java(Compiled Code))
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equestChildren( OAWebBeanHelper .java(Inlined Compiled Code))
at oracle.apps.fnd .framework.webu i.OAWebBeanHelp er.processFormR equest(OAWebBea nHelper.java(Co mpiled Code))
at oracle.apps.fnd .framework.webu i.OAWebBeanCont ainerHelper.pro cessFormRequest (OAWebBeanConta inerHelper.java (Inlined Compiled Code))
at oracle.apps.fnd .framework.webu i.beans.OABodyB ean.processForm Request(OABodyB ean.java(Compil ed Code))
at oracle.apps.fnd .framework.webu i.OAPageBean.pr ocessFormReques t(OAPageBean.ja va(Compiled Code))
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java(Comp iled Code))
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java(Comp iled Code))
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java(Inli ned Compiled Code))
at _oa__html._OA._ jspService(_OA. java(Compiled Code))
at oracle.jsp.runt ime.HttpJsp.ser vice(HttpJsp.ja va(Compiled Code))
at oracle.jsp.app. JspApplication. dispatchRequest (JspApplication .java(Compiled Code))
at oracle.jsp.JspS ervlet.doDispat ch(JspServlet.j ava(Compiled Code))
at oracle.jsp.JspS ervlet.internal Service(JspServ let.java(Compil ed Code))
at oracle.jsp.JspS ervlet.service( JspServlet.java (Compiled Code))
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java(Comp iled Code))
at org.apache.jser v.JServConnecti on.processReque st(JServConnect ion.java(Compil ed Code))
at org.apache.jser v.JServConnecti on.run(JServCon nection.java(Co mpiled Code))
at java.lang.Threa d.run(Thread.ja va(Compiled Code))
Hi could you help me on this issue, as it eats major time of ours
RSS feed for comments to this post