Callable Statement
Callable Statement
Callable Statement
oaf
==================
https://blogs.oracle.com/prajkumar/entry/oaf_developer_guide
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);
}
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);
}
//
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);
}
PROJECT:1
Create a customer search page as shown and then link to create customer
page
, 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,
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
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.
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
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)
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;
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();
row.remove();
getTransaction().commit();
break;
}
}
}
deleteIter.closeRowSetIterator();
}
Step-22
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
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.
Syntax: <thirdparty>.oracle.apps.applshortname.componentname.<subcomp>.webui
Ex: xyz.oracle.apps.xxcust.empmgmt.webui
4.
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 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.
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)
{
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
************************************************************************************
************************
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
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.
transient attributes )
4) Validation VO- Validates the data entered and throws a message.
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.
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.
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 )
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)
D:\oracle\visappl\fnd\11.5.0\secure\myprojects
]
Creation of BC4J
Creation of AM
Next next
Finish it
Rebuild page
Run it
Creation of vo
Write query
select po_header_id,
po_line_id,
line_num
from po_lines_all
dependenPick.oracle.apps.po.mgmt.picklist.server.poheadersVO
dependenPick.oracle.apps.po.mgmt.picklist.server.polinesVO
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
Here we can create some defaultdouble region and develop the items below
Creation of items like poheader and poline under region of defaultdouble column
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
querySearch.oracle.apps.po.server
Click on log on
Creation of AM
querySearchAM
querySearch.oracle.apps.po.server
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
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
Id: query
Style: query
And
************************************************************************************
************************************
************************************************************************************
***************************************
************************************************************************************
**********************************
Dependent LOV
Creation of AM
Save it and
Creation of Page
Creation of VO
Set the vo to am
as
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.
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
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();
}
1)
2)
Parameter window:SPEL
Name DeptId
Value - ${oa.SearchVO1.DeptId}
3)
write the delete login AM, start with creating method ->
{
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.
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
}
am.getXXconsumer_DiscountVO1().executeQuery();
}
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);
}
}
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);
}
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
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
{
String dname=pageContext.getParameter("Dname");
if(!(("".equals(dname))&&(dname==null)))
{
Serializable[] param={dname};
am.invokeMethod("initquary",param);
OAMessageFileUploadBean upload=(OAMessageFileUploadBean)webBean.
findChildRecursive("ContractAttachment");
OADataBoundValueViewObject displaybound=new OADataBoundValueViewObject
(upload,"FileName");
upload.setAttributeValue(DOWNLOAD_FILE_NAME,displaybound);
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.
Click on Next, and in Set field, attach the permission set XX Employee Date Read Only
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.
***************************************************************
*************************************************************
oaf interview questions
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
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.
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