You are on page 1of 3

Orders: Update

Make a Copy of Your OrderCreatePG


For the most part, a single page update and insert page are identical. Since you already created an
insert page, the quickest way to implement a new corresponding update page with the same items
and underlying view object is to simply copy the page definition and then make any necessary
modifications.
Note:We are using the page copy technique shown here to avoid having you recreate a page that
is virtually identical to one that you have already created. When developing a real product,
however, pages that are this similar should be implemented as a single page with a dynamic user
interface.

Copy OrderCreatePG on the File System


Since the JDeveloper OA Extension does not yet support the ability to "save as" or copy/paste a
page document, you need to use the file system for the following task.
Save all your work and close JDeveloper.
Select your OrderCreatePG.xml document in the Windows Explorer, right-click
and select Copy.
Select the webui directory node, right-click and select Paste. Your new file will be
namedCopy of OrderCreatePG.
Select the new file in the Explorer, right-click and select Rename. Change the name
to OrderUpdatePG.
Start JDeveloper, expand the OA Components category in your project, and select
the Add File toolbar icon to open the Add Files or Directories to <your project
name> dialog. Locate your OrderUpdatePG and select OK to add this file to your
project.
Copy and Change the Create Page Controller
We need to change the controller associated with your new update page.
Open your OrderCreateCO controller in JDeveloper and select File > Save As
from the main menu. Name your new file OrderUpdateCO.
Change the class name in your newOrderCreateCO file to OrderUpdateCO.
Tip: If you forgot to change class name to match the file name and you recompile, you will get a
warning like this: Warning(28,8): class OrderCreateCO is public; should be declared in a file
named OrderCreateCO.java; or the class should be renamed to OrderDescriptionCO to match the
filename.
Select the OrderUpdatePG page's PageLayoutRN region in the JDeveloper
structure pane to open the property inspector.
Change its Controller Class property value from
<yourname>.oracle.apps.demxx.orderentry.webui.OrderCreateCO to

<yourname>.oracle.apps.demxx.orderentry.webui.OrderUpdateCO.
Change its Title property value to Update Order.
Now make a few modifications on the update page as described
Select the MainRN, choose the DateOrdered item from RowOneRN in RowOneLayout.
Set the Read Only property to True (as Order Date should be update-disallowed).

Add an Update Column to the Search Page


In this task, you will add an Update image column to your Orders Results table
Add the "Update" Column to the Results Table
Note that the Update icon should be declaratively configured to perform a form submit when
selected.
Select the ResultsTable in the Structure pane, right-click and select New > Item from context
menu.
Configure this item's properties as follows:
Property Value
ID
UpdateImage
Item Style
image
Attribute Set
/oracle/apps/fnd/attributesets/Buttons/Update
Image URL
updateicon_enabled.gif
Action Type
fireAction
Event
update
Submit
True
Place your cursor in the Parameters property field and select the list of values "..." button.
In the Parameters window, define a parameter whose name is ordNum and whose
value is ${oa.OrderSearchVO.OrderId}.
Select the Add Parameters button and define a second parameter whose name is
custName and whose value is ${oa. OrderSearchVO.CustomerName}.
Select the OK button to create your request parameters.

Modify the OrderSearchCO Controller


Add code to your processFormRequest() method to determine if the Update icon is selected.
if ("update".equals(pageContext.getParameter(EVENT_PARAM)))
{
// The user has clicked an "Update" icon so we want to navigate
// to the first step of the multistep "Update Order" flow.
pageContext.setForwardURL("OA.jsp?page=/<yourname>/oracle/apps/demxx/

orderentry/webui/OrderUpdatePG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true, // Retain AM
OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
OAWebBeanConstants.IGNORE_MESSAGES);
}

Modify the OrderUpdateCO Controller


Now you need to change the logic in the OrderUpdateCO controller to properly support the
update action and page flow.
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
String ordNum = pageContext.getParameter("ordNum");
// We'll use this at the end of the flow for a confirmation message.
String custName = pageContext.getParameter("custName");
pageContext.putTransactionValue("custName", custName);
Serializable[] params = { ordNum };
OAApplicationModule am = pageContext.getApplicationModule(webBean);
// For the update, since we're using the same VO as the "Details" page, we
// can use the same initialization logic.
am.invokeMethod("initDetails", params);
OAMessageRadioButtonBean rb1 =
(OAMessageRadioButtonBean)webBean.findChildRecursive("cashRB");
rb1.setName("paymentTypeRG");
rb1.setValue("CASH");
OAMessageRadioButtonBean rb2 =
(OAMessageRadioButtonBean)webBean.findChildRecursive("checkRB");
rb2.setName("paymentTypeRG");
rb2.setValue("CHECK");
OAMessageRadioButtonBean rb3 =
(OAMessageRadioButtonBean)webBean.findChildRecursive("creditCardRB");
rb3.setName("paymentTypeRG");
rb3.setValue("CHARGE");
// To initialise your PPR components
am.invokeMethod("init");
} // end processRequest

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
If(pageContext.getParameter(Apply)!= null)
{
Am.invokeMethod(SavetoDB);
}
}