Thursday, 28 March 2013
Copying Data From One Table to Another Table in OAF and ADF Using RowsetIterator
Requirement:Copy FirstName,LastName,EmployeeId to Sample Table(Custom)
Step1:Create Sample Table wihch Having Fileds Like FirstName and Last Name and EmployeeId
Step 2:Create New View Object For this Sample Table.
Add Below Code in AM Impl
public void Rowcount()
{
ViewObjectImpl vo = getEmployeesVO1();
RowSetIterator rs = vo.createRowSetIterator("xxx");
while (rs.hasNext())
{
int rowcount=vo.getRowCount();
Row row=rs.next();
ViewObjectImpl newvo=getSampleVO1();
Row row1=newvo.createRow();
newvo.insertRow(row1);
row1.setAttribute("EmployeeId", row.getAttribute("EmployeeId"));
row1.setAttribute("FirstName", row.getAttribute("FirstName"));
row1.setAttribute("LastName", row.getAttribute("LastName"));
getDBTransaction().commit();
}
}
Monday, 25 March 2013
Important Queries Using in OAF
To get Application Short Name and Responsibility Key
SELECT fr.responsibility_key,fa.application_short_name
FROM fnd_responsibility fr, fnd_responsibility_tl frt, fnd_application fa
WHERE fr.responsibility_id = frt.responsibility_id
AND fa.application_id = fr.application_id
AND frt.responsibility_name = 'Purchasing, Vision Operations (USA)'
SELECT fr.responsibility_key,fa.application_short_name
FROM fnd_responsibility fr, fnd_responsibility_tl frt, fnd_application fa
WHERE fr.responsibility_id = frt.responsibility_id
AND fa.application_id = fr.application_id
AND frt.responsibility_name = 'Purchasing, Vision Operations (USA)'
Bundled Exception
In Process Form Request when Save Button Is Clicked
if(pageContext.getParameter("save")!=null)
{
Row row=vo.first();
ArrayList errMsg=new ArrayList();
try
{
int sal=Integer.parseInt(row.getAttribute("Sal").toString());
System.out.println(sal);
int comm=Integer.parseInt(row.getAttribute("Comm").toString());
System.out.println(comm);
if(sal>100)
{
System.out.println(sal);
errMsg.add(new OAException("Salary Less than 100"));
}
if(comm>100)
{
System.out.println(comm);
errMsg.add(new OAException("Comm Less tahn 100"));
}
System.out.println(errMsg);
}
catch(Exception e)
{
e.printStackTrace();
}
am.getOADBTransaction().commit();
errMsg.add( new OAException("Rebate Created Successfully"));
System.out.println(errMsg);
OAException.raiseBundledOAException(errMsg);
}
{
Row row=vo.first();
ArrayList errMsg=new ArrayList();
try
{
int sal=Integer.parseInt(row.getAttribute("Sal").toString());
System.out.println(sal);
int comm=Integer.parseInt(row.getAttribute("Comm").toString());
System.out.println(comm);
if(sal>100)
{
System.out.println(sal);
errMsg.add(new OAException("Salary Less than 100"));
}
if(comm>100)
{
System.out.println(comm);
errMsg.add(new OAException("Comm Less tahn 100"));
}
System.out.println(errMsg);
}
catch(Exception e)
{
e.printStackTrace();
}
am.getOADBTransaction().commit();
errMsg.add( new OAException("Rebate Created Successfully"));
System.out.println(errMsg);
OAException.raiseBundledOAException(errMsg);
}
Output Like
Thursday, 21 March 2013
Entity Level Validation for StartDate and End Date comparison
Entity Level Validation for StartDate and End Date comparison
In EOImpl.java
protected void validateEntity()
{
super.validateEntity();
Date sdate=getStartdate();
Date Edate=getEnddate();
if(sdate.dateValue().getTime()>Edate.dateValue().getTime())
{
throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
getEntityDef().getFullName(), // EO name
getPrimaryKey(), // EO PK
"Enddate", // Attribute Name
Edate, // Attribute Value
"AK", // Message product short name
"FWK_TBX_T_END_DATE_PAST"); // Message name
}
}
In EOImpl.java
protected void validateEntity()
{
super.validateEntity();
Date sdate=getStartdate();
Date Edate=getEnddate();
if(sdate.dateValue().getTime()>Edate.dateValue().getTime())
{
throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
getEntityDef().getFullName(), // EO name
getPrimaryKey(), // EO PK
"Enddate", // Attribute Name
Edate, // Attribute Value
"AK", // Message product short name
"FWK_TBX_T_END_DATE_PAST"); // Message name
}
}
Tuesday, 19 March 2013
Create ViewObject(VO) Dynamically
In ProcessRequest
import oracle.apps.fnd.framework.server.OAViewDef
import oracle.apps.fnd.framework.OAViewObject
import oracle.apps.fnd.framework.server.OAViewDef
import oracle.apps.fnd.framework.OAViewObject
AdminRegAMImpl
am=(AdminRegAMImpl)pageContext.getApplicationModule(webBean);
if(am!=null)
{
OAViewDef
viewdef=(OAViewDef)am.getOADBTransaction().createViewDef();
viewdef.setSql("select ename from scott.emp");
OAViewObject
vo=(OAViewObject)am.createViewObject("SampleVO1",viewdef);
//SampleVO1 is ViewObject Name
}
Monday, 18 March 2013
Set Active Subtab in SubTabLayout
In Process Request
OASubTabLayoutBean subTabLayout =
(OASubTabLayoutBean)webBean.findChildRecursive("region2");/*Region2 subtablayoutname*/
subTabLayout.setSelectedIndex(pageContext,"DeptVO1");/*DeptVO1
is Region Name Under subtablayout*/
subTabLayout.setUnvalidated(Boolean.TRUE);
Make Page Readonly
import
com.oaframewrok.toolkit.util.webBeanUtil
In Process Request:
After
super.processFormRequest(pageContext,webBean)
WebBeanUtil.setViewOnlyRecursive(pageContext,webBean);
Download Above package from below location
http://sourceforge.net/projects/oaftoolkit/files/latest/download?source=files
Download Above package from below location
http://sourceforge.net/projects/oaftoolkit/files/latest/download?source=files
PopUp Window Using PopupBean Programetically
In Process Request
OAPopupBean popupBean
=(OAPopupBean)createWebBean(pageContext,POPUP_BEAN,null,"myPopup");
//Set the following properties on the pop-up:
popupBean.setID("myPopup");
popupBean.setUINodeName("myPopup");
String popupRegion= "/oracle/apps/fnd/framework/toolbox/labsolutions/webui/TestEmpDetailsRN" ;
popupBean.setRegion(popupRegion);
popupBean.setHeight("130");
popupBean.setWidth("320");
popupBean.setTitle("Test");
popupBean.setType(EMBEDDED_POPUP); /* Embedded type */
//Set the following properties on the pop-up:
popupBean.setID("myPopup");
popupBean.setUINodeName("myPopup");
String popupRegion= "/oracle/apps/fnd/framework/toolbox/labsolutions/webui/TestEmpDetailsRN" ;
popupBean.setRegion(popupRegion);
popupBean.setHeight("130");
popupBean.setWidth("320");
popupBean.setTitle("Test");
popupBean.setType(EMBEDDED_POPUP); /* Embedded type */
Saturday, 16 March 2013
Alert Using JavaScript in OAF
if(pageContext.getParameter("SubmitButton")!=null)
{
StringBuffer l_buffer = new StringBuffer();
l_buffer.append("javascript:alert('hello')");
pageContext.putJavaScriptFunction("SomeName",l_buffer.toString());
}
Here SubmitButton is the id name of submitbutton
l_buffer is the variable name of StringBuffer
Subscribe to:
Posts (Atom)