Anda di halaman 1dari 73

Oracle Application Framework (OAF) Training Guide

Contents
1- Person and Detail EO and AO ................................................................................... 1
1- Create Person EO ................................................................................................................ 1
2- Create Detail EO ................................................................................................................. 2
3- Create Association AO....................................................................................................... 4

2- Person and Detail VO and VL ................................................................................... 6


1- Create Person VO ............................................................................................................... 6
2- Create Detail VO ................................................................................................................. 7
3- Create View Link ................................................................................................................ 9
4- Add VO and VL to AM.................................................................................................... 11

3- Create Query Page for Person and Detail .............................................................. 12


1- Create Query Person Page............................................................................................... 12
2- Create Custom Query Region for Person and Detail ................................................... 14

4-Delete,Save and rollback Person and its Details .................................................... 28


5-Create Person and switch between two pages ....................................................... 32
6-Create Job and position Lov and make them dependent...................................... 44
7-Save or Rollback Created Person and return to main Page ................................. 55
8-Update Person............................................................................................................. 57
1-Make some fields to be readonly (All header feilds) .................................................... 58
2- Enable addrow in detail table ......................................................................................... 59

9-Partial Page Rendering(PPR Section 1) ................................................................... 63


10-Get action of LOV (PPR Section 2) ......................................................................... 66

Oracle Application Framework (OAF) Training Guide

1- Person and Detail EO and AO


Step
No.
1

Description

1- Create Person EO

2
3

Right click on xx.oracle.apps.per.xxhr.schema.server package and choose New Entity Object

Schema Object XX_PERSON


Entity name XxPersonEO
Press Next

6
7

You must see all columns in XX_PERSON table

Press Next

Oracle Application Framework (OAF) Training Guide


9

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

Right click on xx.oracle.apps.per.xxhr.schema.server package and choose New Entity Object

Oracle Application Framework (OAF) Training Guide


16

Schema Object XX_PERSON_DETAIL


Entity name XxPersonDetailEO
Press Next

17

18
19

You must see all columns in XX_PERSON_DETAIL table

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

Oracle Application Framework (OAF) Training Guide


25

3- Create Association AO

26

It looks like relation between master and details table on EO Level


XX_PERSON is master (PERSON_ID)
XX_PERSON_DETAIL is details (PERSON_ID)

27
28

Right click on xx.oracle.apps.per.xxhr.schema.server package and choose New Association

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

Oracle Application Framework (OAF) Training Guide


35

36
37

Press next then finish

Oracle Application Framework (OAF) Training Guide

2- Person and Detail VO and VL


Step
No.
1

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

Oracle Application Framework (OAF) Training Guide


10

Choose attributes (Columns) to be declared in VO


We will choose all

11

12
13
14

Press Next Then Next then next


Generate java files

15
16

Press Finish

17
18

Right click on xx.oracle.apps.per.xxhr.server package and choose New View Object

19

Name XxPersonDetailVO
Be sure the package name is correct to create VO under .server

2- Create Detail VO

Oracle Application Framework (OAF) Training Guide


20

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

Generate java files then finish

Oracle Application Framework (OAF) Training Guide


29

30

3- Create View Link

31
32
33

It looks like relation between master and details table on VO Level


Right click on xx.oracle.apps.per.xxhr.server package and choose New View Link

34

Name XxPersonDetailVL
Be sure the package name is correct to create VL under .server

35

36

Select source View Object XxPersonVO


Select Destination View Object XxPersonDetailVO
Press Next

Oracle Application Framework (OAF) Training Guide


37

38
39

Becouse we create the realation between EOs before so we will choose the association already created

40

By default it will choose PersonId


Press Next
Also by default in destination View Object Jdeveloper will choose PersonId

41
42

43
44

Press Next Then Finish

Oracle Application Framework (OAF) Training Guide


45

4- Add VO and VL to AM

46

Now open AM

47

48

Apply then ok

Oracle Application Framework (OAF) Training Guide

3- Create Query Page for Person and Detail


Step
No.
1

Description

1- Create Query Person Page

2
3

File Menu New

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

Oracle Application Framework (OAF) Training Guide


11
12

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

Right Click on MAinRN and set new controller

16

Package Name xx.oracle.apps.per.xxhr.webui


Class Name XxQueryPersonCO

17

18

Oracle Application Framework (OAF) Training Guide


19

2- Create Custom Query Region for Person and Detail

20
21

Right Click on MainRN New Region

22
23

By default it will create region with style header

24

Change Id to CustomPersonQuery
Text(Under Visual Category) Search

25

26

Right Click on CustomPersonQuery New Region


Change Id to Query
Region Style LabelFeildLayout

27

28

We will create below items


ID
Item Style
QPersonFirstName messageTextInput
QPersonLastName messageTextInput
QEmpNumber
messageTextInput
QGo
submitButton

Prompt
First Name
Last Name
Employee Number
Go

Date Type
VARCHAR2
VARCHAR2
VARCHAR2

Action Type

Event

firAction

FindPerson

Oracle Application Framework (OAF) Training Guide


29

30
31

Run Page

32
33

Right Click on MainRN New Region


ID PersonHeader
Text Person

34

35
36

Right Click on PersonHeader New Region Region Using Wizard


Be Sure that you are choose right application Module from List
And then choose VO that you need to show (XxPersonVO1)

37

38

Press Next
RegionId PersonTable
Region Style table

Oracle Application Framework (OAF) Training Guide


39

40
41

42
43

Choose attributes you need to show on screen


We will choose
FirstName
LastName
EmployeeNumber
Status
EffectiveStartDate
EffectiveEndDate
Make Style to all attributes messageStyledtext

44
45
46

Press Finish
Set width for PersonTable 100%

47

run page

Oracle Application Framework (OAF) Training Guide


48
49

Go to XxPersonVO under xx.oracle.apps.per.xxhr.server package and double click

50
51

Press New
Name SelectFlag
Updatable Always
Uncheck Queriable

52

53
54

Press Ok

Oracle Application Framework (OAF) Training Guide


55
56
57

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

Right Click on PersonDetailHeader New Region Region Using Wizard


Be Sure that you are choose right application Module from List
And then choose VO that you need to show (XxPersonDetailVO1)

64

65

Press Next
RegionId PersonDetailTable

Oracle Application Framework (OAF) Training Guide


Region Style table
66

67
68

69
70

Choose attributes you need to show on screen


We will choose
JodId
PersonId
EffectiveStartDate
EffectiveEndDate
Make Style to all attributes messageStyledtext

71
72
73

Press Finish
Set width for PersonDetailTable 100%

74
75

run page

Oracle Application Framework (OAF) Training Guide


76
77
78
79

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 };

Oracle Application Framework (OAF) Training Guide


pXxHrAm.invokeMethod("FindPerson",paramList);
}
87

88

Now Run

(Untill now we didnt make any new )

89

90
91
92

We need to get job name and position name instead of IDs


Go to XxPersonDetailVO under xx.oracle.apps.per.xxhr.server package and double click

93

Press New

Oracle Application Framework (OAF) Training Guide


94

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

If you go and check query

Oracle Application Framework (OAF) Training Guide


99

100
101

Again we will create Another one for position Name


Name PositionDesc
Updatable Always
Selected In Query Check
Uncheck Queriable
Alias PositionDesc
Expression
(SELECT position_name FROM xx_positions
WHERE position_id = xxpersondetaileo.position_id)

Oracle Application Framework (OAF) Training Guide


102

103

104

Now Right Click on PersonDetailtable

Oracle Application Framework (OAF) Training Guide


105

106

107

108
109

Press ok
Change style for thos item to messageStyledText

Oracle Application Framework (OAF) Training Guide


110

111

112

113
114

Run Page

115
116
117

Set render for JobId and PositionId to false


Reorder By click on JobDesc and hold and move it up

118

Also PositionDesc

Oracle Application Framework (OAF) Training Guide


119

120
121

Run Again

Oracle Application Framework (OAF) Training Guide

4-Delete,Save and rollback Person and its Details


Step
No.
1
2
3

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

Second we will create Public void to delete person by select flag


public void DeletePerson()
{
if ( getXxPersonVO1().getFetchedRowCount() == 0 )
{
throw new OAException("Please choose person first" ,OAException.ERROR);
}else
{
OAViewObject pPersonVO = getXxPersonVO1();
XxPersonVORowImpl pPersonVORowImpl =
(XxPersonVORowImpl)pPersonVO.getFirstFilteredRow("SelectFlag","Y");
DeletePersonDetailByPersonId(pPersonVORowImpl.getPersonId().toString());
pPersonVORowImpl.remove();
if ( getXxPersonVO1().getFetchedRowCount() > 0 )
{
pPersonVO.first().setAttribute("SelectFlag","Y");
pPersonVO.setCurrentRow(pPersonVO.first());
}
}
}

Oracle Application Framework (OAF) Training Guide


8
9
10

Create Delete button in page


Right click on PersonTable New tableActions

11
12
13

Change region ID PersonTableAction


Right click on PersonTableAction New Item

14

ID DeletePerson
Style submitButton
Prompt Delete
Action Type fireAction
Event DeletePerson

Oracle Application Framework (OAF) Training Guide


15
16

Now in CO (XxQueryPersonCO)

17
18
19
20

Run Page and delete


Now we Need to save and rollback
Right click on PersonTableAction New Item

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

Oracle Application Framework (OAF) Training Guide


25
26

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)

Oracle Application Framework (OAF) Training Guide

5-Create Person and switch between two pages


Step
No.
1
2

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

Oracle Application Framework (OAF) Training Guide


12

13

14
15
16
17
18
19

RightClick on MainRN New Region


ID PersonHeader
Text Person
RightClick on MainRN New Region
ID PersonDetailHeader
Text Person Detail
RightClick on MainRN New Region
ID MainPersonPageButtonBar
Style pageButtonBar

20

21
22

RightClick on PersonHeader New Region Using Wizard

Oracle Application Framework (OAF) Training Guide


23

24

RegionId Person
Style defaultSingleColumn

25

26

FirstName
LastName
EmployeeNumber
EffectiveStartDate
EffectiveEndDate

Oracle Application Framework (OAF) Training Guide

27
28

Change EmployeeNumber,Status,EffectiveEndDate to messageStyledText

29
30

Press Finish

Oracle Application Framework (OAF) Training Guide


31
32

RightClick on PersonDetailHeader New Region Using Wizard

33

34

RegionId PersonDetailTable
Style table

35

36

JobDesc
PositionDesc
JobId
PositionId
EffectiveStartDate
EffectiveEndDate

Oracle Application Framework (OAF) Training Guide

37

Change JobId,PositionId,EffectiveEndDate to fromValue


Change EffectiveEndDate to MessageStyledtext

38

39
40

Press Finish
Change Maximum Length property for JobDesc and PositionDesc to 255

Oracle Application Framework (OAF) Training Guide


41
42

RightClick on MainPersonPageButtonBar New Item

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

Oracle Application Framework (OAF) Training Guide

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");
}

Oracle Application Framework (OAF) Training Guide


54

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);

Oracle Application Framework (OAF) Training Guide


}
57

58
59

Run Page and press Create

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;

Oracle Application Framework (OAF) Training Guide


String pEmpNum = null;
try
{
stmt =
"Begin "+
"Select Max(Employee_Number) + 1 "+
"Into :1 "+
"From Xx_Person ; "+
"End; ";
SelectStmt = (OracleCallableStatement)trxn.createCallableStatement(stmt, 1);
SelectStmt.registerOutParameter(1, 12);
SelectStmt.execute();
pEmpNum = SelectStmt.getString(1);
SelectStmt.close();
}
catch (Exception e)
{
throw new OAException(String.valueOf(e));
}
OAMessageStyledTextBean pEmployeeNumber =
(OAMessageStyledTextBean)webBean.findChildRecursive("EmployeeNumber");
pEmployeeNumber.setText(pageContext,pEmpNum);
}
64

65
66

Now run again

Oracle Application Framework (OAF) Training Guide

Oracle Application Framework (OAF) Training Guide

6-Create Job and position Lov and make them dependent


Step
No.
1
2
3
4

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

Package name xx.oracle.apps.per.xxhr.lov.server

7
8
9

Press finish
Right Click xx.oracle.apps.per.xxhr.lov.server on new View Object

Oracle Application Framework (OAF) Training Guide


10

Name XxJobLovVO
Package xx.oracle.apps.per.xxhr.lov.server

11

12

Next Next Next Next


Untill reach the pleace where we write our query
Query statement
select job_id,job_name
from xx_jobs

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

Oracle Application Framework (OAF) Training Guide


17
18

Attached the wo VO to AM

19
20
21

In XxMainPersonPG
Click on JobDesc

22

Change item style to messageLovInout


It will create by default two component under jobdesc item

23

24
25

region1 JobLovRegion
Reight click on JobLovRegion New table using wizard

Oracle Application Framework (OAF) Training Guide


26
27

Choose XxJobLovVO1

28

RegionId JobLovTable
Region Style table

29

30

31
32

Press Finish

33

Change id of JobId1 JobLovId


Change id of JobId1 JobLovName
Change property for JobLovName (Search allowed to be true to can serach by it in LOV)

Oracle Application Framework (OAF) Training Guide

34
35

In LovMapping the first lovmapping created by default


Change
ID JobIdLovMap
Lov Region item JobLovId
Return item JobId

36
37

Right Click on LovMappings new LovMap

38

Change
ID JobNameLovMap
Lov Region item JobLovName
Return item JobDesc
Criteria item JobDesc

39
40

Now run and choose job from LOV

Oracle Application Framework (OAF) Training Guide


41

42

43
44
45
46

Change JobLovId item style to fromValue to hide it.


We Need to repate previous step to craete poistion LOV
Click on PoisitionDesc

Oracle Application Framework (OAF) Training Guide


47

Change item style to messageLovInout


It will create by default two component under jobdesc item

48

49

region1 PoistionLovRegion
Reight click on PoistionLovRegion New table using wizard

50

51
52

Choose XxPositionLovVO1

53

RegionId PoistionLovTable
Region Style table

54

Oracle Application Framework (OAF) Training Guide


55

56
57

Press Finish

58

Change id of JobId1 PositionLovJobId and make item style to fromValue


Change id of PositionId1 PositionLovId and make item style to fromValue
Change id of JobId1 PositionLovName
Change property for JobLovName (Search allowed to be true to can serach by it in LOV)

59
60

In LovMapping the first lovmapping created by default


Change
ID PoistionIdLovMap
Lov Region item PositionLovJobId
Return item PoistionId

61

Right Click on LovMappings new LovMap

Oracle Application Framework (OAF) Training Guide


62

Change
ID PositionNameLovMap
Lov Region item PositionLovName
Return item PositionDesc
Criteria item PositionDesc

63
64

Now run and choose job from LOV

65

Oracle Application Framework (OAF) Training Guide


66

67
68
69

Now I need to filter poistion depend on jobs


In lovmapping in PositionDesc add new lovmap

70

Change
ID PositionJobIdLovMap
Lov Region item PositionLovJobId
Criteria item JobId (Id return from job lov)
Required true

71

Now run and try to select position without fill job

Oracle Application Framework (OAF) Training Guide


72

73

If you need to change jobid title to be for example job Desc or what ever change prompt of JobId in
PersonDetailTable

Oracle Application Framework (OAF) Training Guide

7-Save or Rollback Created Person and return to main Page


Step
No.
1

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);
}

Oracle Application Framework (OAF) Training Guide


3

4
5

Make all fields apprea in create page to be mandatory


Required True
Run and try

Oracle Application Framework (OAF) Training Guide

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

Action Type firaAction


Event UpdatePerson
In CO XxQueryPersonCO
if (pAction.equals("UpdatePerson"))
{
String RowReference =
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable[] paramList = { RowReference };
pXxHrAm.invokeMethod("SelectUpdatedRecord",paramList);
HashMap phm = new HashMap();
phm.put("pAction", "Update");
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);
}

Oracle Application Framework (OAF) Training Guide


8

9
10

Now run page and press go


Firstname will change to hiperlink if you click on it will choose the record you click on it and go to the next page
and you can uodate and press save or cancel

11

12

Now we need to do some changes in case we will update record


1- Make some fields to be readonly (All header feilds)
2- Enable addrow in detail table

13

1-Make some fields to be readonly (All header feilds)

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

Oracle Application Framework (OAF) Training Guide


16

17
18

Row run and try to update and create you will see the diff

19
20

In Am we need to create public void to initiate Detail record


public void IniDetailRow(String pRowReference)
{
OAViewObject pPersonDetailVO = getXxPersonDetailVO1();
if (!pPersonDetailVO.isPreparedForExecution())
{
pPersonDetailVO.setMaxFetchSize(0);
pPersonDetailVO.executeQuery();
pPersonDetailVO.setMaxFetchSize(-1);
}
pPersonDetailVO.last();
//Set effective end date in last record in dtail table to be sysdate
pPersonDetailVO.last().setAttribute("EffectiveEndDate",getOADBTransaction().getCurrentUserDate());
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");
//Set effective start date in new record in dtail table to be sysdate
pPersonDetailVORow.setAttribute("EffectiveStartDate",getOADBTransaction().getCurrentUserDate());
}

2- Enable addrow in detail table

Oracle Application Framework (OAF) Training Guide


21

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

Row run and update

Oracle Application Framework (OAF) Training Guide


25

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

Action called addRows


But if we have more than one table have this standard button we need to differentiate between them
So we need to write below code to know the source of table
//Get source of table
String pSource = pageContext.getParameter("source");
System.out.println("pAction --> " + pAction + " ,pSource --> " + pSource);

31

32
33

34

Run and click on this button

N32 refere to source of PersonDetailtable (may you have another source)


We need to handle this action with this source
if (pAction.equals("addRows") && pSource.equals("N32"))
{
pXxHrAm.invokeMethod("IniDetailRow");
}

Oracle Application Framework (OAF) Training Guide


35

36

Oracle Application Framework (OAF) Training Guide

9-Partial Page Rendering(PPR Section 1)


Step
No.
1
2
3
4

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

Oracle Application Framework (OAF) Training Guide


6

Type Boolean
7

Oracle Application Framework (OAF) Training Guide


8

9
10
11

Now in attributes in PersonDetailTable in XxMainPersonPG


JobDesc
PoistionDesc
EffectiveStartDate1
Set redonly ${oa.XxPersonDetailVO1.EnableRow}
${oa.VO instance.Attributename}
Now we need to set the attribute to False when we go to page with parameter update
In Am
public void DisableDetailRows()
{
Row pPersonDetailVORow[] =getXxPersonDetailVO1().getAllRowsInRange();
for(int i=0;i<pPersonDetailVORow.length;i++)
{
XxPersonDetailVORowImpl rowi=(XxPersonDetailVORowImpl)pPersonDetailVORow[i];
rowi.setEnableRow(Boolean.TRUE);
}
}

12

13

In Co (XxQueryPersonCO) In UpdatePerson Action


pXxHrAm.invokeMethod("DisableDetailRows");

14

15
16

Now run and see diff

Oracle Application Framework (OAF) Training Guide

10-Get action of LOV (PPR Section 2)


Step
No.
1
2
3

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

Oracle Application Framework (OAF) Training Guide


5

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);
}
}

Oracle Application Framework (OAF) Training Guide


9

10
11

Now in XxMainPersonPG in PersonDetailtable click on PositionDesc


Set readonly ${oa.XxPersonDetailVO1.EnablePosition}
Instead of ${oa.XxPersonDetailVO1.EnableRow}
In IniDetailRow and IniPersonRow add the below code
DisablePoistion(null,Boolean.TRUE);

Oracle Application Framework (OAF) Training Guide


12

13
14

Now run and try to create

15
16

Update

Oracle Application Framework (OAF) Training Guide


17
18

Opps we to set the EnablePoistion to true in DisableDetailRows

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

Oracle Application Framework (OAF) Training Guide


pXxHrAm.invokeMethod("DisablePoistion",paramList,paramTypes);
}
if (JobDescLov.getText(pageContext) == null)
{
//array of datatypes, one to one mapping with parameters.
Class[] paramTypes = {String.class, Boolean.class};
Serializable[] paramList = { RowReference,Boolean.TRUE };
pXxHrAm.invokeMethod("DisablePoistion",paramList,paramTypes);
}
}
28

29

Run and test

Anda mungkin juga menyukai