31
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API Master-Detail Page in OA Framework Master-Detail page is a very common requirement for OAF based project.This tutorial is based on Oracle's Toolbox tutorial,it has been redone and explained step by step to help beginners.Below are the step by step by approach to implement the Master Detail Page using PPR.Source code for this tutorial is available as attachement. Note: Only registered users can download the source code and registration is free. Have a Look at Oracle Forms Style Master Detail Page License: {tab=Initial Steps -->} 1. Right click Workspaces and click create new OAworkspace and name it as "CholaMasterDetail". Automatically a new OA Project is also created. Name the project as CholaMasterDetailand package as chola.oracle.apps.fnd.master. Sudhakar Mani Published on 12 May 2009 Hits: 12804 Advertisements OA Framework Book Covers java basics,OAF customization and extensions Learn More OA Framework Training Learn OAF from the experts.Start at $299 Learn More Oracle SOA Training Learn SOA 11G from the industry leading professional trainer Learn More

Master Detail Page in OAF By Area51.pdf

Embed Size (px)

DESCRIPTION

Good document

Citation preview

Page 1: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Master-Detail Page in OA Framework

Master-Detail page is a very common requirement for OAF based project.This tutorial is based on Oracle's Toolboxtutorial,it has been redone and explained step by step to help beginners.Below are the step by step by approach toimplement the Master Detail Page using PPR.Source code for this tutorial is available as attachement.

Note: Only registered users can download the source code and registration is free.

Have a Look at Oracle Forms Style Master Detail Page

License:

{tab=Initial Steps -->}1. Right click Workspaces and click create new OAworkspace and name it as "CholaMasterDetail". Automatically a new OAProject is also created. Name the project as CholaMasterDetailand package as chola.oracle.apps.fnd.master.

Sudhakar Mani Published on 12 May 2009 Hits: 12804

Advertisements

OA Framework Book Covers javabasics,OAFcustomization andextensions

Learn More

OA Framework TrainingLearn OAF from theexperts.Start at $299

Learn More

Oracle SOA Training Learn SOA 11G fromthe industry leadingprofessional trainer

Learn More

Page 4: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

2. We need to create two Business component package. Right click on CholaMasterDetail.jpr and click on new BusinessComponent Package.

Name - cholamd.oracle.apps.fnd.master.server

Page 5: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

3.Right click on cholamd.oracle.apps.fnd.master.server and click new Application Module.

Name - CholaMdAM.Package - cholamd.oracle.apps.fnd.master.server.

Page 6: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

{tab=VO -->}

4. Right click on cholamd.oracle.apps.fnd.master.server and click new View Object.

Name - SupplierPVOPackage - cholamd.oracle.apps.fnd.master.server.

Click Next and go to the attributes page.The VO is based on any EO.We need to create transient attributes.Click New andcreate the below attributes.

Name - RowKey DataType - String Updatable - Always

Page 7: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Key Attribute - Yes

Name - PoApproveReadOnlyDataType - BooleanUpdatable - Always

Name - PoApproveRequired DataType - StringUpdatable - Always

Name - PoApproveRenderDataType - BooleanUpdatable - Always

Name - PoApproveRejectDataType - BooleanUpdatable - Always

Name - DetailTableTextDataType - StringUpdatable - Always

Click Next and Finish.

Page 8: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

5.Right click on cholamd.oracle.apps.fnd.master.server and click on new View Object.

Name - SupplierSitesVOPackage - cholamd.oracle.apps.fnd.master.server.

Click Next.Go to the query page and paste the following query:

Page 9: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

SELECT SupplierSiteEO.SUPPLIER_ID,

SupplierSiteEO.SUPPLIER_SITE_ID,

SupplierSiteEO.SITE_NAME,

SupplierSiteEO.PURCHASING_SITE_FLAG,

SupplierSiteEO.START_DATE,

SupplierSiteEO.END_DATE

FROM FWK_TBX_SUPPLIER_SITES SupplierSiteEO

Click Next and Finish.

6.Right click on cholamd.oracle.apps.fnd.master.server and click on new View Object.

Name - SuppliersVOPackage - cholamd.oracle.apps.fnd.master.server.

Click Next.Go to the query page and paste the following query:

SELECT SupplierEO.SUPPLIER_ID,

SupplierEO.NAME,

SupplierEO.ON_HOLD_FLAG,

SupplierEO.START_DATE,

SupplierEO.END_DATE

FROM FWK_TBX_SUPPLIERS SupplierEO

WHERE SupplierEO.SUPPLIER_ID <= 100

Note : Add a new attribute SelectFlag as a transient attribute.Do not forget to do this step.

Edit the AM and shuttle the SuppliersVO and SupplierSitesVO to the right side and click ok. Only then the VO instances willbe accessible.{tab=VL -->}7.Right click on cholamd.oracle.apps.fnd.master.server and click on new View Link.

Name - SuppliertoSitesVLPackage - cholamd.oracle.apps.fnd.master.server.

Page 10: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

8.From the source view object select SuppliersVO and from destination view object select SupplierSitesVO.Click Next.

9.Select the SupplierId from the available attributes of SuppliersVO and shuttle it to the right side.Click Next.

Page 11: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

10.Select the SupplierId from the available attributes of SupplierSitesVO and shuttle it to the right side.Click Next.

Page 13: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

11.Choose the cardinality for the source(SuppliersVO) as 1 and destination(SupplierSitesVO) as *.Click Next and Finish.

Page 14: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

{tab=PG -->}

12.Right click on CholaMasterDetail.jpr and select new. Click on web tier and then OA Components and select Page.

Name - CholaMasterDetailPGPackage - cholamd.oracle.apps.fnd.master.webui.

Page 15: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

13.Select the CholaMasterDetailPG and go to the strcuture pane where a default region has been created.

14. Select region1 and set the following properties:

ID - PageLayoutRNAM Definition - cholamd.oracle.apps.fnd.master.server.CholaMdAMWindow Title - Master Detail Page DemoTitle - Master Detail Page Demo

15.Right click on PageLayoutRN and select new Region.

Name - MasterDetailRNRegion Style - Header

16.Right click on MasterDetailRN and select new Region Using Wizard.

17.From the droplist select the CholaMdAM and then SuppliersVO1.Click Next.

Page 16: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

18.Set the RegionID as SuppliersTable and RegionStyle as Table.

19.Shuttle all the attributes to the right side and click next.

20.Change the Style of all the attributes to messageStyledText.Click Next and Finish.

Right click on SuppliersTable and select new - > singleSelection.Set the following properties for the singleSelection:

View Instance - SuppliersVO1

View Attribute - SelectFlag

Action Type - firePartialAction

Page 17: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Event - supplierSelect

21.Right click on SuppliersTable and click new singleSelection.Set the following properties:

View Instance - SuppliersVO1View Attribute - SelectFlagAction Type - firePartialActionEvent - supplierSelect

21.Select MastersDetailRN and select new Region.

23.Set the RegionID as SupplierSitesHeader and RegionStyle as header.

24.Right click SupplierSitesHeader and select new Region Using Wizard.

25.From the droplist select the CholaMdAM and then SupplierSitesVO1.Click Next.

Page 18: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

26.Set Name as SupplierSitesHeader and RegionStyle as Table.Click Next.

27.Shuttle all the attributes to the right side and click next.

28.Change the Style of all the attributes to messageStyledText.Click Next and Finish.

{tab=CO -->}

29.Right click on the PageLayoutRN in the page and select Set new Controller.

Name- MasterDetailCOPackage - cholamd.oracle.apps.fnd.master.webui

Page 19: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Import Statements:

Import Statements1

2

3

4

5

6

7

8

9

import oracle.apps.fnd.common.VersionInfo;

import oracle.apps.fnd.framework.OAApplicationModule;

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

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

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

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

import oracle.apps.fnd.framework.webui.beans.OAWebBean;

import oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean;

import oracle.apps.fnd.framework.webui.beans.table.OATableBean;

Code:

{slide=ProcessRequest}

1

2

3

4

5

6

OAHeaderBean sitesHeader =

(OAHeaderBean)webBean.findChildRecursive("SupplierSitesHeader");

sitesHeader.setAttributeValue(OAWebBeanConstants.TEXT_ATTR,

new OADataBoundValueViewObject(sitesHeader, "DetailTableText",

"SupplierPVO1"));

OAApplicationModule am =

Page 20: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

7

8

9

10

(OAApplicationModule)pageContext.getApplicationModule(webBean);

am.invokeMethod("initializePPRExamplePage");

OATableBean table = (OATableBean)webBean.findChildRecursive("SuppliersTable");

table.queryData(pageContext, true);

{/slide}{slide=ProcessFormRequest}

1

2

3

4

5

6

7

OAApplicationModule am =

(OAApplicationModule)pageContext.getApplicationModule(webBean);

String event = pageContext.getParameter("event");

if ("supplierSelect".equals(event))

{

am.invokeMethod("handleSupplierSelectionEvent");

}

{/slide}

{tab=AM Code -->}

Include the two methods in CholaMdAMImpl.java file.

handleSupplierSelectionEvent:

1

2

3

4

5

6

7

8

9

10

public void handleSupplierSelectionEvent()

{

OADBTransaction txn = getOADBTransaction();

String detailTableText = null;

OAViewObject vo = (OAViewObject)findViewObject("SuppliersVO1");

Row masterRow = vo.getFirstFilteredRow ("SelectFlag", "Y");

if (masterRow != null)

{

vo.setCurrentRow(masterRow);

String supplierName = (String)masterRow.getAttribute("Name");

Page 21: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

MessageToken[] tokens = { new MessageToken("SUPPLIER_NAME", supplierName)};

detailTableText =

txn.getMessage("AK", "FWK_TBX_SITES_FOR_SUPPLIER", tokens);

}

else

{

detailTableText =

txn.getMessage("AK", "FWK_TBX_SUPPLIER_SITES", null);

}

SupplierPVOImpl appPropsVo = getSupplierPVO1();

Row appPropsRow = appPropsVo.getCurrentRow();

if (appPropsRow != null)

{

appPropsRow.setAttribute("DetailTableText", detailTableText);

}

} // end handleSupplierSelectionEvent()

initializePPRExamplePage:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

public void initializePPRExamplePage()

{

OAViewObject appPropsVO = (OAViewObject)findViewObject("SupplierPVO1");

if (appPropsVO != null)

{

if (appPropsVO.getFetchedRowCount() == 0)

{

appPropsVO.setMaxFetchSize(0);

appPropsVO.executeQuery();

appPropsVO.insertRow(appPropsVO.createRow());

OARow row = (OARow)appPropsVO.first();

row.setAttribute("RowKey", new Number(1));

}

handleSupplierSelectionEvent();

}

else

Page 22: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

16

17

18

19

20

21

22

else

{

// throw exception

}

}

{tab=Save and Run }

Page 25: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Hits : 12804Share This

Sudhakar Mani

Points : 1840

Contact Author Website Facebook Twitter

I am an Oracle Technical Architect working on Oracle Property Manager.MyExpertise includes Oracle ADF,OA Framework,SOA and OBIEE.

Comment as a guest or login

Search... Browse Post My Account

Page 26: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Name * Email *

Subscribe to None

Sort by: Date Rating

41 Comments

Submit comment

evivek 44 Months Ago (0) Vote

Reply Quote

Hi Aarthi,

I'm using 10.1.3.1.0 and its navigation seems to be different from that shown in the screenshot.

When i right click on .jpr, i cant view the "New Business Components package" option.

Thanks,

Vivek

aarthi 10 Months Ago (0) Vote

Vivek,

It is done in 11i jdev.you can right click on your project and then goto business tier-ADF business components and then select VO or EO.you can straight away specify the package name there.In r12 jdev it is not needed to create bc4j package explicitly.

Page 27: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Reply Quote

Let me know if you have any problems doing it.

Regards,

Aarthi

suryakanta.palai 3 Months Ago (0) Vote

Reply Quote

Hi Aarthi,

Xlent article. Its really helpful.

Thanks

surya

aarthi 8 Months Ago (+1) Vote

Reply Quote

Thanks suryakanta..

Regards,

Aarthi

Page 28: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

contactriteshsharma 18 Months Ago (0) Vote

Reply Quote

Hi Aarathi,

My requirement is to develop a Oracle Form style Master-Detail data entry Form, is it possible in OAF or Not?

I developed a sample form and created all required BC4J components like EO, VO, viewlink and entity association but it is not picking up the foreign key value. What may be the reason? I have set the newly created row as current row for Master VO.

Thanks in advance

Regards,

Reetesh Sharma

aarthi 18 Months Ago (0) Vote

Reply Quote

Reetesh,

No it is not straight forward in OAF. However you can achieve this by tweaking a little.Can you attach your project zip file in the forums so that I can have a look at it.

Regards,

Aarthi

Page 29: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

contactriteshsharma 33 Months Ago (0) Vote

Reply Quote

Hi Arathi,

Thanks for your propmt response.

I've already compeleted that project and handelled Master-Detail Relationship manually means I created two regions while querying I was firing query on both the regions simultaneously and while saving the data I will pass foreign key value manually to child block.

I just want to know if any better approach is there.

Best Regards

Reetesh Sharma

muthuvadde 19 Months Ago (0) Vote

Reply Quote

Hi Arthi,

Superb yaar

i do admire ur job

it is very helpful for working guys.

keep it up

thanks

muthu

Page 30: Master Detail Page in OAF By Area51.pdf

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Akila 40 Months Ago (0) Vote

Reply Quote

Hi Aarthi,

I created a Master-Detail OAF page following the steps you listed in the document. But I am not getting any data when I attach the detail region. If I just run the the page with the Master Region alone, I could see the data.

I am fairly new to OAF and I am having hard time to figure out what I missed.

Could you please help me out on this.

Thanks,

Akila.

admin 33 Months Ago (-1) Vote

Hi Akila,

Please post your query in the forum to get a prompt response as well as it is easy to troubleshoot from there.Do attach your myprojects as a zipped file.

http://oraclearea51.com/forums.html?func=showcat&catid=8

Regards

Sudhakar