Contents
1- Person and Detail EO and AO ................................................................................... 1
1- Create Person EO ................................................................................................................ 1
2- Create Detail EO ................................................................................................................. 2
3- Create Association AO....................................................................................................... 4
Description
1- Create Person EO
2
3
6
7
Press Next
10
11
12
In the select attribute list you will find all columns also you must choose one of them as primary key
If not Jdeveloper will ask you to make rowId as primary key
In our example we will choose PersonId as Primary Key
Press finish
13
2- Create Detail EO
14
15
17
18
19
20
21
Press Next
22
In the select attribute list you will find all columns also you must choose one of them as primary key
If not Jdeveloper will ask you to make rowId as primary key
In our example we will choose DetailId as Primary Key
Press finish
23
24
3- Create Association AO
26
27
28
29
Name XxPersonDetailAO
Be sure the package name is correct to create EO under schema.server
30
31
32
33
34
Press next
In select source Attribute (Master)
Select PersonId under Entity XxPersonEO under Package xx.oracle.apps.per.xxhr.schema.server
In select Destination Attribute (Details)
Select PersonId under Entity XxPersonDetailEO under Package xx.oracle.apps.per.xxhr.schema.server
Press add
36
37
Description
1- Create Person VO
Name XxPersonVO
Be sure the package name is correct to create VO under .server
5
6
7
Press Next
In our case we will create VO based on EO
Select XxPersonEO Under Package xx.oracle.apps.per.xxhr.schema.server
And press arrow button
Press Next
11
12
13
14
15
16
Press Finish
17
18
19
Name XxPersonDetailVO
Be sure the package name is correct to create VO under .server
2- Create Detail VO
21
22
23
Press Next
In our case we will create VO based on EO
Select XxPersonDetailEO Under Package xx.oracle.apps.per.xxhr.schema.server
And press arrow button
24
25
26
Press Next
Choose attributes (Columns) to be declared in VO
We will choose all
27
28
30
31
32
33
34
Name XxPersonDetailVL
Be sure the package name is correct to create VL under .server
35
36
38
39
Becouse we create the realation between EOs before so we will choose the association already created
40
41
42
43
44
4- Add VO and VL to AM
46
Now open AM
47
48
Apply then ok
Description
2
3
4
5
Under Web Tire choose OA Component and the choose file and press ok
Name XxQueryPersonPG
Be sure the package name is correct to create PG under .webui
8
9
Press OK
10
When you click on XxQueryPersonPG you will see the structure of page
Click On Region1
Change
ID MainRN
Window Title HR Person
Title Query Person
Am Definition Press Button and Choose AM XxHrAM and press OK
13
14
15
16
17
18
20
21
22
23
24
Change Id to CustomPersonQuery
Text(Under Visual Category) Search
25
26
27
28
Prompt
First Name
Last Name
Employee Number
Go
Date Type
VARCHAR2
VARCHAR2
VARCHAR2
Action Type
Event
firAction
FindPerson
30
31
Run Page
32
33
34
35
36
37
38
Press Next
RegionId PersonTable
Region Style table
40
41
42
43
44
45
46
Press Finish
Set width for PersonTable 100%
47
run page
50
51
Press New
Name SelectFlag
Updatable Always
Uncheck Queriable
52
53
54
Press Ok
Press Ok
Right Click on Persontable New singleSelection
58
ID PersonSelectFlag
View Instance (Press button and choose) XxPersonVO1
View Attribute (Press button and choose) SelectFlag
FireAction firePartialAction
Event PersonSelect
Right Click on MainRN New Region
ID PersonDetailHeader
Text Detail
59
60
61
62
63
64
65
Press Next
RegionId PersonDetailTable
67
68
69
70
71
72
73
Press Finish
Set width for PersonDetailTable 100%
74
75
run page
80
81
Now we need to handle action of go button and also for radio group in select person table
First for go button
In AM
We will define public void to handle action of select flag
public void PersonSelectFlag()
{
OAViewObject pPersonVO = getXxPersonVO1();
Row pPersonVORow = pPersonVO.getFirstFilteredRow("SelectFlag","Y");
pPersonVO.setCurrentRow(pPersonVORow);
}
We will define public void with three parameters to execute query
public void FindPerson(String pPersonFirstName,String pPersonLastName,String pEmployeeNumber)
{
OAViewObject pPersonVO = getXxPersonVO1();
pPersonVO.setWhereClause("First_Name like '%"+pPersonFirstName+"%' and Last_Name like
'%"+pPersonLastName+"%' and employee_number like '%"+pEmployeeNumber+"%'");
pPersonVO.executeQuery();
int RowCount = pPersonVO.getRowCount();
if (RowCount > 0)
{
pPersonVO.first().setAttribute("SelectFlag","Y");
pPersonVO.setCurrentRow(pPersonVO.first());
}
}
82
83
84
85
86
In Co XxQueryPersonCO
In import section write
import oracle.apps.fnd.framework.OAApplicationModule;
import java.io.Serializable;
In processFormRequest after super
OAApplicationModule pXxHrAm = pageContext.getApplicationModule(webBean);
String pAction = pageContext.getParameter(EVENT_PARAM);
if (pAction.equals("PersonSelect"))
{
pXxHrAm.invokeMethod("PersonSelectFlag");
}
if (pAction.equals("FindPerson"))
{
String QPersonFirstName = pageContext.getParameter("QPersonFirstName");
String QPersonLastName = pageContext.getParameter("QPersonLastName");
String QEmpNumber = pageContext.getParameter("QEmpNumber");
Serializable[] paramList = { QPersonFirstName,QPersonLastName,QEmpNumber };
88
Now Run
89
90
91
92
93
Press New
Name JobDesc
Updatable Always
Selected In Query Check
Uncheck Queriable
Alias JobDesc
Expression
(SELECT job_name
FROM xx_jobs
WHERE job_id = xxpersondetaileo.job_id)
95
96
97
Press Ok
98
100
101
103
104
106
107
108
109
Press ok
Change style for thos item to messageStyledText
111
112
113
114
Run Page
115
116
117
118
Also PositionDesc
120
121
Run Again
Description
In Am
First we will create Public void to delete person details by Person Id
public void DeletePersonDetailByPersonId(String PersonId)
{
Row pPersonDetailVORow[] =getXxPersonDetailVO1().getAllRowsInRange();
for(int i=0;i<pPersonDetailVORow.length;i++)
{
XxPersonDetailVORowImpl rowi=(XxPersonDetailVORowImpl)pPersonDetailVORow[i];
if (rowi.getPersonId().toString().equals(PersonId))
{
rowi.remove();
}
}
}
5
6
11
12
13
14
ID DeletePerson
Style submitButton
Prompt Delete
Action Type fireAction
Event DeletePerson
Now in CO (XxQueryPersonCO)
17
18
19
20
21
ID Save
Style submitButton
Prompt Save
Action Type fireAction
Event Save
Add another item
ID Rollback
Style submitButton
Prompt Rollback
Action Type fireAction
Event Rollback
22
23
24
In Am we already create public void for save so we will create only one for rollback
public void Rollback()
{
getOADBTransaction().rollback();
OAViewObject pPersonVO = getXxPersonVO1();
pPersonVO.first().setAttribute("SelectFlag","Y");
pPersonVO.setCurrentRow(pPersonVO.first());
}
27
28
29
In CO (XxQueryPersonCO)
Description
File Menu New
3
4
Under Web Tire choose OA Component and the choose file and press ok
Name XxMainPersonPG
Be sure the package name is correct to create PG under .webui
7
8
9
10
11
Press OK
Click On Region1
Change
ID MainRN
Window Title HR Person
Title Main Person
Am Definition Press Button and Choose AM XxHrAM and press OK
Right Click on MainRN and set new controller
Package Name xx.oracle.apps.per.xxhr.webui
Class Name XxMainPersonCO
13
14
15
16
17
18
19
20
21
22
24
RegionId Person
Style defaultSingleColumn
25
26
FirstName
LastName
EmployeeNumber
EffectiveStartDate
EffectiveEndDate
27
28
29
30
Press Finish
33
34
RegionId PersonDetailTable
Style table
35
36
JobDesc
PositionDesc
JobId
PositionId
EffectiveStartDate
EffectiveEndDate
37
38
39
40
Press Finish
Change Maximum Length property for JobDesc and PositionDesc to 255
43
ID Save
Style submitButton
Prompt Save
Action Type fireAction
Event Save
RightClick on MainPersonPageButtonBar New Item
ID Cancel
Style submitButton
Disable Server Side Validation true
(if there are required attribute it will disable validation that you must enter data in it before you fire any action)
Disable Client Side Validation true
(if there are required attribute it will disable validation that you must enter data in it before you fire any action)
Prompt Cancel
Action Type fireAction
Event Cancel
Now Run Page(XxMainPersonPG)
44
45
46
47
48
49
50
Now We need to call this page from XxQueryPersonPG and initiate person and peersondetail record to can insert
In (XxMainPersonPG) Rightlick on Query New Item
51
ID Create
52
53
Style submitButton
Prompt Create
Action Type fireAction
Event Create
In AM create public void to initaite record
public void IniPersonRow()
{
OAViewObject pPersonVO = getXxPersonVO1();
if (!pPersonVO.isPreparedForExecution())
{
pPersonVO.setMaxFetchSize(0);
pPersonVO.executeQuery();
pPersonVO.setMaxFetchSize(-1);
}
pPersonVO.last();
pPersonVO.next();
Row pPersonVORow = pPersonVO.createRow();
pPersonVO.insertRow(pPersonVORow);
String pNewPersonId = getOADBTransaction().getSequenceValue("xx_person_id_seq").toString();
pPersonVORow.setAttribute("PersonId", pNewPersonId);
pPersonVORow.setAttribute("Status", "Pending");
pPersonVORow.setAttribute("EffectiveEndDate","4000-01-01");
OAViewObject pPersonDetailVO = getXxPersonDetailVO1();
if (!pPersonDetailVO.isPreparedForExecution())
{
pPersonDetailVO.setMaxFetchSize(0);
pPersonDetailVO.executeQuery();
pPersonDetailVO.setMaxFetchSize(-1);
}
pPersonDetailVO.last();
pPersonDetailVO.next();
Row pPersonDetailVORow = pPersonDetailVO.createRow();
pPersonDetailVO.insertRow(pPersonDetailVORow);
String pNewPersonDetailId = getOADBTransaction().getSequenceValue("xx_person_detail_id_seq").toString();
pPersonDetailVORow.setAttribute("DetailId", pNewPersonDetailId);
pPersonDetailVORow.setAttribute("EffectiveEndDate","4000-01-01");
}
55
56
In CO (XxQueryPersonCO)
In import section
import com.sun.java.util.collections.HashMap;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
in processFormRequest
if (pAction.equals("Create"))
{
//Invoke Method to initiate record
pXxHrAm.invokeMethod("IniPersonRow");
//Define array variable to can send to the called page parameters
HashMap phm = new HashMap();
//Add to array parameter called pAction and its value Create
phm.put("pAction", "Create");
//call page
pageContext.setForwardURL(
"OA.jsp?page=/xx/oracle/apps/per/xxhr/webui/XxMainPersonPG"
,null // not needed as we are retaining menu context
,OAWebBeanConstants.KEEP_MENU_CONTEXT
,null // not needed as we are retaining menu context
,phm // pass the hashMap that contains values for all of the parameters
,true // retain AM
,OAWebBeanConstants.ADD_BREAD_CRUMB_NO
,OAWebBeanConstants.IGNORE_MESSAGES);
58
59
60
61
62
63
Now we need to generate Employee number by select max of employee number in table
In CO (XxMainPersonCO)
In Import Section
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.jdbc.OracleCallableStatement;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
In processRequest
//Variable we define in the previous page to get the action
String pAction = pageContext.getParameter("pAction");
if (pAction.equals("Create"))
{
OADBTransaction trxn = pageContext.getApplicationModule(webBean).getOADBTransaction();
OracleCallableStatement SelectStmt = null;
String stmt = null;
65
66
Description
First we need to create two view objects for this LOV
Create new business component
Right Click on project new business component
5
6
7
8
9
Press finish
Right Click xx.oracle.apps.per.xxhr.lov.server on new View Object
Name XxJobLovVO
Package xx.oracle.apps.per.xxhr.lov.server
11
12
13
14
15
16
Press finish
Repeat previuous step and create another one for Poisition
Name XxPositionLovVO
Package xx.oracle.apps.per.xxhr.lov.server
Query statement
select job_id,position_id,position_name
from xx_positions
Attached the wo VO to AM
19
20
21
In XxMainPersonPG
Click on JobDesc
22
23
24
25
region1 JobLovRegion
Reight click on JobLovRegion New table using wizard
Choose XxJobLovVO1
28
RegionId JobLovTable
Region Style table
29
30
31
32
Press Finish
33
34
35
36
37
38
Change
ID JobNameLovMap
Lov Region item JobLovName
Return item JobDesc
Criteria item JobDesc
39
40
42
43
44
45
46
48
49
region1 PoistionLovRegion
Reight click on PoistionLovRegion New table using wizard
50
51
52
Choose XxPositionLovVO1
53
RegionId PoistionLovTable
Region Style table
54
56
57
Press Finish
58
59
60
61
Change
ID PositionNameLovMap
Lov Region item PositionLovName
Return item PositionDesc
Criteria item PositionDesc
63
64
65
67
68
69
70
Change
ID PositionJobIdLovMap
Lov Region item PositionLovJobId
Criteria item JobId (Id return from job lov)
Required true
71
73
If you need to change jobid title to be for example job Desc or what ever change prompt of JobId in
PersonDetailTable
Description
In Co (XxMainPersonCO)
In import section
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
in processFormRequest
OAApplicationModule pXxHrAm = pageContext.getApplicationModule(webBean);
String pAction = pageContext.getParameter(EVENT_PARAM);
if (pAction.equals("Save"))
{
pXxHrAm.invokeMethod("Save");
pageContext.setForwardURL(
"OA.jsp?page=/xx/oracle/apps/per/xxhr/webui/XxQueryPersonPG"
,null // not needed as we are retaining menu context
,OAWebBeanConstants.KEEP_MENU_CONTEXT
,null // not needed as we are retaining menu context
,null // pass the hashMap that contains values for all of the parameters
,true // retain AM
,OAWebBeanConstants.ADD_BREAD_CRUMB_NO
,OAWebBeanConstants.IGNORE_MESSAGES);
}
if (pAction.equals("Cancel"))
{
pXxHrAm.invokeMethod("Rollback");
pageContext.setForwardURL(
"OA.jsp?page=/xx/oracle/apps/per/xxhr/webui/XxQueryPersonPG"
,null // not needed as we are retaining menu context
,OAWebBeanConstants.KEEP_MENU_CONTEXT
,null // not needed as we are retaining menu context
,null // pass the hashMap that contains values for all of the parameters
,true // retain AM
,OAWebBeanConstants.ADD_BREAD_CRUMB_NO
,OAWebBeanConstants.IGNORE_MESSAGES);
}
4
5
8-Update Person
Step
No.
1
Description
In AM
public void SelectUpdatedRecord(String pRowReference)
{
XxPersonVORowImpl pPersonVORow = (XxPersonVORowImpl)findRowByRef(pRowReference);
pPersonVORow.setAttribute("SelectFlag","Y");
getXxPersonVO1().setCurrentRow(pPersonVORow);
}
In Page XxQueryPerson
Click on FirstName in Persontable
5
6
7
9
10
11
12
13
14
In CO (XxMainPersonCO)
In Import section
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageDateFieldBean;
In process processRequest
//As we mentioned bwfore that we send parameter when we go to this page create or update
if (pAction.equals("Update"))
{//we use ID of item on screen
OAMessageTextInputBean pFIrstName = (OAMessageTextInputBean)webBean.findChildRecursive("FirstName");
pFIrstName.setReadOnly(true);
OAMessageTextInputBean pLastName = (OAMessageTextInputBean)webBean.findChildRecursive("LastName");
pLastName.setReadOnly(true);
OAMessageDateFieldBean pEffectiveStartDate =
(OAMessageDateFieldBean)webBean.findChildRecursive("EffectiveStartDate");
pEffectiveStartDate.setReadOnly(true);
}
15
17
18
Row run and try to update and create you will see the diff
19
20
22
In CO (XxMainPersonCO)
In import section
import oracle.apps.fnd.framework.webui.beans.table.OATableBean;
We need to do changes in processReuest and processFormRequest
In processReuest
We need to write out code in case action equal update
//Id Of table
//Code to enable standard button on table called addrows
OATableBean PersonDetailTable = (OATableBean)webBean.findChildRecursive("PersonDetailTable");
if (PersonDetailTable != null)
{
PersonDetailTable.setInsertable(true);
PersonDetailTable.setAutoInsertion(false);
PersonDetailTable.prepareForRendering(pageContext);
}
23
24
26
Ok now we need to know the action of this item so we will print the action name in processFormRequest
System.out.println("pAction --> " + pAction);
27
28
29
30
`
Run and click on this button
31
32
33
34
36
Description
To make render filed in run time depend on action fire
We cant set render true or false in processFromrequest so we need to make workaround
There is a fi=unction called SPEL take the value from transit attribute in VO
Now in XxPersonDetailVO we will add transit attribute called EnableRow
Type Boolean
7
9
10
11
12
13
14
15
16
Description
We can get action of Job LOV to make render of Poistion LOV enabled only in case user choose value in Job Lov
else we set it readonly
Now in XxPersonDetailVO we will add transit attribute called EnablePosition
Type Boolean
6
7
In AM
public void DisablePoistion(String pRowReference,Boolean Status)
{
//Coz we will call this void from two location one when initiate new record so we didnt have pRowReference
and other from page
if (pRowReference != null)
{
XxPersonDetailVORowImpl pPersonDetailVORow =
(XxPersonDetailVORowImpl)findRowByRef(pRowReference);
pPersonDetailVORow.setEnablePosition(Status);
}else
{
XxPersonDetailVORowImpl pPersonDetailVORow =(XxPersonDetailVORowImpl)getXxPersonDetailVO1().last();
pPersonDetailVORow.setEnablePosition(Status);
}
}
10
11
13
14
15
16
Update
19
20
Update again
21
22
23
Ok Now we need to set EnablePoistion to false when user change value in JobDesc and attribute != null
In CO (XxMainPersonCO)
String pLovSource = pageContext.getLovInputSourceId();
System.out.println("pLovSource --> " + pLovSource );
24
25
Run and choose from JobDesc Lov and see the output
26
In import section
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
import java.io.Serializable;
In processFormRequest
if (pLovSource.equals("JobDesc"))
{
OAMessageLovInputBean JobDescLov =
(OAMessageLovInputBean)webBean.findIndexedChildRecursive("JobDesc");
String RowReference =
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
if (JobDescLov.getText(pageContext) != null)
{
//array of datatypes, one to one mapping with parameters.
Class[] paramTypes = {String.class, Boolean.class};
Serializable[] paramList = { RowReference,Boolean.FALSE};
27
29