Callable Statement

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 206

Callable Statement & Prepared Statment in OAF

oaf
==================
https://blogs.oracle.com/prajkumar/entry/oaf_developer_guide

Callable Statement in OAF

To Call a Procedure :
OADBTransactionImpl txn =
(OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOAD
BTransaction();
CallableStatement cs =
txn.createCallableStatement("begin :1 :=
check_Approval_Status(:2,:3); end;",
OADBTransaction.DEFAULT);
try {
cs.registerOutParameter(1, Types.VARCHAR);
cs.setString(1, "retStatus");
cs.setInt(2, scoreCardId);
cs.setInt(3, personId);
String outParamValue = null;
cs.execute();
outParamValue = cs.getString(1);
cs.close();

if (outParamValue.equals("N")) {
OASubmitButtonBean oas =
(OASubmitButtonBean)webBean.findChildRecursive("MgrTransfer");
oas.setDisabled(true);
}
} catch (SQLException sqle) {
throw new OAException("Error in Staffing Query",
OAException.ERROR);
}
Example 2 :
OADBTransactionImpl OADBTxn =
(OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOAD
BTransaction();
String query_String = new String();
query_String =
"BEGIN insert_into_table(:1,:2,:3,:4,:5);END;";
OracleCallableStatement stmt =
(OracleCallableStatement)OADBTxn.createCallableStatement(query_String,
-1);
try {
stmt.setInt(1, jObjectiveId);
stmt.setString(2, jName);
stmt.setInt(3, jScorecardId);
stmt.setString(4, jGroupCode);
stmt.setInt(5, jOwningPersonId);
stmt.execute();
stmt.close();
} catch (SQLException e) {
throw new OAException("Error in Staffing Query : " +
e, OAException.ERROR);
}
To call a Function

OADBTransactionImpl txn =
(OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOAD
BTransaction();
CallableStatement cs =
txn.createCallableStatement("begin :1 := xx_pra_func(:2);
end;",OADBTransaction.DEFAULT);
try {
cs.registerOutParameter(1, Types.VARCHAR);
cs.setString(1, "ValuesI");
cs.setInt(2, 100);
String outParamValue = null;
cs.execute();
outParamValue = cs.getString(1);
cs.close();
throw new OAException("Function us "+outParamValue);
} catch (SQLException sqle) {
throw new OAException("Error in Staffing Query",
OAException.ERROR);
}

Prepared Statment in OAF


OADBTransactionImpl OADBTxn =
(OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOAD
BTransaction();
try {
Connection conn =
pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbc

Connection();
String Query =
"select nvl((SELECT approval_status from
apps.XX_SAMPLE_TABLE" +
" where objective_id=:1),'Approved') status from dual";
PreparedStatement stmt = conn.prepareStatement(Query);
stmt.setInt(1, objectiveId);
for (ResultSet resultset = stmt.executeQuery();
resultset.next(); ) {
pageContext.writeDiagnostics(this, "Query Executed",
1);
String result = resultset.getString("status");//Get the result
of the query and store in the string result
}
} catch (Exception exception) {
throw new OAException("Error in Staffing Query" +
exception, OAException.ERROR);
}

Execute sql script in OAF


Saturday, August 27, 2011
Execute sql script in OAF

// Required import packages


import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.jbo.domain.Number;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

//
try
{
Connection conn =
paramOAPageContext.getApplicationModule(paramOAWebBean).getO
ADBTransaction().getJdbcConnection();
String Query ="SELECT empId resultId,empName
resultName,empPosition resultPos from XXXXX_TABLE WHERE
DeptId=:1";
PreparedStatement stmt =
conn.prepareStatement(Query);
stmt.setInt(1, departmentId);
for (ResultSet resultset = stmt.executeQuery(); resultset.next(); )
{
int employeeId = resultset.getInt("resultId");
String employeeName = resultset.getstring("resultName");
String employeePosition = resultset.getString("resultPos");
}
stmt.close();
}catch(SQLException sqle)
{
throw new OAException("Exception Block"+sqle);
}

Real time Project OAF

Real time Project

PROJECT:1
Create a customer search page as shown and then link to create customer
page

Create Header Table


CREATE TABLE po.xxcustomer_rebate_header
( header_id
NUMBER
, contract_number
VARCHAR2(80)
, division
VARCHAR2(80)
, party_name
varchar2(100)
, contact_person
VARCHAR2(80)
, level1_from
NUMBER
, level1_to
NUMBER
, level2_from
NUMBER
, level2_to
NUMBER
, level3_from
NUMBER
, level3_to
NUMBER
, level4_from
NUMBER
, level4_to
NUMBER

, advertising_rebate
NUMBER
, freight_deduct
NUMBER
, cash_discount
NUMBER
, updated_flag
VARCHAR2(3)
, accrued_flag
VARCHAR2(3)
, creation_date
DATE
, created_by
NUMBER
, last_update_date
DATE
, last_update_login
NUMBER
, last_updated_by
NUMBER
, commments
VARCHAR2(1000)
, contract_start_date
DATE
, contract_end_date
DATE
, contract_expiry_date
DATE
, delivered_by
VARCHAR2(80)
, received_by
VARCHAR2(80)
, contract_attachment
BLOB
, bill_to_location
varchar2(100)
, ad_payment_type
VARCHAR2(40)
, ad_payment_period
VARCHAR2(40)
, vr_payment_type
VARCHAR2(40)
, vr_payment_period
VARCHAR2(40)
, paid_flag
VARCHAR2(3)
, file_name
VARCHAR2(80)
);
1. Create synonym apps. xxcustomer_rebate_header for
po.xxcustomer_rebate_header
2. Create sequence po. xxcustomer_rebate_header_con_seq start with 10000
3. Create synonym apps. xxcustomer_rebate_header_con_seq
for po.xxcustomer_rebate_header_seq
4. Create sequence po. xxcustomer_rebate_hdr_seq start with 100
5. Create synonym apps. xxcustomer_rebate_hdr_seq for po.
xxcustomer_rebate_hdr_seq
Create Line table
CREATE TABLE po.xxcustomer_rebate_line

( line_id
, header_id
, product_code
, level1_amt
, level1_break
, level2_amt

NUMBER
NUMBER
VARCHAR2(80)
NUMBER
VARCHAR2(3)
NUMBER

, level2_break
VARCHAR2(3)
, level3_amt
NUMBER
, level3_break
VARCHAR2(3)
, level4_amt
NUMBER
, level4_break
VARCHAR2(3)
, creation_date
DATE
, created_by
NUMBER
, last_update_date
DATE
, last_update_login
NUMBER
, last_updated_by
NUMBER );
1.Create synonym apps. xxcustomer_rebate_line_seq for
po.xxcustomer_rebate_line_seq
2. Create sequence po. xxcustomer_rebate_line_seq start with 10
3.Create synonym apps.xxcustoemr_rebate_lilne_seq for
po.xxcustomer_rebate_line_seq

INSERT
DEVELOP SEARCH PAGE Name As: XxcustomerSearch Page
Step1
1) Create Page (.jws,.jpr,bc4j,Am,Page,Attacht Am to Page) (window title, Title)
2) Rt click on Main RN---- New RN StyleMsgCompnent, properties: Row 1,
Coloum 3
Rt click Msg Compent RNCreate 3 Items
Item1 - id &prompt: Party Name,
Item2 - id &prompt: Division,
Item3 - id &prompt: Contract Number,
3) Rt click MainRN NewRN Style ---RowlayoutRN
Item1 - id & PromptGo
Style: Submit Button
Item---Style: Spacer
Width: 10
Item3- Id & Prompt Clear
Style: Submit Button
Item---Style: Spacer
Width: 10
Item2 - id & PromptCreate Rebate Style: Submit Button
4) Rt click Main RN New RNStyle: Table
Item1 - id &prompt: Party Name,

Properties: ViewInstacne & View Attribute

Item2 - id &prompt: Division,


Properties: ViewInstacne & View Attribute
Item3 - id &prompt: Contract Number Properties: ViewInstacne & View Attribute

Step-2
Create VO In. Server for Search Page Name
as: XxcustomerSearchVO
Attach VO to AMBy Using this Query
(Select party_name, division, contract_number from
po.xxcustomer_rebate_header Where party_name like nvl (:1, party_name)
And division like nvl (:2, division)
And contract_number like nvl (:3, contract_number))
ignore now

If you want Deleting the Customer Information from Data Base permanently use
the Code
(We can modify in same XxcustomerSearchVO)
a. Expand...Schema Server Send to xxcustomer_rebate_header (Its created for
HeaderEO)
b. Select Attribute and Suffield like
-- Party_Name (xxcustomer_rebate_headerEO:Party_Name)
-- Division (xxcustomer_rebate_headerEO: Division)
-- Contract _Number (xxcustomer_rebate_headerEO: Contract _Number)
-- Headerid (xxcustomer_rebate_headerEO: Headerid)
c. Select Query
Select xxcustomer_rebate_headerEO. Party _Name,
xxcustomer_rebate_headerEO. Division
xxcustomer_rebate_headerEO. Contract _Number
xxcustomer_rebate_headerEO. Headerid
From xxcustomer_rebate_header xxcustomer_rebate_headerEO
Where xxcustomer_rebate_headerEO.Party _Name like nvl(:1,
xxcustomer_rebate_headerEO. Party
_Name)
xxcustomer_rebate_headerEO.Division like nvl(:1,
xxcustomer_rebate_headerEO. Division)
xxcustomer_rebate_headerEO. Contract _Number like nvl(:1,
xxcustomer_rebate_headerEO. Contract
_Number)
xxcustomer_rebate_headerEO. Headerid like nvl(:1,
xxcustomer_rebate_headerEO. Headerid)
Step-3
Expand AM Node Double click on AMImpl..Java write the code
( To Mapping the VO Attribute To Regions Items )
Import these Statements from Controller (copy & Past)

import oracle.apps.fnd.framework.webui.OAPageContext;

import oracle.apps.fnd.framework.webui.beans.OAWebBean;
public int searchparams(OAPageContext pc,OAWebBean wb)
{
String cusname="";
String divison="";
String contractno="";
int flag=0;
XXSunCustomerSearchVOImpl vo=getXXSunCustomerSearchVO();
if(pc.getParameter("CName")!=null&&!pc.getParameter("CName").equals(""))
{
cusname=pc.getParameter("CName");
vo.setWhereClauseParam(0,cusname);
flag=1;
}
else
{
vo.setWhereClauseParam(0,null);
}
if(pc.getParameter("Division")!=null&&!pc.getParameter("Division").equals(""))
{
divison=pc.getParameter("Division");
vo.setWhereClauseParam(1,divison);
flag=2;
}
else
{
vo.setWhereClauseParam(1,null);
}
if(pc.getParameter("ContractNumber")!=null&&!
pc.getParameter("ContractNumber").equals(""))
{
contractno=pc.getParameter("ContractNumber");
vo.setWhereClauseParam(2,contractno);
flag=3;
}
else
{

vo.setWhereClauseParam(2,null);
}
System.out.println("print flag value"+flag);
return flag;
}
Step-4
Create Controller for XxcustomerSearchPage
Rt Click On Main RN Set New Controller Name As: XXcustomerSearchCO
We have to import one statement
xxdel.oracle.apps.po.xxcustomer_rebate_project.server.Xxcustomer_Rebate_projectA
MImpl;
Write this code After Process Form Request
XXSunCustomerRebatesAMImpl am=(XXSunCustomerRebatesAMImpl)
pageContext.getApplicationModule(webBean);
if(pageContext.getParameter("Go")!=null)
{
am.searchparams(pageContext,webBean);
am.getXXSunCustomerSearchVO().executeQuery();
}

Step-7
If we Want to Create LOVs, Drop Down Lists, Entity Objects - Should Create
BC4Js
Under .jpr
1) Rt click on .jpr---New Business Component ---Bc4j..poplist.server
a. Rt Click On poplist.Server New View Object Name As: DivisionVO ---Next
Next
b. Select Query Select 'IT' division from dual
Union
Select 'Accounting' division from dual
Union
Select 'Finance' division from dual -----Next---Finish
c. Attach VO to AM

2) Rt click on .jpr---New Business Component---Bc4jLov.Server

Rt Click On poplist.Server New View Object Name As: CustomerNameLOVVO


---NextNext Select customer name from RA_customers -----Next---Finish
Attach VO to AM
3) Rt click on .jpr---New Business Component---Bc4jSchema. Server
Create EO for Header
Rt click on...Schema bc4j create new Entity Object ---Next-A. Check on synonym
B. Copy the Synonym from header table & past into the
Schma Object: xxcustomer_rebate_header
C. Place the cursor on Name field table Name Automatically will generate
We should end with EONextNext
D. Check the Primary Key in Check Box Next
E. under Generate Method checks the all check boxes Nextnextfinish
Create EO for Line
Rt click on Schema bc4j create new Entity Object ---Next-a. Check on synonym
b.Copy the Synonym from header table & past into the
Schma Object: xxcustomer_rebate_line
c.Place the cursor on Name field table Name Automatically will Generate
We should end with EONextNext
d.Check the Primary Key in Check Box Next
e.Under Generate Mehodwe should check the all check boxes NextNext
Finish
Step-8
Create VO Based On EO for Header
Right Click on .Server Bc4j Create VO Name
As:Xxcustomer_Rebate_hdrVO ----Next
Expand the Schema Node Chose the Header EO and Send the Select page, next
Chose the all Columns and Send the Select Page --- Next---Next----Finish.
Step-9
Create VO Based On EO for Line
Right Click on .Server Bc4j Create VO Name As: Xxcustomer_Rebate_lineVO ---Next

Expand the Schema Node Chose the Header EO and Send the Select page, Next
Chose the all Columns and Send the Select Page --- Next---Next----Finish.

Develop One Create Page Name As: XxcustomerCreatePage


Step-5
1.

Create Page (.jws,.jpr,bc4j,Am,Page,Attacht Am to Page) (window title,


Title)

Select XxcustomerCreatePage
For Header
2) Rt click on Main RN New RN-StyleTable Layout
Rt click on Table Layout RNNew Row Layout
Rt click on Row Lay out RNNewCell Format
Rt click on Cell Format RNNewRegion Using Wizard
Select HeaderVONextRegion Style: Default Double ColumnNext

As per our Requirement Choose the Columns.

3) Rt click on Row Layout RNNew Cell Format


Rt click on Cell Format RNNew-Region Using Wizard
Select Header VO Region Style: Default Single Column
As per our Requirement Choose the Columns.

4) Under Cell Format RNSelect Default Single Column RN


In Properties Visual Text: Qualifying Sales ($) Levels
Under Cell Format RN create Item Id & Prompt: Comments

Properties: Maximum Size: 1000


Length: 100
Height: 3

Step-5 Contn..
Select XxcustomerCreatePage inRegion4 (Default Double Column)
Under Region4 Select the Item: Party Name Change Style As: Message lovinput
Under Party Name 1 Region will be created
RT click on RegionNewtable using wizardSelect CustomerNameLOVVO
Next
NextSend the Customer Name Next---Finish
In Customer Name Properties Mapping
Lov Region item: Customer Name
Return item
: Party Name
Criteria item
: Party Name
Follow the Same Steps for BilltoLocation
For Lines
5) Rt click Main RN New RN Style: Advance Table View Instant: Select Line VO
Rt click on Advance Table RNNewColumn
Rt click on ColumnNewItem
properties: View Attribute
Rt click on Column HeaderNew---Sort able Header Create Prompt
(Create more Columns, Items & Column Headers for Rest of Things)

6) Rt click on Main RNNew RN Style: Page Button Bar


Under this RNCreate 3 Items
Item1---Id & Prompt
save
Style: Submit Button
Item2----Style----Spacer
Item3Id&Prompt
Go To Search
Style: Submit Button

Contd. Select XxcustomerCreatePage inRegion4 (Default Double Column)


e. under Region4 Select the Item: Division Change Style As: Message Choice
In Properties Pick list View Instance: DivisionVO (Copy from AM)
Pick list Display Attribute: Division
(Column Name)
Pick list Value Attribute: Division
(Column Name)

Step-6
In OAF call one Page to another Page Use this Parameters
(Link B/W Search Page and Create Page)
Open: XxcustomerSearchCO
Import one statement
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;

Write this code after form Request


if (pageContext.getParameter("CreateRebate")!=null)
{
pageContext.setForwardURL("OA.jsp?
page=/xxdel/oracle/apps/po/xxcustomer_rebate_project/webui/Xxcustomer_Rebate_C
reatePG",( Here Take the Crate Page URL)
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true, // Retain AM
OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
OAWebBeanConstants.IGNORE_MESSAGES);
}
Step-10
Create Sequence for the Header Table Write Code in AMImpL..Java
Expand the AM Node Write the code in AMImpL..Java
Import 3 statements
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.jbo.Row;
import oracle.jbo.domain.Number;
public void customerheader()
{
Xxcustomer_Rebate_hdrVO Impl vo=get Xxcustomer_Rebate_hdrVO ();
OADBTransaction tr=getOADBTransaction();
if(!vo.isPreparedForExecution())
{
vo.executeQuery();
}
Row row=vo.createRow();
vo.insertRow(row);

Number ctno=tr.getSequenceValue("xxcustomer_rebate_seq");
vo.getCurrentRow().setAttribute("ContractNumber", ctno);
String hid=tr.getSequenceValue("xxcustomer_rebate_header_seq").toString();
vo.getCurrentRow().setAttribute("HeaderId", hid);
}
Step-11
Create Controller for Create Page Name As: XxcustomerCreateCO
To Generate Sequence for Header
Uder this call the header method from AMImpl
Import one statement
import xxdel.oracle.apps.po.xxcustomer_rebate_project.server.
Xxcustomer_Rebate_projectAMImpl;
Write the Code in Process Request
Xxcustomer_Rebate_projectAMImpl
am=(Xxcustomer_Rebate_projectAMImpl)pageContext.getApplicationModule(webB
ean);
am.customerheader();
Step-12
Create Add Button for Lines
Select Create Page In Advance Table RNNewFooter
Rt click on FooterNewAdtableRow
Properties: Add Rows Lable: Add Another Row
Rows to Add: 1
Insert Rows Automatically: False
Step-13
To Create Sequence for Lines, Write the Code in AMIpmL.Java
public void customerline()
{
Xxcustomer_Rebate_lineVO Impl vo= get Xxcustomer_Rebate_lineVO ();
Xxcustomer_Rebate_hdrVO Impl vo1=get Xxcustomer_Rebate_hdrVO ();
OADBTransaction tr=getOADBTransaction();
vo.setMaxFetchSize(0);
Row row=vo.createRow();
vo.insertRow(row);
Number lineid=tr.getSequenceValue("xxcustomer_rebate_line_seq");
vo.getCurrentRow().setAttribute("LineId",lineid);
String headerid=vo1.getCurrentRow().getAttribute("HeaderId").toString();
vo.getCurrentRow().setAttribute("HeaderId",headerid);

}
Step-15
In XxcustomerCreatePage after Enter the Customer Information we have to save
Open XxcustomerCreateCOWrite the code After Process Form Request
Xxcustomer_Rebate_projectAMImpl
am=(Xxcustomer_Rebate_projectAMImpl)pageContext.getApplicationModule(webB
ean);
if(pageContext.getParameter("Save")!=null)
{
am.getOADBTransaction().commit();
throw new OAException ("record saved
successfully",OAException.CONFIRMATION);
}
Step-14
Code for Add Button & Generate Sequence for Lines
Write the Code inXxcustomerCreateCO
After Process Form Request
if(ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
{
am.customerline ();
}
Step-16
Link B/W XxcustomerCreatePage to XxcustomerSearchPage
Write the code In XxcustomerCreateCO
Import one statemet
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
After Form Request
if(pageContext.getParameter("GoTOSearch")!=null)
{
pageContext.setForwardURL("OA.jsp?
page=/xxsun/oracle/apps/po/newrebates/webui/XxcustomerCreatePage ",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
false, // Retain AM
OAWebBeanConstants.ADD_BREAD_CRUMB_NO,

OAWebBeanConstants.IGNORE_MESSAGES);
}
Step-17
Develop One Update Page Name As: XxcustomerUpdatePage
Follow the Same Steps for Update Page Which is using in XxcustomerCreatePage
As per Our Requirements

Update
Step-18
Select XxcustomerSearchPage
In Table RegionCreate 1 Item
Id & Prompt: Edit Style: Image
In Properties: 1) Image URL: Updateicon-enable.gif (take from path OA-Media)
2) Action Type: Fire Action (ones create Action Type Event will be Create)
3) Event: update (if we want we can change the Event Name)
4) Parameters: click here one window will open ( it will Pass Value Dynamically)
Name
Value
Pheaderid (Variable)
${oa. XxcustomerSearchVO1.HeaderId}
--- OK
(SearchVO-take from AM) (Attribute Name)
Check VO and add HeaderId **
Step-19
Create Controller for XxcustomerUpdatePage Name as: XxcustomerUpdateCO
Follow the Same Steps where in XxcustomerCreateCO
For Update the customer Information write this code inXxcustomerUpdateCO
In Process request
{
String headerid=pageContext.getParameter("pheaderid").toString();
(variable)
(Spell variable)
String wherecondition="HEADER_ID='"+headerid+"'";
(DataBaseColumnName)
am.getXxcustomer_Rebate_hdrVO1().setWhereClause(wherecondition);
am.getXxcustomer_Rebate_hdrVO1().executeQuery();
am.getXxcustomer_Rebate_lineVO1().setWhereClause(wherecondition);
am.getXxcustomer_Rebate_lineVO1().executeQuery();
}

Delete
Step-20
Select XxcustomerSearchPage
In Table RegionCreate 1 Item
Id & Prompt: Delete
Style: Image
In Properties: 1) Image URL: deleteicon_enable (take from path OA-Media)
2) Action Type: Fire Action (ones create Action Type Event will be Create)
3) Event: delete (if we want we can change the Event Name)
4) Parameters: click here one window will open (it will Pass Value
Dynamically)
Name
Value
Pdelete (Variable)
${oa. XxcustomerSearchVO1.Headerid}
--- OK
SearchVO-take from AM) (Attribute Name)
Step-21
In AMImpL.Java import this package
import oracle.jbo.RowSetIterator;
import oracle.apps.fnd.framework.webui.OADialogPage;
import java.util.Hashtable;
import java.io.
import oracle.apps.fnd.framework.OAViewObject;
import xxdel.oracle.apps.po.xxcustomer_rebate_project.server.
Xxcustomer_Rebate_projectVORowImpl;
public void deleteHederslines(String headerId)
{
int programToDelete = Integer.parseInt(headerId);
OAViewObject vo = (OAViewObject)getXxcustomer_Rebate_projectVO1();
Xxcustomer_Rebate_projectVORowImpl row = null;
int fetchedRowCount = vo.getFetchedRowCount();

RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");


if (fetchedRowCount > 0)
{
deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++)
{
row = (Xxcustomer_Rebate_projectVORowImpl)deleteIter.getRowAtRangeIndex(i);
Number primaryKey = row.getHeaderId();
if (primaryKey.compareTo(programToDelete) == 0)
{

row.remove();
getTransaction().commit();
break;
}
}
}
deleteIter.closeRowSetIterator();
}
Step-22

Create Message in Apps to Handle Exceptions in OAF


Login into Oracle Applications

Responsibility: Application Developer


Navigation: ApplicationMessage
Name: XX_CUSTOMER_WARNING
Language: US
Application: iSupplier Portal
Current Message Text: Are you sure want to delete the Selected Item (save)
After creating the Message we have Run Standard Concurrent Program
Concurrent Program: Generate Message
Step-23
Write Code In XxcustomerSearchCOto Delete Continuous
Import this packages
import oracle.apps.fnd.framework.webui.OADialogPage;
import java.io.Serializable;
import java.util.Hashtable;
In Process Form Request
if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
{
String HeaderId1= pageContext.getParameter("pdelete");
OAException mainMessage = new
OAException("pos","XX_CUSTOMER_WARNING");
OADialogPage dialogPage = new OADialogPage(OAException.WARNING,
mainMessage,
null, "", "");
String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
dialogPage.setOkButtonItemName("DeleteYesButton");

dialogPage.setOkButtonToPost(true);
dialogPage.setNoButtonToPost(true);
dialogPage.setPostToCallingPage(true);
dialogPage.setOkButtonLabel(yes);
dialogPage.setNoButtonLabel(no);
Hashtable formParams = new Hashtable();
formParams.put("HeaderId",HeaderId1); // vo atrribute , variable
dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);
}
else if (pageContext.getParameter("DeleteYesButton") != null)
{
String HeaderId= pageContext.getParameter("HeaderId");
Serializable[] parameters = { HeaderId};
am.invokeMethod("deleteHederslines", parameters);
OAException message = new
OAException("pos","XX_DELETE_CONFORMATIONS",
null,OAException.CONFIRMATION,
null);
pageContext.putDialogMessage(message);
}
}
Deployment from OAF to Oracle Apps
1) Move all Class files to Java-Top
Source Path : E:\OAF\jdevhome\jdev\myclasses
Dispatch Path : E:\oracle\viscomn\java
(In Real Time $ Appl-Top & $ Java-Top)
2) Run the xml import Script in Javabin
In Dos Prompt E:\OAF\jdevbin\jdev\bin (past here below path)
import
D:\p4141787_11i_GENERIC\jdevhome\jdev\myprojects\xxpa\oracle\apps\po\consum
errebate\webui\ConsumerRebatePG.xml -rootdir
D:\p4141787_11i_GENERIC\jdevhome\jdev\myprojects -username apps -password
apps -dbconnection
"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)

(HOST=apps.ora.com)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=VIS)))"
(Run same the import script for create page & update page)
3) Navigate to Oracle Apps In Application Developer Responsibility
a. Create Function (Nav:ApplicationFunction)
In Description Tab
Function: xxxxxxxxxxxxxxx
UserFunctionName:xxxxxxxxxxxxxxx
In Properties Tab
Type: SSWA servlet function
In web HTML
HTML call:URL of the Search Page (Save & Close)
b. Create Menu Attach Function to Menu
(Place the Menu in Respective Responisibility
Ex: PO:Menu: Purchasing SuperUser GUI)
Open Menu In Query Mode Paste the (Res:Menu) where User Name menu
c. Bounch the Apche Server ( first close all Applictions)
Open the Services Rt click on Apche server---Restart

EO & AM & VO & CO & Regions and items


BC4J Package Structures
BC4J Package Structures
1.

Entity Object

Syntax: <thirdparty>.oracle.apps.applshortname.componentname.<subcomp>.schema.server
Ex: xyz.oracle.apps.xxcust.empmgmt.schema.server
2. View Object & Application Module
Syntax: <thirdparty>.oracle.apps.applshortname.componentname.<subcomp>.erver
Ex: xyz.oracle.apps.xxcust.empmgmt.server
3.

page & Controller

Syntax: <thirdparty>.oracle.apps.applshortname.componentname.<subcomp>.webui

Ex: xyz.oracle.apps.xxcust.empmgmt.webui
4.

LOV VO & LOVAM

Syntax: <thirdparty>.oracle.apps.applshortname.componentname.<subcomp>.lov.server
Ex: xyz.oracle.apps.xxcust.empmgmt.lov.server
5.

Lov Regions

Syntax: <thirdparty>.oracle.apps.applshortname.componentname.<subcomp>.lov.webui
Ex: xyz.oracle.apps.xxcust.empmgmt.lov.webui

6.

Pick List VO

Syntax: <thirdparty>.oracle.apps.applshortname.componentname.<subcomp>.picklist.server
Ex: xyz.oracle.apps.xxcust.empmgmt. picklist.server

Create Page in OA Framework


Create page Steps:
1)
2)

Create the page as the normal way like create jws, jpr, bc4js, AM, page etc. .
EO should be mandatory to develop the create the page.

3)
4)

Create the EO which table you want to insert the records through page.
Create the BC4J for EO and develop the EO.

Ex: xxaam.oracle.apps.po.autosearch.schema.server and xxxEO.


5)
Then create VO based on EO. Create new VO under particular(VO) BC4J, there you can
6)

Shuffle the EO (which you created in 2nd step) into selected side
Add above VO into AM.

7)
Then design the page for appropriate records insert into table and create two buttons for
pressing in page.
8)

Then select AMimpl class file to develop the logic below.

public void CreateDept()


{
DepartmentCreationVOImpl vo= getDepartmentCreationVO1();
OADBTransaction Tr=getOADBTransaction();
if(!vo.isPreparedForExecution())

{
vo.executeQuery();
}
Row row1=vo.createRow();
vo.insertRow(row1);
row1.setNewRowState(Row.STATUS_INITIALIZED);
Number deptid=Tr.getSequenceValue("DEPT_DEPT_ID_SEQ");
//

vo.getCurrentRow().setAttribute("DeptId",deptid);
vo.getCurrentRow().setAttribute("DeptId",deptid);

}
9)

Create Controller under pageLayouot region to handle the go button events and call the logic

from AM. Follow logic below.


Process Request :
DeptAMImpl am=(DeptAMImpl)pageContext.getApplicationModule(webBean);
am.invokeMethod("CreateDept");
Process Form request:
If (pageContext.getParameter("Save")!=null)
{
am.getOADBTransaction().commit();
}

************************************************************************************
************************
Application Module & its types
Application Module :it is the interface between database transactions and UI transactions .
All the application model objects end with AM ex- Employee AM.
Types of application Modules: 1)root application module 2) Nested application module
1)root application module:attaching AM to the root region we call as root AM ,where root region is the
page layout region.
2)Nested application module:Attaching AM to the nested region we call as the nested application

module where nested region are like child regions.


**If we declare vo at Root AM we can use it any where , but if we declare VO at region level we can use
only for the particular region**

Controller Methods:
Controller Methods:
1) Process request(http get) 2) process form request (http post)3) process form data(http post )
1) Process request(http get):a) while loading the page to display default items we will use process
request b) this phase is invoked upon browser http get.
2) process form request (http post): a)After Loading the page performs any actions will use process
form request b)this phase is invoked upon browser http post .
3) Process form data: if exceptions are thrown during this phase process requests or process form
request phases are skipped & the page is re displayed ( error page).

View links
View links :
1) relationship between 2 VOs
2) All View links end with VL ex- Dept Emp VL
*If we want to perform DML operation on master detail data then we need to have entity Association
*if we need to just display master detail data on the page then go for view links.

Types of View Objects


Types of View Objects:
1) Automatic VO-when DML operations required
2) Manual VO-just to view no EO required
3) Property VO no need of DB attributes ex- for displaying some of attributes ( with out DB table

transient attributes )
4) Validation VO- Validates the data entered and throws a message.

View Objects and View Links:


View Objects and View Links:
View object accesses the result set of sql statement either it can be based on EO or a plain sql query
.all the view objects end with VO ex- Employee VO
2) when you create VO one subclass will generate
*oracke.apps.fnd.framework.server.OA.viewobjectImpl.*

Entity Assosiates :
Entity Assosiates :
(Association objects AO) :
1)Establish the relationship between 2 EOs ex: Dept EO , Emp EO Dept no common column shud be
there. All the association objects end with [AO] ex- Dept Emp AO

Types of EO:
Types of EO:
1) Java Based EO to perform DML operations on custom tables
2) PL/SQL based EO-to perform DML operations on seeded tables

Entity Object
Entity Object
EO is like table in the middle tier . we cannot use table directly in OF so we create EO.
2)if we need DML operation then go for EO
3) EO represent DB row in the middle tier
4) EO based on tables, synonyms, views and snapshots ex- employee EO
5) when you create the EO one subclass is going to generate
Path:oracleapps.fnd.framework.server.OAentityimpl
6) when you create an EO framework will provide a java class with setter and getter methods
corresponding to each column of the table which your EO is based on.

Automatic Search Page:

Automatic Search Page:


Automatic Search Page Steps:
1)
2)

Create the page as the normal way like create jws, jpr, bc4js, AM, page etc. .
Right click of the .jpr, Create the bc4j for VO.

EX: xxaam.oracle.apps.po.autosearch.server
3)
Create VO under BC4J, and attach VO to the AM.
Ex:AutosearchVO -> add this into AM.
4)
Select the page, Under page Layout RN,create one Region, region style as Query.
5)
Then select query region -> right click -> Region using wizard ->dialogbox -> you can select your
VO which you created in 3rd step.
6)
Click next to continue -> there you can select region style is table region, because we are going to
display results in table region.
7)
8)

Click next to continue ->Shuttle the items which you want to display in page and table region.
Then right click query Region-> select simple search panel & simple search query region

9)
In simple search panel create what ever you want to create the items means message text
inputs, it will display in top of the Automatic search PG.
10) In simple search mappings -> you have create mappings. Map all the fields to query columns to
created message text inputs in simple search panel.
11) Then run the automatic search PG.

Regions and items


Regions and items:- Region is a portion of a page and it can hold multiple items (region is mandatory).
Types of regions :1)
Message component layout : its exclusively has a property of rows and columns so that we can
place items in matrix form. And it dont have n option of text (name or header).
2)
Header region:its exclusively meant of placing heading in this text option will be there and no
option of rows and column..as this region only used for header.
3)
Row layout region:this is used for alignment of the items where we can place items
accordingly.

4)
Default double column : this is same as message component layout where it will display two
columns by default ( we have an option of text and no option for row and columns )
5)
Default single column :this is also same as message component layout where it will display
single column by default (( we have an option of text and no option for row and columns)
6)
Page button bar: this is meant for keeping buttons..(buttons will be present 2 times one at top
and one at bottom )

How to change/add the logo in the OF page:


How to change the logo of oracle in the OF page:
Keep the image which you want to display as logo in patch/oraclehome/myhtml/oamedia/images
folder as GIF file.
Now after creation of region-go to region properties corporate branding image url-give the name of
the GIF file which you want to display as logo. And execute run & rebuild and the new logo appears ..
How to insert image below page name: Region-New-create item properties item style is the image
and in image uri give the name of the gif . then execute .

types of parameters in the controller


Types of parameters in the controller :
1) OA Page context & OA Webbean 1)Usage of OA Page context: To get & Set values of the fields
2)OA Webbean: Structure of the items in the OF page ex: set required, set rendered, width, height :

Configure jdev in oracle apps Environment & pick


list or poplist
Configure jdev in oracle apps Environment
Configure jdev in oracle apps Environment 1)Identify the oracle apps version suitable , go to any OAF
page ->about the page ->technology components **if about the page is not there then set the profile

option called fnd_diagnostics to yes (sys admin-sys profile-query profile fnd:Dia%- set yes) . Download
the patch from oracle meta link by giving the OAF version . After downloading unzip the patch : it
contains 3 folders 1)Jdev bin: contains all the import,export files and jdev tool.2)Jdev doc:contains all
the documentation OAF , Index.3) Jdev Home : Will contain all the project files (/Jdev/myprojects.

2)Set the Environment variables for windows : My computer Right click system properties-advancedEnvironenment variables-new-variable_name JDEV_USER_HOME variable value :jdevhome/dev
3)Copy the dbc file from fnd top: from D:/Oracle/visappl/fnd/11.5.0/secure/vis_apps to
D:\p123423_11i_generic\jdevhome\jdev\dbc_files\secure ** DBC files contains TNS names and its used
for connecting to the data base.
4) make the shortcut jdev in desktop jdevw.exe where w indicates windows os (copy & pasteto
desktop).
5) create the data base connection 1)Open Jdev expand connections DB-New connection connection
name Dev-connction type oracle JDBC NEXT username: apps PWD: apps }like toad Open DBC file
DBA_HOST=>HOST_name :apps.ora.com JDBC_PORT=>DB_PORT:1521 SID=>DB_name =>VIS then next
test connection success ..similarly you can create new DB connections to other instances .
6)Set the default project properties :Project-default project settings ,click on OA path-evvironment
variables path ,DB connction DEV-select Run options select oa_diagnostics then Run time connection
dbc_file name browse jdev/home/jdev/dbc_files/secure/vis.dbc. user name-operations pwd-welcome
responsibility one reference responsibility is given which should contain OAF page APP short name PO
responsibility PURCHAISNG_OPERATIONS () this resp shud be ter for users)

Creation of dependent pick list or poplist

Creation fo dependent pick list or poplist

D:\oracle\visappl\fnd\11.5.0\secure\myprojects

]
Creation of BC4J

Creation of AM

Next next

Finish it

Save it and create page

Rebuild page

Run it

Creation of vo

Write query

Create another vo for polines

select po_header_id,
po_line_id,
line_num
from po_lines_all

Creation of pick list by using items

dependenPick.oracle.apps.po.mgmt.picklist.server.poheadersVO

dependenPick.oracle.apps.po.mgmt.picklist.server.polinesVO

Creation of new controller

Attach vo to am only polinevo

Go to controller.java and write the following code


import

dependenPick.oracle.apps.po.mgmt.picklist.server.dependentpickAMImpl;
public void processFormRequest(OAPageContext pageContext, OAWebBean
webBean)
{
super.processFormRequest(pageContext, webBean);
dependentpickAMImpl obj=(dependentpickAMImpl)
pageContext.getApplicationModule(webBean);
if("POLineidevent".equals(pageContext.getParameter(EVENT_PARAM)))
{
System.out.println("SAmple");
String pohid=pageContext.getParameter("poheader");

System.out.println("poheaderid"+pohid);
obj.XXHndleLines(pohid);
}
}
And writge the code in the AM class file
public void XXHndleLines(String pohid)
{
polinesVOImpl vos=getpolinesVO();
vos.setWhereClause("po_header_id='"+pohid+"'");
vos.executeQuery();
}
Change the some properties for dependent lov where when 1 val changes then
automatically changes the 2 value
st

nd

In poheaders item the following properties are final modifications

Similarly in the polines also

Save it and run the page

Here we can create some defaultdouble region and develop the items below

Creation of items like poheader and poline under region of defaultdouble column

Creation of Search page & Dependent LOV


Creation of Search (query ) page with screenshots

querySearch.jws
D:\oracle\visappl\fnd\11.5.0\secure\myprojects

querySear.jpr
querySearch.oracle.apps.po.webui

Querysearch
Username: apps

Password: apps

Vis

USERNAME: operations
PASWORD:WELCOME
RES:PO
SHORTKEY: PURCHASING_OPERATION

Creation of BC4J component:

querySearch.oracle.apps.po.server

Select the connection name

Click on log on

Creation of AM

querySearchAM
querySearch.oracle.apps.po.server

The overall node like


Creation of VO

querySearchVO
querySearch.oracle.apps.po.server

select EMPLOYEE_ID,
FULL_NAME,
EMAIL_ADDRESS,
POSITION_CODE,
START_DATE,
END_DATE
from
fwk_tbx_employees

Attaching vo to AM

Double click

Select and rename it

We4 see that if the vo is attach to it or not in the


AMIMPL

Cretion of page

Select page
querySearchpage
querySearch.oracle.apps.po.webui
we see the page

Go to page

Set AM definition

Click on ok
Set the other properties
Window: Search Page
Title: Search Page

Creation of another region

Id: query

Style: query

And

Creation of search using wizard

Select refion using wizard

Select the AM and the vo file

Select the table

Here I leaveone as messagetext input only

By changing another way alos

We see the node like

Select the end one

Change the properties


As message styletext
Specify the property as seach allowe is true any of hte column

Save it and run the page as like below

Rebuild it and run it


If u get the error then change the databse name in the connection

For the above we do the switcher regions

************************************************************************************
************************************
************************************************************************************
***************************************
************************************************************************************
**********************************
Dependent LOV

CREATION OFBC4J COMPONENT

Creation of AM

Save it and

Creation of Page

Set the AM defination

Run the page

Creation of VO

Create another VO for Supplier site

Set the vo to am

Creation of external regions for loves

For both supplier name and supplier site also

Save it and create another region for supplier site

GO TO PAGE CREATE ITEM FOR LOVS

Set supplier item properties

as

Create new region for defaultdoubled region style

Create new itrem, for suppliersite

Set the properties of lovmapping

Creation of item for form value

Creation of new lovmapping for formvalue

Creation of lovmapping for to handle the return item

Save it and run it

Oracle Application Frame Work


Update Page & Delete Page in OA Framework:
Update Page in OA Framework:
Update Page Steps:

1)
2)

Create the page as the normal way like create jws, jpr, bc4js, AM, page etc. .
EO should be mandatory to develop the update page.

3)
4)

Create the EO which table you want to update the records through page.
Create the BC4J for EO and develop the EO.

Ex: xxaam.oracle.apps.po.autosearch.schema.server and xxxEO.


5)
Then create VO based on EO. Create a new VO under particular(VO) BC4J, there you can Shuffle
the EO (which you created in 2nd step) into selected side
6)
Add above VO into AM.
7)
8)

Select the search page, there select table region and create one item and style as image.
In the image properties a) image uri as updateicon_enabled.gif b)Action Type as fire action. In the

parameter window -> id = pdeptid value -> ${oa.SearchVO1.DeptId}.


9)
Create the update page with appropriate records. And Buttons.

10) Create Controller under pageLayouot region to handle the go button events and call the logic from
AM. Follow logic below.

Process request:
if(pageContext.getParameter("pdeptid")!=null)
{
String deptid=pageContext.getParameter("pdeptid").toString();
String whereclause="DEPT_ID='"+deptid+"'";
am.getCreateVO1().setWhereClauseParams(null);
am.getCreateVO1().setWhereClause(whereclause);
am.getCreateVO1().executeQuery();
}
Process Form request:

If (pageContext.getParameter("Save")!=null)
{
am.getOADBTransaction().commit();
}

Create the table and synonym example:


Create table modpos.DEPARTMENT(DEPT_ID number PRIMARY KEY,
DEPTNO VARCHAR2(50),
DEPTNAME VARCHAR2(100),
LOCATION VARCHAR2(100),
CREATED_BY NUMBER,
CREATION_DATE Date,
LAST_UPDATED_BY NUMBER,
LAST_UPDATE_DATE Date,
LAST_UPDATE_LOGIN NUMBER)
CREATE SYNONYM DEPARTMENT FOR modpos.DEPARTMENT

Create the Sequene with example:


create sequence DEPT_DEPT_ID_SEQ

Start with 1 increment by 1


Grant all on DEPT_DEPT_ID_SEQ to apps
create sequence DEPT_DEPT_ID_SEQ
Start with 4 increment by 1 cus
Grant all on DEPT_DEPT_ID_SEQ to apps cus

Create synonym DEPT_DEPT_ID_SEQ for cus.DEPT_DEPT_ID_SEQ apps

Call one OAF page from another OAF page Syntax:


if (pageContext.getParameter("Create")!=null)
{
pageContext.setForwardURL("OA.jsp?
page=rajesh/oracle/apps/po/dept/webui/DepartmentCreationPage",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
false, // Retain AM
OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrums
OAWebBeanConstants.IGNORE_MESSAGES);
}

Follow Bc4j for each object:


AM AND VO -> BC4J
XXAAM.oracle.apps.po.xxname.server
Entity Object(EO) -> BC4J
XXAAM.oracle.apps.po.xxname.schema.server
LOV ->BC4J
XXAAM.oracle.apps.po.xxname.LOV.server
Poplist ->BC4J
XXAAM.oracle.apps.po.xxname.poplist.server
Controller,Page & Region
XXAAM.oracle.apps.po.xxname.webui

Delete page steps

1)
2)

For delete no need to create any pages.


Select search page , in table region you create one item and style as image. Below set of

properties needs to set for this image.


Image Uri - deleteicon_enabled.gif
Action Type fireAction
Event

- Any Name (delete)

Parameter window:SPEL
Name DeptId
Value - ${oa.SearchVO1.DeptId}
3)

write the delete login AM, start with creating method ->

public void deletedepartment(String departmentid)


{
// First, we need to find the selected Program in our VO.
// When we find it, we call remove( ) on the row which in turn
// calls remove on the associated ModposVendorProgsImpl object.
int deptidtodelete=Integer.parseInt(departmentid);
SearchVOImpl vo=getSearchVO1();
SearchVORowImpl row=null;
// This tells us the number of rows that have been fetched in the
// row set, and will not pull additional rows in like some of the
// other "get count" methods.
int fetchedrowcount =vo.getFetchedRowCount();
System.out.println("Fetched Row Count is"+fetchedrowcount);
// We use a separate iterator -- even though we could step through the
// rows without it -- because we don't want to affect row currency.
RowSetIterator deleteiter=vo.createRowSetIterator("deleteiter");
if (fetchedrowcount >0)
{
deleteiter.setRangeStart(0);
deleteiter.setRangeSize(fetchedrowcount);
for (int i=0;i<fetchedrowcount;i++)

{
row=(SearchVORowImpl)deleteiter.getRowAtRangeIndex(i);
// For performance reasons, we generate ViewRowImpls for all
// View Objects. When we need to obtain an attribute value,
// we use the named accessors instead of a generic String lookup.
Number deptid=row.getDeptId();
if(deptid.compareTo(deptidtodelete)==0)
{
// This performs the actual delete.
row.remove();
getOADBTransaction().commit();
break;
}
}
}
deleteiter.closeRowSetIterator();
}
4)
Call that delete even tin Controller like below. Below logic having how to create OADialog box
in OA Framework.
if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
{
// The user has clicked a "Delete" icon so we want to display a "Warning"
// dialog asking if she really wants to delete the employee. Note that we
// configure the dialog so that pressing the "Yes" button submits to
// this page so we can handle the action in this processFormRequest( ) method.
String DeptId = pageContext.getParameter("DeptId");
OAException mainMessage = new OAException("POS","xxx");
// Note that even though we're going to make our Yes/No buttons submit a
// form, we still need some non-null value in the constructor's Yes/No
// URL parameters for the buttons to render, so we just pass empty
// Strings for this.
OADialogPage dialogPage = new OADialogPage(OAException.WARNING,
mainMessage, null, "", "");
// Always use Message Dictionary for any Strings you want to display.
String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
// We set this value so the code that handles this button press is

// descriptive.
dialogPage.setOkButtonItemName("DeleteYesButton");
// The following configures the Yes/No buttons to be submit buttons,
// and makes sure that we handle the form submit in the originating
// page (the "Employee" summary) so we can handle the "Yes"
// button selection in this controller.
dialogPage.setOkButtonToPost(true);
dialogPage.setNoButtonToPost(true);
dialogPage.setPostToCallingPage(true);
// Now set our Yes/No labels instead of the default OK/Cancel.
dialogPage.setOkButtonLabel(yes);
dialogPage.setNoButtonLabel(no);
// The OADialogPage gives us a convenient means
// of doing this. Note that the use of the Hashtable is
// most appropriate for passing multiple parameters. See the OADialogPage
// javadoc for an alternative when dealing with a single parameter.
Hashtable formParams = new Hashtable();
formParams.put("DeptId", DeptId);
dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);
}
else if (pageContext.getParameter("DeleteYesButton") != null)
{
// User has confirmed that she wants to delete this employee.
// Invoke a method on the AM to set the current row in the VO and
// call remove() on this row.
String DeptId = pageContext.getParameter("DeptId");
Serializable[] parameters = { DeptId };
// OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("deletedepartment", parameters);
// Now, redisplay the page with a confirmation message at the top. Note
// that the deleteComponent() method in the AM commits, and our code
// won't get this far if any exceptions are thrown.

OAException message = new OAException("POS","xxxxxxxx",


null,OAException.CONFIRMATION,null);
pageContext.putDialogMessage(message);
}
}

Emp advance table row


public void createemp()
{
EmployeeCreationVOImpl vo= getEmployeeCreationVO1();
DepartmentCreationVOImpl vo1= getDepartmentCreationVO1();
OADBTransaction tr=getOADBTransaction();
vo.setMaxFetchSize(0);
Row row1=vo.createRow();
vo.insertRow(row1);
row1.setNewRowState(Row.STATUS_INITIALIZED);
Number empid=tr.getSequenceValue("EMPLOEE_EMP_ID_SEQ");
vo.getCurrentRow().setAttribute("EmployeeId",empid);
String departmentid=vo1.getCurrentRow().getAttribute("DeptId").toString();
vo.getCurrentRow().setAttribute("DeptId",departmentid);
}
if (ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
{
am.invokeMethod("createemp");
}

Validations
SEACH PAGE VALIDATION (Display the Value after Entering value in Search Criteria)

Public int /**This is Search page Validation*/ ConsumerSearch (OAPageContext pc,OAWebBean wb)
{
int flag = 0; //For search page Validation
String pna=null;
String div=null;
String ctno=null;
XXconsumer_DiscountVOImpl vo=getXXconsumer_DiscountVO1();
if(pc.getParameter("PartyName")!=null && ! pc.getParameter("PartyName").equals(""))
{
pna=pc.getParameter("PartyName").toString();
vo.setWhereClauseParam(0,pna);
flag =1; //For search page Validation
}
else
{
vo.setWhereClauseParam(0,null);
}
if(pc.getParameter("Division")!=null && ! pc.getParameter("Division").equals(""))
{
div=pc.getParameter("Division").toString();
vo.setWhereClauseParam(1,div);
flag=2;//For search page Validation
}
else
{
vo.setWhereClauseParam(1,null);
}
if(pc.getParameter("ContractNumber")!=null && ! pc.getParameter
("ContractNumber").equals(""))
{
ctno=pc.getParameter("ContractNumber").toString();
vo.setWhereClauseParam(2,ctno);
flag=3;//For search page Validation
}
else
{
vo.setWhereClauseParam(2,null);
}
return flag;//For search page Validation
}

IN Search CO (ProcessFormRequest) Write the code after B/T Go


& Commit
if(pageContext.getParameter("Go")!=null)
{
int flag=am.ConsumerSearch(pageContext,webBean);
if(flag==0)
{
am.getXXconsumer_DiscountVO1().setWhereClauseParam(0,"asdf");
am.getXXconsumer_DiscountVO1().setWhereClauseParam(1,"lkjh");
am.getXXconsumer_DiscountVO1().setWhereClauseParam(1,"qwer");
throw new OAException("plz entry any value in search criteria",OAException.ERROR);
}
else
{
}

am.getXXconsumer_DiscountVO1().executeQuery();
}

COMPARE TWO DAYS (Validation on Start Date & End Date)


In Create CO (ProcessFormRequest) Write the code b/t the save and
commit
import.java.util.Date;
String startdate=pageContext.getParameter("ContractStartDate");
String enddate=pageContext.getParameter("ContractEndDate");
if((null!=startdate)&&(null!=enddate))
{
Date sdate=new Date(startdate);
Date edate=new Date(enddate);
if(edate.getTime()<sdate.getTime())
{
throw new OAException("end date should be greaterthan stard date",OAException.ERROR);
}
}

COMPARE TWO NUMBER(Validation on Levels to Greater than one as


another)
In Create CO (ProcessFormRequest)
Write the code b/t save and
commit

import.oracle.jbo.domain.Number;
String slevel1=pageContext.getParameter("Level1From");
String slevel2=pageContext.getParameter("Level1To");
Number nlevel1=null;
Number nlevel2=null;
try
{
nlevel1 = new Number (slevel1);
nlevel2 = new Number (slevel2);
}
catch (Exception e)
{
e.printStackTrace();
}
if((null!=slevel1)&&(null!=slevel2))
{
if(nlevel1.intValue() > nlevel2.intValue())
{
throw new OAException("level2 is greater than level1",OAException.ERROR);
}
}

DISPLAY CAPTER LETERS ON FIELD (validation on BillToLocation)


In Create CO (ProcessRequest)
import oracle.cabo.style.CSSStyle;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
CSSStyle css=new CSSStyle();
css.setProperty("text-transform","uppercase");
OAMessageLovInputBean
mti=(OAMessageLovInputBean)webBean.
findChildRecursive("BillToLocation");
if(mti!=null)
{
mti.setInlineStyle(css);
}

CHANGE THE COLORS OF THE LETTERS(Validation on


BillToLocation)
In Create CO (ProcessRequest)

import oracle.cabo.style.CSSStyle;
CSSStyle css=new CSSStyle();
css.setProperty("color","#ff0000");// THIS FOR COLORS OF THE FIED
OAMessageLovInputBean mti=(OAMessageLovInputBean)webBean.
findChildRecursive("BillToLocation");
if(mti!=null)
{
mti.setInlineStyle(css);
}

SPECIAL CHARACTERS ARE NOT ALLOWED ON A FIELD (validation


On PartyName)
In Create CO (ProcessFormRequest) Write the code b/t save and
commit
String cname=pageContext.getParameter("PartyName");
Pattern p=Pattern.compile("[^a-zA-Z0-9\\s]");
Matcher m=p.matcher(cname);
if(m.find())
{
throw new OAException("Special Characters are not allowed",OAException.ERROR);
}

FRIEGHT DEDUCTION FIELD SHOULD NOT ALLOW MORE THAN 100


(Validation on Freight Deduction)
In Create PG
In Properties

Select Freight Deduction item


Action Type: FirepartialAction

event: firepartial (here we can give any name)


In Create CO (ProcessFormRequest)
if("firepartial".equals(pageContext.getParameter(EVENT_PARAM)))
{
String fright=pageContext.getParameter("FreightDeduct");
Number frighting=null;
try
{
frighting=new Number(fright);
}
catch (Exception e)
{
e.printStackTrace();
}

if((null!=fright))//&&(null!=fright))
{
if((frighting.intValue()<=0)||(frighting.intValue()>=100))
// if((frighting.intValue()<0)||(frighting.intValue()>100))
{
throw new OAException("frieght deduction should not allow more then 100",
OAException.ERROR);
}
}
DEPENDENT LOV (Validation on PartyName & BillToLocation) CREATE 2 VO'S & VO's to AM
1.CUSTOMERVO (QUERY)
SELECT
hp.party_name,
hp.party_id,
hp.party_number
FROM
hz_parties hp
WHERE
EXISTS (SELECT HCAS.CUST_ACCOUNT_ID,HCAS.PARTY_SITE_ID, HPS.PARTY_ID
FROM hz_cust_acct_sites_all HCAS, HZ_PARTY_SITES HPS
WHERE HPS.PARTY_SITE_ID = HCAS.PARTY_SITE_ID AND
HP.PARTY_ID = HPS.PARTY_ID AND
HP.STATUS <> 'M')
ORDER BY HP.PARTY_NAME
2. LOCATIONVO (QUERY)
SELECT
hzsu.site_use_id,
hzl.address1||DECODE(hzl.address2,NULL,NULL,','||hzl.address2)||
','||hzl.city||','||hzl.country||','||hzl.postal_code LOCATION,
hp.party_id
FROM
hz_parties hp,
hz_cust_accounts hza,
hz_cust_acct_sites_all hzas,
hz_cust_site_uses_all hzsu,
hz_party_sites hzps,
hz_locations hzl
WHERE
hza.party_id = hp.party_id
AND hzas.cust_account_id = hza.cust_account_id
AND hzps.party_site_id = hzas.party_site_id

AND hzl.location_id = hzps.location_id


AND hzsu.site_use_code = 'BILL_TO'
AND hzsu.cust_acct_site_id = hzas.cust_acct_site_id
AND hzsu.org_id = hzas.org_id
Create one item under DefaultDebouleRegion
Item Style: Form Value
ID& Prompt: Linkid
Create one more Mapping under PartyName
In Properties: LOV Region Item: PartyId
Return Item: Linkid
Create one more Mapping under BillToLocation
In Properties: LOV Region Item: PartyId
Criteria item: Linkid

DEPENDENT POPLIST
Create 2 VO's Under POP List..Server & Attach VO's To AM
1. DNameVO: SELECT DNAME FROM SCOTT.DEPT
2. ENameVO: SELECT ENAME, DNAME FROM SCOTT.EMP E, SCOTT.DEPT D WHERE
E.DEPTNO=D.DEPTNO
In Search PG Create Item under MessageComponetLayout
Item Style: Message Choice
Id & Prompt: DName
In Properties: PickListviewinstance: DNameVo
PickdisplayAttribute: DName
PicklistvalueAttribute: DName
Add Block Value : False ( if use this values will enable in field)
Action Type: FirePartialAction
Event: DName
Create one more Item Style: MessageChoice

Id & Prompt: EName

In Properties: PickListviewinstance: ENameVo


PickdisplayAttribute: EName
PicklistvalueAttribute: EName
Add Block Value : False ( if use this values will enable in field)
Go to AMIpmL.java
public void initquary (String dname)
{
EnameVOImpl vo=getEnameVO1();
vo.setWhereClause("DNAME=:1");
vo.setWhereClauseParams(null);
vo.setWhereClauseParam(0,dname);
vo.executeQuery();
}
In Search CO (ProcessFormRequest)
import java.io.Serializable;
if("Dname".equals(pageContext.getParameter(EVENT_PARAM)))

{
String dname=pageContext.getParameter("Dname");
if(!(("".equals(dname))&&(dname==null)))
{
Serializable[] param={dname};
am.invokeMethod("initquary",param);

DISPLAY CURRENCY VALUE/FORMAT (Validation on Advertising Rebate)


In Search VO we have to ADD 1 Column -Advertising Rebate
In Search PG Create Item under Table Region
Item Id &Prompt:
Advertising Rebate
Style: message Styled Text input
In Properties: View Instance: SearchVo
View Attribute: AdvertisingRebate
In Search CO (ProcessRequest)
import oracle.apps.fnd.framework.webui.beans.table.OATableBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
OATableBean tb=(OATableBean)webBean.findChildRecursive("region4");
OAMessageStyledTextBean mst=(OAMessageStyledTextBean)webBean.
findChildRecursive("ADVERTISING_REBATE");
if(mst!=null)
{
mst.setCurrencyCode("USD");
}
EXPORTING DATE TO EXCELL SHEET
In Search PG
Create Item under RowLoyoutRegion
Item Id & Prompt: Export
Style: export Button
In properties: View Instance: SearchVO

MESSAGE FILE UPLOADBEAN (Validation on Attachment Column)


IN Create PG
Attachment Data Type: Make sure=BLOB
if want display the file Name on the field write below code
InprocessRequest
import oracle.apps.fnd.framework.webui.beans.message.OAMessageFileUploadBean;
import oracle.apps.fnd.framework.webui.OADataBoundValueViewObject;

OAMessageFileUploadBean upload=(OAMessageFileUploadBean)webBean.
findChildRecursive("ContractAttachment");
OADataBoundValueViewObject displaybound=new OADataBoundValueViewObject
(upload,"FileName");
upload.setAttributeValue(DOWNLOAD_FILE_NAME,displaybound);

SPEL IN OA Framework Persolizations


SPEL IN OA Framework Persolizations
In personalizations, We have two ways to change properties like Rendered or Read Only or Required.
1. First is we hardcode a value of True/False during personalization.
2. Second is we can use a SPEL syntax to these properties via personalization. SPEL is nothing but an
expression that returns TRUE or FALSE.
In this post , I going to use SPEL feature. I have a requirement there is a responsibility named "OA
Framework Tollbax Tutorial Labs".In the responsibility there is Page "Create Employee".In Employee
page there is feild "Hire Date".So I want to enable this feild only for a Specific user.So how i can do
this. I am going to do this by "SPEL" function.
The User is "OAF_USER" As Given Below.

Step 1: Create Function


Go to responsibility "Functional Administrator".
Click under "Core Services" Tab.Under this select Function.

Create function "XX_HIRE_DATE_REAF_ONLY"


This function will be of Type JSP
Name = XX Hire Date Read Only
Code= XX_HIRE_DATE_REAF_ONLY

Type=SSWA jsp Function


HTML Call= OA.jsp?page=/dummy

Function has created as be,ow.

Step 2: In Menu screen, Create Permission Set named XX Employee Date Read Only
Menu = XX_EMPOYEE_HIRE_DATE_READ
User Menu Name = XX Employee Date Read Only
Menu Type = Permission Set
Add Function XX Hire Date Read Only to this, and ensure that Global Grant is removed by unchecking
checkbox Grant.

Step3Grant this permission set XX_EMPOYEE_HIRE_DATE_READ to "OAF_USER" User Name


Navigate to Functional Administrator
Click on Security Tab, and click on Grants, and then Create Grant
Name=XX_EMPLOYEE_HIRE_DATE_READ_GRANT
Grantee Type = Specific User
Grantee = OAF_USER
Click on Next, and in Set field, attach the permission set XX Employee Date Read Only.

Click on Grantee Lov and then Select "OAF_USER".

Click on Next, and in Set field, attach the permission set XX Employee Date Read Only

Click Next and Finish.


Step 4Now personalize and set the Read Only Property to SPEL with value of SPEL being
${oa.FunctionSecurity.XX_HIRE_DATE_REAF_ONLY}
Navigate to responsibility "OA Framework Toollbox Tutorial Labs"
Click on Create Employee Page
Click on personalize page on top right corner
And personalize Hire Date

In the read only property, at site level, select SPEL and enter $
{oa.FunctionSecurity.XX_HIRE_DATE_REAF_ONLY}

Click Apply.And then again open the Page to see the changes below.

Now Login again with user name "OAF_USER".


And then again go to the page "Create Employee Page". and see we have given the permission to this
user so Hire Date will be enable for this User.

***************************************************************
*************************************************************
oaf interview questions

oaf interview questions


OAF interview questions and answers

Q) What is BC4J ?
A )Business Components for Java is JDeveloper's programming framework for building multitier
database applications from reusable business components
Q) What are the methods in controller?
A) 3 types methods they are
1. ProcessRequest,
2.processFormRequest
3. processFormData
Q) When is the processRequest method called?
A) processRequest method is called when the page is getting rendered onto the screen and a region is
displayed.
Q) When is processFormRequest method called?
A) ProcessFormReques(PFR)t method is called when we perform some action on the screen like click of
submit button or click on Go or any action perform on the page the result is displayed is called PFR
Q) What are all the methods in CO?}

A)processForRequest
processRequest
Q )When a page renders which method in CO fires?
A)
processRequest
Q) Where will you write your business logic?
A)
Entity object (EO)
Q) How do you catch the button event on ProcessFormRequest Method?
A) if (pageContext.getParameter(.EVENT_PARAM). equals("update")) Here update is the event.
1.
What is an EO?
a. Map to a database table or other data source
b. Each entity object instance represents a single row
c. Contains attributes representing database columns
d. Fundamental BC4J object through which all inserts/updates/deletes interact with the database
e. Central point for business logic and validation related to a table
f. Encapsulates attribute-level and entity-level validation logic
g. Can contain custom business methods
2. What is a VO?
a. Represent a query result
b. Are used for joining, filtering, projecting, and sorting your business data
c. Can be based on any number of entity objects
d. Can also be constructed from a SQL statement

3. What are the methods in controller?


ProcessRequest and processformrequest
4. What is a Controller?
Controller is the java file and can be associated to a complete OAF page or to a specific region.
There are several tasks you will do routinely in your code.
Handle button press and other events
Automatic queries
Dynamic WHERE clauses
Commits
JSP Forwards
The logic for accomplishing all these tasks is written in controller
5. When is the processRequest method called?
PR method is called when the page is getting rendered onto the screen

6. When is processFormRequest method called?


PFR method is called when we perform some action on the screen like click of submit button or click on

lov

7. What is extension?
Extension is when you take an already existing component ex an OAF page or a region and then add
some more functionality to it without disturbing the original functionality.

8. What is personalization?
Oracle Apps Framework has an OA Personalization Framework associated with it so that you can
personalize any OAF page in an Oracle E-business Suite application without changing the basic or
underlying code of that OA Framework page, Oracle Application Framework makes it very easy to
personalize the appearance of the page or even the personalization of data displayed on to an OA
Framework page.
9. What are levels of personalization?
1. Function Level
2. Localization Level
3. Site Level
4. Organization Level
5. Responsibility Level
6. Admin-Seeded User Level
7. Portlet Level
8. User Level
2.

1) What is BC4J?

Business Components for Java is JDeveloper's programming framework for building multitier database
applications from reusable business components. These applications typically consist of:
A client-side user interface written in Java and/or HTML.
One or more business logic tier components that provide business logic and views of business objects.
Tables on the database server that store the underlying data.
2.What are all the components of BC4J?
3.
4.

Following are the components of BC4J:

Entity Object - EO encapsulates the business logic and rules. EOs are used for Inserting, Updating
and Deleting data from the database table. E0 is also used for validating the records across the
applications.
5.
View Object - View object encapsulates the database query. It is used for selecting data. It provides
iteration over a query result set. VOs are primarily based on EOs. It can be used on multiple EOs if
the UI is for update.

6.
Application Module - Application Modules serve as containers for related BC4J components. The pages
are related by participating in the same task. It also defines the logical data model and business
methods needed.
2) What is an EO?
EO encapsulates the business logic and rules.EOs are used for Inserting, Updating and Deleting data.
This is used for validating across the applications. We can also link to other EOs and create a
Association object.
3) What is an VO?
View object encapsulates the database query. It is used for selecting data. It provides iteration over a
query result set.VOs are primarily based on Eos. It can be used on multiple EOs if the UI is for
update. It provides a single point of contact for getting and setting entity object values. It can be
linked together to form View Links.
4) What is an AO?
An association object is created where we link EOs. For example take the search page where we link
the same EO to form a association between the manager and employee. Every employee should have a
manager associated. But if it President then no there is no manager associated. This is a perfect
example to understand the AO.
5) What is an VL?
A view link is an active link between view links. A view link can be created by providing the source and
destination views and source and destination attributes. There are two modes of View link operation
that can be performed. A document and Master/Detail operation.
6). What is UIX?
UIX is an extensible, J2EE-based framework for building web applications. It is based on the ModelView-Controller (MVC) design pattern, which provides the foundation for building scalable enterprise
web applications.
7). Where the VO is located in the MVC architecture?
VO is located in the View Layer in MVC which is responsible for presenting the data to the user.
9) Which package should include EO and AO.
The EO and AO will be present in the schema.server package.
10) What is the difference between inline lov and external lov.
Inline lov is a lov which is used only for that particular page for which it was created and cannot be
used by any other page.
7.
External lov is a common lov which can be used by any page. It is a common component for any page to

use it. It can be used by giving the full path of the lov in the properties section External LOV of the
item.
1) what is a Javabean?
JavaBeans is an object-oriented programming interface that lets you build re-useable applications or
program building blocks called components that can be deployed in a network on any major operating
system platform.
2) What is query Bean?
QueryBean is used to execute and return the results of a query on behalf of the QueryPortlet
application.
3) what is the difference between autocustomization criteria and result based search?
Results based search generates search items automatically based on the columns on the results table.
In Autocustomization search we need to set what all fields are required to display as a search criteria.
4) what is MDS?
MDS is MetaData Service. When a web page is broken into small units like buttons,fields etc they are
stored in a database. These are not stored as binary files but as data in tables. The data are present in
JDR tables. MDS provides service to store & return page definitions. MDS collects those definitions in
components/fields in a meaningful manner to build a page.
5) What is XML?
XML is a markup language for documents containing structured information.
Structured information contains both content (words, pictures, etc.) and some indication of what role
that content plays (for example, content in a section heading has a different meaning from content in
a footnote, which means something different than content in a figure caption or content in a database
table, etc.).
6) What is the difference between customization and extension?
Customization is under direct user control. The user explicitly selects between certain options. Using
customization a user can:
Altering the functionality of an application
Altering existing UI
Altering existing business logic
Extension is about extending the functionality of an application beyond what can be done through
personalization. Using extension we can:
Add new functional flows
Extend or override existing business logic
Create New application/module
Create New page

Create New attribute


Extend/Override defaults & validations
7) What is Personalization?
Personalization enables you to declaratively tailor the UI look-and-feel, layout or visibility of page
content to suit a business need or a user preference. Using Personalization we can:
Tailor the order in which table columns are displayed.
Tailor a query result.
Tailor the color scheme of the UI.
Folder Forms
Do Forms Personalization
8)Can you extend every possible Application Module?
Answer: No..Root AM cannot be extended.
9) What is rootAM?
The application module which is associated with the top-level page region (the pageLayout region) is
root application module.

You might also like