o a framework guide comsbined 3
DESCRIPTION
aTRANSCRIPT
Oracle Applications Framework
Demo Order Entry Workshop
Draft 1B
30 December 2006
®
Author
V R Dhinesh Raaj
Technical Contributors
Deepika Vimal
Devi Viswanathan
Pawan Kumar Purbey
Arunkumar Pasupathy
Balachander Ganesh
Sijith Narendran
Varunkumar Vedantham
Reviewers
Dileep Raghavan
Sameer Manglm
Copyright © Oracle Corporation, 2006. All rights reserved.
This documentation contains proprietary information of Oracle Corporation. It isprovided under a license agreement containing restrictions on use and disclosure andis also protected by copyright law. Reverse engineering of the software is prohibited. Ifthis documentation is delivered to a U.S. Government Agency of the Department ofDefense, then it is delivered with Restricted Rights and the following legend isapplicable:
Oracle and all references to Oracle Products are trademarks or registered trademarksof Oracle Corporation.
All other products or company names are used for identification purposes only,andmay be trademarks of their respective owners.
A…………………...
Order Entry Workshop
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-2 Oracle Applications Framework - Order Entry Workshop
Order Entry Workshop Project……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-3
Order Entry Workshop Project
For your laboratory exercises, you’ll build an order entry application.
Database objects and data in tables already exist
OBJECT NAME OBJECT TYPEDEM_CUSTOMERS TABLEDEM_CUSTOMERS_U1 INDEXDEM_ORDERS TABLEDEM_ORDERS_S SEQUENCEDEM_ORDERS_TEMP TABLEDEM_ORDERS_U1 INDEXDEM_ORDER_LINES TABLEDEM_ORDER_LINES_U1 INDEXDEM_PRODUCTS TABLEDEM_PRODUCTS_U1 INDEXDEM_SALES_REPS TABLEDEM_SALES_REPS_U1 INDEX
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-4 Oracle Applications Framework - Order Entry Workshop
Order Page
The workshop has two entities essentially, Orders and Order Lines
Figure 1 Orders Window
Order Page……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-5
Order Page Specifications
Customer Number, Customer Name, Salesperson Name and Currency Code use LOVs.
Order Date and Ship Date use Message Dictionary to give an error message if the dateshipped comes before the order date.
Make the Order Date update-protected.
Currency code field controls currency format in Order Lines window.
Order Lines button opens the Order Lines window.
Payment Method region includes conditional fields controlled by an option group. Thebehavior of fields in the Payment Type region depends on which payment type is selected.
o If Cash is selected, all other fields in the region are disabled.
o If Check is selected, the Number field is enabled. Rest disabled.
o If Credit Card is selected, the cctype, number and expiration date fields are enabled.
o Further, if the credit card type is Visa, the Approval Code is enabled and required.
Order Date and Ship Date provide the Calendar
Order Date by default should be current date.
Order Date should only be current or later dates (that is must protect from making orders on adate that has already passed).
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-6 Oracle Applications Framework - Order Entry Workshop
Order Lines Page
Fig: Order Lines Window
Order Lines Page Specifications
Window title is context-dependent on the order, and dynamically displays the order numberand customer name
A view-link provides master-detail coordination control
Product description and number have related LOVs
Automatically calculate Total Price and a button to calculate the Grand Total.
Order Lines Page……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-7
Order Lines Sub- Tab Region
Figure 2 Order Lines tabs
Alternative regions within tabbed region contain several items
o Quantity, Units, and Prices
o Account
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-8 Oracle Applications Framework - Order Entry Workshop
Order Page Inquiry Features
The end product should contain additional features to allow easy inquiry on orders and orderlines.
Fig: Orders Search Window
Provide only those criteria likely to be used frequently
Order number
Order status
Ship Date
Customer information
Salesperson name
Tables and Predefined Data: Salespeople……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-9
Tables and Predefined Data: Salespeople
The following scripts create your tables, indexes, views, and data.
DECLAREln_found NUMBER(1);
BEGINSELECT 1INTO ln_foundFROM user_tablesWHERE table_name = 'DEM_SALES_REPS';
EXCEPTIONWHEN NO_DATA_FOUND THEN
EXECUTE IMMEDIATE ' CREATE TABLE DEM_SALES_REPS ( '||' sales_rep_id NUMBER (15) NOT NULL '||' ,last_update_date DATE NOT NULL '||' ,last_updated_by NUMBER (15) NOT NULL '||' ,creation_date DATE NOT NULL '||' ,created_by NUMBER (15) NOT NULL '||' ,last_update_login NUMBER (15) NOT NULL '||' ,last_name VARCHAR2 (50) NOT NULL '||' ,first_name VARCHAR2 (50) NOT NULL '||' ,start_date DATE '||' ,commission_plan_code VARCHAR2 (1) '||' ,attribute_category VARCHAR2 (30) '||
' ,attribute1 VARCHAR(150)'||
' ,attribute2 VARCHAR(150) '||' ,attribute3 VARCHAR(150) '||' ,attribute4 VARCHAR(150) '||' ,attribute5 VARCHAR(150) '||' ,attribute6 VARCHAR(150) '||' ,attribute7 VARCHAR(150) '||' ,attribute8 VARCHAR(150) '||' ,attribute9 VARCHAR(150) '||' ,attribute10 VARCHAR(150) '||' ) '||' TABLESPACE SYSTEM '||' PCTFREE 10 PCTUSED 40 '||' INITRANS 1 MAXTRANS 255 '||' STORAGE '||' (INITIAL 65536 '||' MINEXTENTS 1 MAXEXTENTS 2147483645 '||' FREELISTS 1 FREELIST GROUPS 1 '||' ) '||' NOCACHE';
EXECUTE IMMEDIATE ' CREATE UNIQUE INDEX dem_sales_reps_u1 '||' ON dem_sales_reps(sales_rep_id) ';
END;
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-10 Oracle Applications Framework - Order Entry Workshop
/******************************************************************* Populate Salespeople *******************************************************************/
DECLAREln_cnt NUMBER;
BEGIN
SELECT COUNT(*)INTO ln_cntFROM dem_sales_reps;
IF (ln_cnt = 0) THEN--1INSERT INTO dem_sales_reps
(SALES_REP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, LAST_NAME, FIRST_NAME, START_DATE,COMMISSION_PLAN_CODE)
VALUES(1001, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Magee', 'Colin', '14-MAY-90','A');
--2INSERT INTO dem_sales_reps
(SALES_REP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, LAST_NAME, FIRST_NAME, START_DATE,COMMISSION_PLAN_CODE)
VALUES(1002, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Giljum', 'Henry', '18-JAN-92', 'A');
--3INSERT INTO dem_sales_reps
(SALES_REP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, LAST_NAME, FIRST_NAME, START_DATE,COMMISSION_PLAN_CODE)
VALUES(1003, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Sedeghi', 'Yasmin', '18-FEB-91', 'A');
--4INSERT INTO dem_sales_reps
(SALES_REP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, LAST_NAME, FIRST_NAME, START_DATE,COMMISSION_PLAN_CODE)
VALUES(1004, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Nguyen', 'Mai','22-JAN-92', 'A');
--5INSERT INTO dem_sales_reps
(SALES_REP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, LAST_NAME, FIRST_NAME, START_DATE,COMMISSION_PLAN_CODE)
Tables and Predefined Data: Salespeople……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-11
VALUES(1005, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Jones', 'Robert', '23-JUN-95', 'B');
--6INSERT INTO dem_sales_reps
(SALES_REP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, LAST_NAME, FIRST_NAME, START_DATE,COMMISSION_PLAN_CODE)
VALUES(1006, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Dumas', 'Andre', '09-OCT-91','A');
--7INSERT INTO dem_sales_reps
(SALES_REP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, LAST_NAME, FIRST_NAME, START_DATE,COMMISSION_PLAN_CODE)
VALUES(1007, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Lee', 'Vicki','10-OCT-92', 'A');
--8INSERT INTO dem_sales_reps
(SALES_REP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, LAST_NAME, FIRST_NAME, START_DATE,COMMISSION_PLAN_CODE)
VALUES(1008, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Stratton', 'Ruth', '27-JUN-93', 'B');
COMMIT;
END IF;
END;
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-12 Oracle Applications Framework - Order Entry Workshop
Tables and Predefined Data: CustomersDECLARE
ln_found NUMBER(1);BEGIN
SELECT 1INTO ln_foundFROM user_tablesWHERE table_name = 'DEM_CUSTOMERS';
EXCEPTIONWHEN NO_DATA_FOUND THEN
EXECUTE IMMEDIATE ' CREATE TABLE DEM_CUSTOMERS ( '||' customer_id NUMBER (15) NOT NULL '||' ,last_update_date DATE NOT NULL '||' ,last_updated_by NUMBER (15) NOT NULL '||' ,creation_date DATE NOT NULL '||' ,created_by NUMBER (15) NOT NULL '||' ,last_update_login NUMBER (15) NOT NULL '||' ,name VARCHAR2 (50) NOT NULL '||' ,phone VARCHAR2 (25) '||' ,address VARCHAR2 (400) '||' ,city VARCHAR2 (30) '||' ,state_code VARCHAR2 (20) '||' ,country VARCHAR2 (30) '||' ,postal_code VARCHAR2 (75) '||' ,credit_rating VARCHAR2 (9) '||' ,sales_rep_id NUMBER (15) '||' ,region_id NUMBER (15) '||' ,comments VARCHAR2 (255) '||' ,attribute_category VARCHAR2 (30) '||' ,attribute1 VARCHAR(150) '||' ,attribute2 VARCHAR(150) '||' ,attribute3 VARCHAR(150) '||' ,attribute4 VARCHAR(150) '||' ,attribute5 VARCHAR(150) '||' ,attribute6 VARCHAR(150) '||' ,attribute7 VARCHAR(150) '||' ,attribute8 VARCHAR(150) '||' ,attribute9 VARCHAR(150) '||' ,attribute10 VARCHAR(150) '||' ) '||' TABLESPACE SYSTEM '||' PCTFREE 10 PCTUSED 40 '||' INITRANS 1 MAXTRANS 255 '||' STORAGE '||' (INITIAL 65536 '||' MINEXTENTS 1 MAXEXTENTS 2147483645 '||
Tables and Predefined Data: Customers……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-13
' FREELISTS 1 FREELIST GROUPS 1 '||' ) '||' NOCACHE';
EXECUTE IMMEDIATE ' CREATE UNIQUE INDEX dem_customers_u1 '||' ON dem_customers(customer_id) ';
END;
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-14 Oracle Applications Framework - Order Entry Workshop
/******************************************************************* Populate Customers *******************************************************************/
DECLAREln_cnt NUMBER;
BEGINSELECT COUNT(*)INTO ln_cntFROM dem_customers;
IF (ln_cnt = 0)THEN--1INSERT INTO dem_customers
(CUSTOMER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, NAME, PHONE, ADDRESS, CITY, STATE_CODE,POSTAL_CODE, COUNTRY, CREDIT_RATING, SALES_REP_ID, REGION_ID, COMMENTS)
VALUES(201, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Unisports', '55-2066101', '72Mill Water','Milpitas', 'CA', '95035', 'USA', 'EXCELLENT', 1001, 2,'Brother of owner!');
--2INSERT INTO dem_customers
(CUSTOMER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, NAME, PHONE, ADDRESS, CITY, STATE_CODE,POSTAL_CODE, COUNTRY, CREDIT_RATING, SALES_REP_ID, REGION_ID, COMMENTS)
VALUES(202, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Womansport','1-206-104-0103','3281 King Street','Seattle', 'WA', '98101', 'USA', 'GOOD', 1001, 2,'');
--3INSERT INTO dem_customers
(CUSTOMER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, NAME, PHONE, ADDRESS, CITY, STATE_CODE,POSTAL_CODE, COUNTRY, CREDIT_RATING, SALES_REP_ID, REGION_ID, COMMENTS)
VALUES(203, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Tornado Sports', '1-913-661-9699', '11629 West 113th Street','Overland Park', 'KS', '66210', 'USA','GOOD', 1005, 3, 'Windy Accounts Payable Clerk');
--4INSERT INTO dem_customers
(CUSTOMER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, NAME, PHONE, ADDRESS, CITY, STATE_CODE,POSTAL_CODE, COUNTRY, CREDIT_RATING, SALES_REP_ID, REGION_ID, COMMENTS)
VALUES(204, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Big Johns Sports', '1-415-555-6281', '4783 18th Street','San Francisco', 'CA', '94117', 'USA','EXCELLENT', 1002, 3, '');
--5INSERT INTO dem_customers
(CUSTOMER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE,CREATED_BY, LAST_UPDATE_LOGIN, NAME, PHONE, ADDRESS, CITY, STATE_CODE,POSTAL_CODE, COUNTRY, CREDIT_RATING, SALES_REP_ID, REGION_ID, COMMENTS)
Tables and Predefined Data: Customers……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-15
VALUES(205, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Ski USA','1-913-555-2637', '10 Ward Parkway','Kansas City', 'MO', '66214', 'USA','POOR', 1004, 3, 'Insist upon cash');
COMMIT;
END IF;
END;
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-16 Oracle Applications Framework - Order Entry Workshop
Tables and Predefined Data: ProductsDECLARE
ln_found NUMBER(1);BEGIN
SELECT 1INTO ln_foundFROM user_tablesWHERE table_name = 'DEM_PRODUCTS';
EXCEPTIONWHEN NO_DATA_FOUND THEN
EXECUTE IMMEDIATE ' CREATE TABLE DEM_PRODUCTS ( '||' product_id NUMBER (15) NOT NULL '||' ,last_update_date DATE NOT NULL '||' ,last_updated_by NUMBER (15) NOT NULL '||' ,creation_date DATE NOT NULL '||' ,created_by NUMBER (15) NOT NULL '||' ,last_update_login NUMBER (15) NOT NULL '||' ,description VARCHAR2(255) NOT NULL '||' ,suggested_price NUMBER (25) '||' ,unit_of_measure VARCHAR2 (25) '||' ,attribute_category VARCHAR2 (30) '||' ,attribute1 VARCHAR(150) '||' ,attribute2 VARCHAR(150) '||' ,attribute3 VARCHAR(150) '||' ,attribute4 VARCHAR(150) '||' ,attribute5 VARCHAR(150) '||' ,attribute6 VARCHAR(150) '||' ,attribute7 VARCHAR(150) '||' ,attribute8 VARCHAR(150) '||' ,attribute9 VARCHAR(150) '||' ,attribute10 VARCHAR(150) '||' ) '||' TABLESPACE SYSTEM '||' PCTFREE 10 PCTUSED 40 '||' INITRANS 1 MAXTRANS 255 '||' STORAGE '||' (INITIAL 65536 '||' MINEXTENTS 1 MAXEXTENTS 2147483645 '||' FREELISTS 1 FREELIST GROUPS 1 '||' ) '||' NOCACHE';
EXECUTE IMMEDIATE ' CREATE UNIQUE INDEX dem_products_u1 '||' ON dem_products(product_id) ';
END;
/******************************************************************* Populate Products *
Tables and Predefined Data: Products……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-17
******************************************************************/
DECLAREln_cnt NUMBER;
BEGIN
SELECT COUNT(*)INTO ln_cntFROM dem_products;
IF (ln_cnt = 0) THEN--1INSERT INTO dem_products(PRODUCT_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, DESCRIPTION, SUGGESTED_PRICE, UNIT_OF_MEASURE)
VALUES(10011, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Beginner ski boot', 150.00,'Pair');
--2INSERT INTO dem_products(PRODUCT_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, DESCRIPTION, SUGGESTED_PRICE, UNIT_OF_MEASURE)
VALUES(10012, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Ace Ski Boot -- Intermediateski boot', 200.00, 'Pair');
--3INSERT INTO dem_products(PRODUCT_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, DESCRIPTION, SUGGESTED_PRICE, UNIT_OF_MEASURE)
VALUES(10013, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Pro Ski Boot -- Advanced skiboot', 410.00, 'Pair');
--4INSERT INTO dem_products(PRODUCT_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, DESCRIPTION, SUGGESTED_PRICE, UNIT_OF_MEASURE)
VALUES(10021, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Bunny Ski Pole -- Beginnersski pole', 16.25, 'Pair');
--5INSERT INTO dem_products(PRODUCT_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, DESCRIPTION, SUGGESTED_PRICE, UNIT_OF_MEASURE)
VALUES(10022, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Ace Ski Pole -- Intermediateski pole', 21.95, 'Pair');
--6INSERT INTO dem_products(PRODUCT_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, DESCRIPTION, SUGGESTED_PRICE, UNIT_OF_MEASURE)
VALUES
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-18 Oracle Applications Framework - Order Entry Workshop
(10023, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Advanced ski pole', 40.95,'Pair');
--7INSERT INTO dem_products(PRODUCT_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, DESCRIPTION, SUGGESTED_PRICE, UNIT_OF_MEASURE)
VALUES(10031, '23-JUN-95', 1, '23-JUN-95', 1, 1, 'Ultra Ski Goggles -- UV-blocking ski goggles', 30.95, 'Pair');
COMMIT;
END IF;
END;
Tables and Predefined Data: Orders……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-19
Tables and Predefined Data: OrdersDECLARE
ln_found NUMBER(1);BEGIN
SELECT 1INTO ln_foundFROM user_tablesWHERE table_name = 'DEM_ORDERS';
EXCEPTIONWHEN NO_DATA_FOUND THEN
EXECUTE IMMEDIATE ' CREATE TABLE DEM_ORDERS( '||' order_id NUMBER (15) NOT NULL '||' ,last_update_date DATE NOT NULL '||' ,last_updated_by NUMBER (15) NOT NULL '||' ,creation_date DATE NOT NULL '||' ,created_by NUMBER (15) NOT NULL '||' ,last_update_login NUMBER (15) NOT NULL '||' ,customer_id NUMBER (15) NOT NULL '||' ,sales_rep_id NUMBER (15) '||' ,payment_type VARCHAR2 (6) NOT NULL '||' ,currency_code VARCHAR2 (15) NOT NULL '||' ,order_status VARCHAR2 (1) NOT NULL '||' ,date_ordered DATE '||' ,date_shipped DATE '||' ,check_number NUMBER (15) '||' ,cc_type VARCHAR2 (1) '||' ,cc_number VARCHAR2 (30) '||' ,cc_expiration VARCHAR2 (5) '||' ,cc_approval_code VARCHAR2 (15) '||' ,order_note VARCHAR2 (2000) '||' ,attribute_category VARCHAR2 (30) '||' ,attribute1 VARCHAR(150) '||' ,attribute2 VARCHAR(150) '||' ,attribute3 VARCHAR(150) '||' ,attribute4 VARCHAR(150) '||' ,attribute5 VARCHAR(150) '||' ,attribute6 VARCHAR(150) '||' ,attribute7 VARCHAR(150) '||' ,attribute8 VARCHAR(150) '||' ,attribute9 VARCHAR(150) '||' ,attribute10 VARCHAR(150) '||' ) '||' TABLESPACE SYSTEM '||' PCTFREE 10 PCTUSED 40 '||' INITRANS 1 MAXTRANS 255 '||' STORAGE '||
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-20 Oracle Applications Framework - Order Entry Workshop
' (INITIAL 65536 '||' MINEXTENTS 1 MAXEXTENTS 2147483645 '||' FREELISTS 1 FREELIST GROUPS 1 '||' ) '||' NOCACHE ';
EXECUTE IMMEDIATE ' CREATE UNIQUE INDEX dem_orders_u1 '||' ON dem_orders(order_id) ';
END;
Tables and Predefined Data: Orders……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-21
/******************************************************************* Populate Orders *******************************************************************/
DECLAREln_cnt NUMBER;
BEGIN
SELECT COUNT(*)INTO ln_cntFROM dem_orders;
IF (ln_cnt = 0) THEN
--1INSERT INTO dem_orders(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(1, '17-SEP-95', -1, '23-AUG-95', 1236, 0, 201, 1001,'CASH', 'USD', 'F','23-AUG-95', '', '', '', '', '', '');
--2INSERT INTO dem_orders(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(2, '17-SEP-95', -1, '23-AUG-95', 1236, 0, 202, 1001, 'CHECK', 'ZZZ', 'N','23-AUG-95', '', '1201', '', '', '', '');
--3INSERT INTO dem_orders(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(3, '29-AUG-95', -1, '29-AUG-95', -1, 0, 202, 1005, 'CHARGE', 'USD', 'F','02-JUL-95', '03-JUL-95', '', 'V', '1234 5678 9012', '05/97', '01');
--4INSERT INTO dem_orders(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(5, '29-AUG-95', -1, '29-AUG-95', -1, 0, 201, 1006, 'CASH', 'USD', 'N','29-AUG-95', '', '', '', '', '', '');
--5INSERT INTO dem_orders
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-22 Oracle Applications Framework - Order Entry Workshop
(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(6, '31-AUG-95', -1, '31-AUG-95', -1, 0, 201, 1004,'CHARGE', 'USD', 'N','31-AUG-95', '', '', 'E', '1234 5678 9012', '09 97', '');
--6INSERT INTO dem_orders(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(7, '31-AUG-95', -1, '31-AUG-95', -1, 0, 204, 1005, 'CASH', 'USD', 'N','31-AUG-95', '', '', '', '', '', '');
--7INSERT INTO dem_orders(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(8, '31-AUG-95', -1, '31-AUG-95', -1, 0, 202, 1008, 'CASH', 'USD', 'N','31-AUG-95', '', '', '', '', '', '');
--8INSERT INTO dem_orders(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(13, '17-SEP-95', -1, '17-SEP-95', -1, 0, 203, 1005,'CHECK', 'USD', 'F','11-SEP-95', '17-SEP-95', '751', '', '', '', '');
--9INSERT INTO dem_orders(ORDER_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY,LAST_UPDATE_LOGIN, CUSTOMER_ID, SALES_REP_ID, PAYMENT_TYPE, CURRENCY_CODE,ORDER_STATUS, DATE_ORDERED, DATE_SHIPPED, CHECK_NUMBER, CC_TYPE,CC_NUMBER, CC_EXPIRATION, CC_APPROVAL_CODE)
VALUES(14, '17-SEP-95', -1, '17-SEP-95', -1, 0, 205, 1008, 'CHARGE', 'USD', 'N','12-AUG-95', '21-AUG-95', '', 'V', '3456 7654 2345 9087', '07/97', '101');
COMMIT;
END IF;END;
Tables and Predefined Data: Order Lines……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-23
Tables and Predefined Data: Order LinesDECLARE
ln_found NUMBER(1);BEGIN
SELECT 1INTO ln_foundFROM user_tablesWHERE table_name = 'DEM_ORDER_LINES';
EXCEPTIONWHEN NO_DATA_FOUND THEN
EXECUTE IMMEDIATE ' CREATE TABLE DEM_ORDER_LINES( '||' order_id NUMBER (15) NOT NULL '||' ,order_line_num NUMBER (15) NOT NULL '||' ,last_update_date DATE NOT NULL '||' ,last_updated_by NUMBER (15) NOT NULL '||' ,creation_date DATE NOT NULL '||' ,created_by NUMBER (15) NOT NULL '||' ,last_update_login NUMBER (15) NOT NULL '||' ,product_id NUMBER (15) NOT NULL '||' ,gl_account_cc_id NUMBER (38) '||' ,ordered_quantity NUMBER (15) '||' ,attribute_category VARCHAR2 (30) '||' ,attribute1 VARCHAR(150) '||' ,attribute2 VARCHAR(150) '||' ,attribute3 VARCHAR(150) '||' ,attribute4 VARCHAR(150) '||' ,attribute5 VARCHAR(150) '||' ,attribute6 VARCHAR(150) '||' ,attribute7 VARCHAR(150) '||' ,attribute8 VARCHAR(150) '||' ,attribute9 VARCHAR(150) '||' ,attribute10 VARCHAR(150) '||' ) '||' TABLESPACE SYSTEM '||' PCTFREE 10 PCTUSED 40 '||' INITRANS 1 MAXTRANS 255 '||' STORAGE '||' (INITIAL 65536 '||' MINEXTENTS 1 MAXEXTENTS 2147483645 '||' FREELISTS 1 FREELIST GROUPS 1 '||' ) '||' NOCACHE';
EXECUTE IMMEDIATE ' CREATE UNIQUE INDEX dem_order_lines_u1 '||' ON dem_order_lines(order_id,order_line_num) '; END;
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-24 Oracle Applications Framework - Order Entry Workshop
/******************************************************************* Populate Order-Lines *******************************************************************/DECLAREln_cnt NUMBER;
BEGINSELECT COUNT(*)INTO ln_cntFROM dem_order_lines;
IF (ln_cnt = 0) THEN
--1INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(1, 1, '29-AUG-95', -1, '23-AUG-95', 1236, 0, 10011, 1);
--2INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(2, 1, '30-AUG-95', -1, '23-AUG-95', 1236, 0, 10021, 3);
--3INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(2, 2, '29-AUG-95', -1, '23-AUG-95', 1236, 0, 10031, 2);
--4INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(3, 1, '29-AUG-95', -1, '29-AUG-95', -1, 0, 10022, 2);
--5INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(3, 2, '29-AUG-95', -1, '29-AUG-95', -1, 0, 10013, 4);
--6INSERT INTO dem_order_lines
Tables and Predefined Data: Order Lines……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-25
(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(3, 3, '29-AUG-95', -1, '29-AUG-95', -1, 0, 10012, 7);
--7INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(5, 1, '29-AUG-95', -1, '29-AUG-95', -1, 0, 10012, 2);
--8INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(6, 1, '31-AUG-95', -1, '31-AUG-95', -1, 0, 10013, 3);
--9INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(6, 2, '31-AUG-95', -1, '31-AUG-95', -1, 0, 10011, 5);
--10INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(6, 3, '31-AUG-95', -1, '31-AUG-95', -1, 0, 10031, 1);
--11INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(7, 1, '31-AUG-95', -1, '31-AUG-95', -1, 0, 10013, 1);
--12INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(8, 1, '31-AUG-95', -1, '31-AUG-95', -1, 0, 10013, 2);
--13INSERT INTO dem_order_lines
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-26 Oracle Applications Framework - Order Entry Workshop
(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(13, 1, '17-SEP-95', -1, '17-SEP-95', -1, 0, 10031, 1);
--14INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(13, 2, '17-SEP-95', -1, '17-SEP-95', -1, 0, 10013, 3);
--15INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(14, 1, '17-SEP-95', -1, '17-SEP-95', -1, 0, 10012, 10);
--16INSERT INTO dem_order_lines(ORDER_ID, ORDER_LINE_NUM, LAST_UPDATE_DATE, LAST_UPDATED_BY,CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, PRODUCT_ID,ORDERED_QUANTITY)
VALUES(14, 2, '17-SEP-95', -1, '17-SEP-95', -1, 0, 10023, 10);
COMMIT;END IF;
END;
Register Flexfield Tables……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-27
Register Flexfield Tables
You may have to do this at a later stage if a Descriptive Flexfield has to be registered to yourcustom Application (which you will register in the next step).REM+=============================================================+REM This script only registers the DEM_ORDERS and DEM_ORDER_LINESREM tables, as they are the only tables with flexfield columnsREM that are actually used in the class (even though the otherREM tables have flexfield columns)REM+=============================================================+
REM **************************************************************REM Delete registration of columns in Orders tableREM **************************************************************
EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'ORDER_ID');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'LAST_UPDATE_DATE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'LAST_UPDATED_BY');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CREATION_DATE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CREATED_BY');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'LAST_UPDATE_LOGIN');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CUSTOMER_ID');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'SALES_REP_ID');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'PAYMENT_TYPE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CURRENCY_CODE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'ORDER_STATUS');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'DATE_ORDERED');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'DATE_SHIPPED');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CHECK_NUMBER');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CC_TYPE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CC_NUMBER');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CC_EXPIRATION');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'CC_APPROVAL_CODE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'ORDER_NOTE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE_CATEGORY');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE1');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE2');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE9');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE10');
REM **************************************************************REM Delete registration of Orders tableREM **************************************************************
EXECUTE ad_dd.delete_table('DEMXX', 'DEM_ORDERS');COMMIT;
REM **************************************************************REM Register Orders table and columnsREM **************************************************************
EXECUTE ad_dd.register_table('DEMXX', 'DEM_ORDERS','T',8,10,90);EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'ORDER_ID',1, 'NUMBER',15, 'N', 'N');
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-28 Oracle Applications Framework - Order Entry Workshop
EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'LAST_UPDATE_DATE', 2,'DATE', 9, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'LAST_UPDATED_BY', 3,'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CREATION_DATE', 4,'DATE', 9, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CREATED_BY', 5,'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'LAST_UPDATE_LOGIN', 6,'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CUSTOMER_ID',7,'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'SALES_REP_ID',8,'NUMBER', 15, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'PAYMENT_TYPE',9,'VARCHAR2', 6, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CURRENCY_CODE', 10,'VARCHAR2', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'ORDER_STATUS',11,'VARCHAR2', 1, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'DATE_ORDERED',12,'DATE', 9, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'DATE_SHIPPED',13,'DATE', 9, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CHECK_NUMBER',14,'NUMBER', 15, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CC_TYPE',15, 'VARCHAR2',1, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CC_NUMBER',16,'VARCHAR2', 30, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CC_EXPIRATION', 17,'VARCHAR2', 5, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'CC_APPROVAL_CODE', 18,'VARCHAR2', 15, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'ORDER_NOTE', 19,'VARCHAR2', 2000, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE_CATEGORY', 20,'VARCHAR2', 30, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE1',21,'VARCHAR2', 150, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE2',22,'VARCHAR2', 150, 'Y', 'N');...EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE9',29,'VARCHAR2', 150, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDERS', 'ATTRIBUTE10',30,'VARCHAR2', 150, 'Y', 'N');COMMIT;
REM **************************************************************REM Delete registration of columns in Order Lines tableREM **************************************************************
EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'ORDER_ID');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'ORDER_LINE_NUM');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'LAST_UPDATE_DATE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'LAST_UPDATED_BY');
Register Flexfield Tables……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-29
EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'CREATION_DATE');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'CREATED_BY');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'LAST_UPDATE_LOGIN');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'PRODUCT_ID');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'GL_ACCOUNT_CC_ID');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'ORDERED_QUANTITY');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE_CATEGORY');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE1');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE2');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE9');EXECUTE ad_dd.delete_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE10');
REM **************************************************************REM Delete registration of Order Lines tableREM **************************************************************
EXECUTE ad_dd.delete_table('DEMXX', 'DEM_ORDER_LINES');COMMIT;
REM **************************************************************REM Register Order Lines table and columnsREM **************************************************************
EXECUTE ad_dd.register_table('DEMXX', 'DEM_ORDER_LINES','T',8,10,90);EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'ORDER_ID', 1,'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'ORDER_LINE_NUM', 2,'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'LAST_UPDATE_DATE',3, 'DATE', 9, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'LAST_UPDATED_BY',4, 'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'CREATION_DATE', 5,'DATE', 9, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'CREATED_BY', 6,'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'LAST_UPDATE_LOGIN',7, 'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'PRODUCT_ID', 8,'NUMBER', 15, 'N', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'GL_ACCOUNT_CC_ID',9, 'NUMBER', 15, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'ORDERED_QUANTITY',10, 'NUMBER', 15, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES','ATTRIBUTE_CATEGORY', 11, 'VARCHAR2', 30, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE1', 12,'VARCHAR2', 150, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE2', 13,'VARCHAR2', 150, 'Y', 'N');...EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE9', 20,'VARCHAR2', 150, 'Y', 'N');EXECUTE ad_dd.register_column('DEMXX', 'DEM_ORDER_LINES', 'ATTRIBUTE10', 21,'VARCHAR2', 150, 'Y', 'N');COMMIT;
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-30 Oracle Applications Framework - Order Entry Workshop
Oracle Applications Setup
Register a New Applications User
You may have to first get the Oracle Applications Instance details from your instructor and loginas a user with System Administrator responsibility.
Select the System Administrator Responsibility
Now choose Security : User > Define
User Name: DEMxx (xx – Unique Identifier such as your Employee ID)
Password: welcome (you may have to enter the same password again)
Description: Demo Order Entry OAF User
In the Direct Responsibilities tab, select System Administrator, ApplicationDeveloper and Framework Toolbox Tutorial responsibilities.
Save and exit.
Logout from Oracle Applications
Login as DEMxx user and reset your password when prompted
Register a Custom Application
Register your custom application by selecting Application > Register in the ApplicationDeveloper responsibility.
Key in your
o Application Name: Order Entry Demo xx(xx- could be a unique identifier such as Employee ID)
o Short name: DEMxx
o Base path: DEM_TOP (or CUST_TOP as provided by instructor)
Oracle Applications Setup……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-31
Register Messages in the Message Dictionary
We use the Message Dictionary to display errors, warnings and confirmations. Therefore we haveto create our messages in the Message Dictionary before we start with the workshop.
Logon to Oracle Apps as sysadmin and add the Application Developer responsibility to yourusername.
Now logon with your username and password and navigate to Application Developerresponsibility.
Select Application > Messages
You can register all your messages here with your Custom Application name
MESSAGE NAME MESSAGE TEXTORDLINES_CCAPPCODE_ENTER Please enter your Approval Code for Visa.ORDLINES_CCTYPE_INVALID Please choose a valid Credit Card TYPE from the
drop-down.ORDLINES_DATE_PAST Invalid. DATE from past chosen. Please choose a
valid date.ORDLINES_HDR_TEXT Order Details for &CUST_NAMEORDLINES_INVALID_LINE_NUMBER Invalid Order NumberORDLINES_LINESHDR_TITLE Order Lines &CUST_NAME, &ORD_NUMORDLINES_LINES_CREATE_CONFIRM Order Lines created successfully for Order
&ORD_NUMBER.ORDLINES_LINES_UPDATE_CONFIRM Order Lines updated successfully for Order
&ORD_NUMBER.ORDLINES_OBJECT_NOT_FOUND Object (&OBJECT_NAME) not foundORDLINES_ORDER_DELETE_WARN Are you sure you want to delete order
&ORD_NUMORDLINES_ORDER_ID_UNIQUE Order ID must be UniqueORDLINES_ORDER_NO NoORDLINES_ORDER_SHIP_BAD Please choose a Ship Date greater than the Order
Date.ORDLINES_ORDER_YES YesORDLINES_ORDSTATUS_INVALID Please enter a valid Order StateORDLINES_ORD_CREATE_CONFIRM Order &ORD_NUMBER created successfully.ORDLINES_ORD_DELETE_CONFIRM Order &ORD_NUM deleted successfully.ORDLINES_ORD_ID_NO_UPDATE Cannot Update Order IDORDLINES_ORD_UPDATE_CONFIRM Order &ORD_NUMBER updated successfully.ORDLINES_PAGE_GENERAL This is the instruction text for the Page. We may
include our Page Help details if any here.ORDLINES_QUANTITY_ORDERED Please enter a value greater than zero for Quantity
Ordered.ORDLINES_STATUS_REQUIRED Order Status is required.ORDLINES_CHECK_NO_BAD Please enter a valid Cheque Number if your
Appendix A: Order Entry Workshop………………………………………………………………………………………………………
………………………………………………………………………………………………………A-32 Oracle Applications Framework - Order Entry Workshop
MESSAGE NAME MESSAGE TEXTpayment mode is Cheque.
ORDLINES_LINE_ID_UNIQUE Duplicate Order-Line Number encountered. Pleaseensure Line Number is unique.
Register Lookups
We use lookups to display drop-downs/list-boxes.
o In your Application Developer responsibility, select Application : Lookups >Application Object Library.
o You can register all your lookups here with your Custom Application name as follows:
o Type: CCTYPE_LOOKUP
o Meaning: Credit Card Type Lookup
CODE MEANINGA American ExpressE Euro CardV Visa
o Type: ORDER_STATUS_LOOKUP
o Meaning: Order Status Lookup
CODE MEANINGN NewP Partly FilledF Filled
Register Descriptive Flexfields
We use descriptive flexfields (DFF) to display to capture additional information.
o In your Application Developer responsibility, select Flexfield : Descriptive> Register.
o Query for your Table Name (DEM_ORDERS).
o If a DFF already registered in this table name, make note of the Name. (We would needthe DFF name and the application name to which it is registered)
o If a DFF is not registered for this table, you can register your DFFs here with your CustomApplication. (You should first register your flexfield tables DEM_ORDERS andDEM_ORDER_LINES with your application as mentioned in the earlier section).
o Application: Order Entry Demo xx
Oracle Applications Setup……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Order Entry Workshop A-33
o Name: DEM_ORDERS
o Title: Demo Orders xx
o Description: Orders DFF for Order Entry Workshop
o Table Application: Order Entry Demo xx
o Table Name: DEM_ORDERS
o Structure Column: ATTRIBUTE_CATEGORY
o DFV View Name: DEM_ORDERSxx_DFV
Similarly we can register a flexfield for DEM_ORDER_LINES if it does not exist.
o Application: Order Entry Demo xx
o Name: DEM_ORDER_LINES
o Title: Demo Orders xx
o Description: Order Lines DFF for Order Entry Workshop
o Table Application: Order Entry Demo xx
o Table Name: DEM_ORDERS
o Structure Column: ATTRIBUTE_CATEGORY
o DFV View Name: DEM_ORDER_LINESxx_DFV
B…………………...
Practices
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-2 Oracle Applications Framework - Practices
Lab 1: Building and Running ‘Hello, World!’……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-3
Lab 1: Building and Running ‘Hello, World!’
1. Set Up Your Development Environment
a. Configure JDEV_USER_HOME Environment Variable on Your PC
2. Create a New OA Workspace and Empty OA Project with the New... Dialog
3. Set Run Options in OA Project Settings
4. Create the OA Components Page File
5. Modify the Page Layout (Top-level) Region
6. Create the Second Region (Main Content Region)
7. Create the First Item (Empty Field)
8. Create a Container Region for the Go Button
9. Create the Second Item (Go Button)
10. Save Your Work
11. Run Your Page Using the Run Option
12. Add a Controller
13. Edit Your Controller
14. Build Your Controller
15. Test Your Work Using the Run Option
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-4 Oracle Applications Framework - Practices
Hello World Page – End Product
Lab 2: Orders: Search……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-5
Lab 2: Orders: Search
1: Create Your Project
1. Create an Oracle Applications (OA) Project
2. Enable Developer Diagnostics
3. Organize Your Project Into Categories
2: Create Your Page's Model Components
1. Create the BC4J Package for Client (UI) Objects
2. Create the BC4J Package for Server (Business Logic) Objects
3. Create Your Root UI Application Module (AM)
4. Enable Passivation for the Root UI Application Module
5. Save Your Work
6. Create an Orders Entity Object (EO)
7. Create an OrderSearchVO View Object (VO)
8. Add Your View Object to the Root UI Application Module
3: Create Your Initial Page
1. Create the OrderSearchPG Page
2. Modify the pageLayout Region
3. Add a Product Branding Image
4. Create the Page Instruction Text
5. Test Your Work
4: Configure a Results-Based Search
1. Add a Query Bean to Your Page
2. Add a Results Data Table to Your QueryRN
3. Set or Verify Your ResultsTable Region Properties
4. Set or Verify OrderId Item Properties
5. Set or Verify OrderStatus Item Properties
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-6 Oracle Applications Framework - Practices
6. Set or Verify CustomerId Item Properties
7. Set or Verify CustomerName Item Properties
8. Set or Verify DateShipped Item Properties
9. Set or Verify SalesRepName Item Properties
10. Test Your Work
5: Convert Your Search Region to Use Auto Customization Criteria
1. Change the Query Bean to Use autoCustomizationCriteria
2. Add a Simple Search Region
3. Create an OrderId Search Item
4. Create an Order Status Search Item
5. Create a DateShipped Search Item
6. Create an CustomerId Search Item
7. Create an CustomerName Search Item
8. Create an SalesRepName Search Item
9. Create Search Mappings Between Search Items and ResultsTable
10. Test Your Work
6: Adding a List of Values (LOV) to a Field
1. Create the BC4J Package for Your LOV-Related Model Objects
2. Create a Common LOV Application Module
a. Create the Customer LOV View Object
b. Add the CustomerLovVO to the OrderEntryLovAM
c. Create the SalesRep LOV View Object
d. Add the SalesRepLovVO to the OrderEntryLovAM
3. Create the Shared CustomerLovRN LOV Region
Add a Table to the LOV Region
4. Create the Shared SalesRepLovRN LOV Region
Add a Table to the LOV Region
Lab 2: Orders: Search……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-7
5. Make the Customer Id Search Item an LOV
Define LOV Mappings
6. Make the Customer Name Search Item an LOV
Define LOV Mappings
7. Make the Salesperson Name Search Item an LOV
Define LOV Mappings
8. Test Your Work
Orders: Search – End Product
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-8 Oracle Applications Framework - Practices
Lab 3: Orders: Drilldown to Details
1: Create the Details Page View Object
1. Create the OrderDetailsVO View Object
2. Add Your View Object to the Root UI Application Module
3. Save Your Work
2: Create the Details Page UI
1. Create the OrderDetailsPG Page
2. Modify the pageLayout Region
3. Add a Product Branding Image
4. Create the Main Content Region
5. Finish Setting MainRN Item Properties
6. Change the Main Region's Style
7. Add a messageLayout
8. Add a "Return to Orders: Search Page" Link
9. Save Your Work
3: Implement the View Object Query
1. Add an initQuery( ) Method to Your OrderDetailsVOImpl Class
2. Add an initDetails( ) Method to Your OrderEntryAMImpl Class
3. Save and Compile Your Work
4: Implement the Drilldown to the OrderDetailsPG
1. Configure the OrderId Item as a Link
2. Create a Controller for the Details Page
3. Add Controller Logic to Initalize Order Query When Page Renders
4. Programmatically Set the Page Title Text
5. Save and Test Your Work
Lab 3: Orders: Drilldown to Details……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-9
Fig 1: Order Number in Order Search Page configured for drilldown
Fig 2: Drilldown : Order Details Page – End Product
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-10 Oracle Applications Framework - Practices
Lab 4: Orders: Create
1: Revise Search Page to Include Create Order Button
1. Add ‘Create Order’ Button to Your Search Page
2. Add ‘Create Order’ Button Press Handler
3. Compile and Save Your Work
2: Create a View Object for the Order Status Poplist
1. Create a Poplist View Object BC4J Package
2. Create the OrderStatusVO in the Poplist BC4J Package
3. Add the OrderStatusVO to the OrderEntryAM
4. Create the CcTypeVO in the Poplist BC4J Package
5. Add the CcTypeVO to the OrderEntryAM
6. Compile and Save Your Work
3: Build the Create Page
1. Create the OrderCreatePG Page
2. Modify the pageLayout Region
3. Add a Product Branding Image
4. Add Page-Level Apply and Cancel Buttons
5. Create the Main Content Region
6. Finish Setting MainRN Item Properties
7. Focus on Layout
a. Convert the MainRN Style from defaultSingleColumn toMessageComponentLayout
b. Create a new messageComponentLayout Region for PaymentTypeRN
c. Create a new messageComponentLayout Region for FooterRN
d. Adjusting the Layout for MainRN
e. Adjusting the Layout for PaymentTypeRN
f. Adjusting the Layout for FooterRN
Lab 4: Orders: Create……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-11
8. Add an "Indicates Required Field" Region
4: Implement Browser Back Button Safe Page Initialization andcreate/rollback Methods
1. Add a createOrderEntry( ) Method to OrderEntryAMImpl Class
2. Add a rollbackOrder( ) Method to Your OrderEntryAMImpl Class
3. Add Back Button Handling to the OrderSearchCO processRequest( )
4. Add Create Page Initialization
5. Test Your Work
5: Implement Order Business Logic
(Part 1: Declarative Validation and Initialization)
1. Lay down your Business Needs
2. Add Import Statements
3. Override the setOrderId( ) Method
4. Override the create( ) Method
5. Save and Test Your Work
6: Implement Order Business Logic
(Part 2: Entity Expert, VAM and VVO Validation)
1. Create an Order Validation Application Module
2. Register the Order Validation Application Module with OrderEO Entity Object
3. Create a OrderStatus Validation View Object
4. Add OrderStatusVVO to OrderVAM Validation Application Module
5. Add an initQuery( ) Method to OrderStatusVVO Validation View Object
6. Create an Entity Expert Class
7. Associate the Entity Expert with the OrderEO Entity Object
8. Add a Convenience Method for Expert Access in OrderEOImpl Class
9. Add the isOrderStatusValid( ) Method to the Entity Expert
10. Add Validation Logic to setOrderStatus( ) Method in OrderEOImpl Class
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-12 Oracle Applications Framework - Practices
11. Compile and Test Your Work
7: Implement Order Business Logic
(Part 3: Miscellaneous Attributes)
1. Add Logic to setDateShipped() Method;
2. Add a validateDateShipped () Method
3. Save and Test Your Work
8: Implement Order Business Logic
(Part 4: Entity-Level Validation)
1. Add Logic to validateEntity()
2. Compile and Save Your Work
9: Implement the Apply and Cancel Button Handling
1. Create an apply( ) Method in Your OrderEntryAMImpl Class
2. Add processFormRequest( ) Logic to Your OrderCreateCO Class
3. Test Your Work
Fig 1: Orders Search Page: Create button included
Lab 4: Orders: Create……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-13
Fig 2: Orders Create Page – End Product
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-14 Oracle Applications Framework - Practices
Lab 5: Orders: Partial Page Rendering (PPR)
1: Create an "Application Properties" View Object
1. Create the OrderEntryPVO View Object and necessary Transient Atrributes.
2. Add the OrderEntryPVO View Object to the OrderEntryAM
2: Configure the PPR Items to Fire a PPR Action When Changed
1. Set the PPR Properties for Cash RadioButton
2. Set the PPR Properties for Cheque RadioButton
3. Set the PPR Properties for Credit Card RadioButton
4. Set the PPR Properties for Credit Card Type Dropdown
3: Configure the PPR Field Items to React to PPR Events
1. SPEL Bind the needed PPR Field Items
4: Implement PPR Event Handling
1. Add PPR Handling Methods (Enable/Disable) to the OrderEntryAMImpl
2. Add an init( ) Method to the OrderEntryAM
3. Call the init( ) Method from processRequest( )
4. Handle PPR Event
5. Test Your Work
Lab 5: Orders: Partial Page Rendering (PPR)……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-15
Figure 1: Create Page Finished Product initially renders as follows
Figure 2: A Closer look at the Payment Type region when the page renders first time
Figure 3: A Closer look at the Payment Type region when Credit Card radio button is chosen
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-16 Oracle Applications Framework - Practices
Lab 6: Orders: Delete
1: Implement a Delete in Your OrderEOImpl Class
1. Add the remove method( )
2: Implement a Delete Switcher
1. Add an Attribute to the OrderSearchVO View Object
2. Create the Switcher Region
3. Configure the Default Switcher Case
4. Create a New Switcher Case
5. Format the Delete Column
6. Test Your Work
3: Implement the Delete Action
1. Add a deleteOrder( ) Method to the OrderEntryAM
2. Add Delete Selection Handler Code to OrderSearchCO
3. Add Delete Confirmation Handler Code to OrderSearchCO
4. Test Your Work
Figure 1: Order Search page: Delete column Included
Lab 6: Orders: Delete……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-17
Figure 2: Orders Search Page – The ResultsTable Region When Queried
Figure 3: Delete Warning Dialog
Figure 4: Delete Confirmation Message
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-18 Oracle Applications Framework - Practices
Lab 7: Orders: Update
1: Make a Copy of Your OrderCreatePG
1. Copy OrderCreatePG on the File System
2. Copy and Change the Create Page Controller
3. Compile and Save Your Work
2: Add an Update Column to the Search Page
1. Add the "Update" Column to the Results Table
2. Modify the OrderSearchCO Controller
3. Modify the OrderUpdateCO Controller
4. Rebuild and Test Your Work
Fig 1: Order Search Page: Update column included
Lab 8: Lines: Search……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-19
Lab 8: Lines: Search
1: Create Your Page's Model Components
1. Create a Lines Entity Object (EO)
2. Create an Order to Lines Association Object
3. Create a LinesSearchVO View Object (VO)
4. Add the LinesSearchVO View Object to the OrderEntryAM
2: Create Your Initial Page
1. Create the LinesSearchPG Page
2. Modify the pageLayout Region
3. Add a Product Branding Image
4. Create the Page Instruction Text
5. Test Your Work
3: Configure a Results-Based Search
1. Add a Query Bean to Your Page
2. Add a Results Data Table to Your QueryRN
3. Set or Verify Your ResultsTable Region Properties
4. Set or Verify OrderId Item Properties
5. Set or Verify OrderLineNum Item Properties
6. Set or Verify ProductId Item Properties
7. Set or Verify Description Item Properties
8. Set or Verify GlAccountCcId Item Properties
9. Set or Verify OrderedQuantity Item Properties
10. Set or Verify SuggestedPrice Item Properties
11. Set or Verify UnitOfMeasure Item Properties
12. Set or Verify TotalPrice Item Properties
13. Test Your Work
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-20 Oracle Applications Framework - Practices
4: Convert Your Search Region to Use Auto Customization Criteria
Before you proceed with Task 4, arrange your items
1. Change the Query Bean to Use autoCustomizationCriteria
2. Add a Simple Search Region
3. Create an OrderId Search Item
4. Create an OrderLineNum Search Item
5. Create a ProductId Search Item
6. Create a Description Search Item
7. Create Search Mappings Between Search Items and ResultsTable
8. Test Your Work
5: Adding a List of Values (LOV) to a Field
1. Create the Product LOV View Object
2. Add the ProductLovVO to the OrderEntryLovAM
3. Create the Shared ProductLovRN LOV Region
4. Add a Table to the LOV Region
5. Make the Product Id Search Item an LOV
6. Define LOV Mappings
7. Make the Description Search Item an LOV
8. Define LOV Mappings
9. Test Your Work
6: Revise the Search Page to Include a Goto Order Search Button
1. Add a ‘Goto Order Search’ Button to Your Search Page
2. Add ‘Goto Order Search’ Button Press Handler to Your Search Page
Lab 8: Lines: Search……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-21
Revise Details Page to Include Link to Lines Search
7: Implement the View Object Query
1. Add an initQuery() Method to Your LinesSearchVOImpl Class.
2. Add an initLinesDetails( ) Method to Your OrderEntryAMImpl Class.
3. Save and Compile Your Work
8: Implement the Drilldown to the LinesSearchPG
1. Configure the OrderId Item as a Link
2. Mofify the Controller Logic to Initalize Order Query When Page Renders
3. Save and Compile Your Work
Figure 1: Lines Search Page – End Product
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-22 Oracle Applications Framework - Practices
Lab 9: Lines: Create
1: Create a View Object for the Create Page
1. Create a LinesDetailsVO View Object (VO)
2. Create a OrderToLinesVL View Link (VL)
3. Add the LinesDetailsVO to OrderEntryAM
2: Build the Create Page
1. Create the LinesCreatePG Page
2. Modify the pageLayout Region
3. Add a Product Branding Image
4. Add Page-Level Apply and Cancel Buttons
5. Create the Content Region
6. Set up Your LOVs
7. Add a ‘Add Another Row’ Button and a ‘Recalculate Toal Price’ Button
8. Add a ‘Single Selection’ with a ‘Delete’ Button
9. Add an "Indicates Required Field" Region
10. Add an initQuery() to LinesDetailsVO
11. Add the initTableQuery() to OrderEntryAMImpl
12. Set the Controller for the PageLayoutRN
13. Add ‘Add Another Row’ Button Handling to LinesDetailsCO processRequest( )
14. Configure OrderLines Button Click
15. Save and Test Your Work
3: Implement Browser Back Button Safe Page Initialization andcreate/rollback Methods
1. Add a createOrderLineEntry( ) Method to OrderEntryAMImpl Class
2. Add a rollbackOrderLine( ) Method to OrderEntryAMImpl Class
3. Add Back Button Handling to the OrderCreateCO processRequest( )
4. Test Your Work
Lab 9: Lines: Create……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-23
4: Implement Order Business Logic
(Part 1: Declarative Validation and Initialization)
1. Lay down your Business Needs
2. Add Import Statements
3. Add Create Page Initialization
4. Add Validation Logic to the setOrderedQuantity( ) Method;
5. Add a validateOrderedQuantity( ) Method
6. Save and Test Your Work
5: Implement the Apply, Cancel and Delete Button Handling
1. Add processFormRequest( ) Logic to LinesCreateCO Class
2. Programatically Set the Page Title Text
3. Handle Line Number Uniqueness
4. Handle Delete Button
5. Test Your Work
Fig 1: Lines Create Page: End Product
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-24 Oracle Applications Framework - Practices
Lab 10: Lines: Partial Page Rendering (PPR)
1: Create an OrderEntryPVO View Object Attribute
Create the Transient Attributes in OrderEntryPVO View Object
2: Configure OrderedQuantity to Fire a PPR Event
Set the PPR Properties for Quantity Ordered field
3: Configure Items to React to PPR Events
SPEL Bind the necessary PPR field Items.
4: Implement PPR Event Handling
1. Add PPR Logic to the Handle the PPR Action in OrderEntryAM
2. Modify init( ) Method in the OrderEntryAM
3. Call the init( ) Method from processRequest( )
4. Handle PPR Event
5. Test Your Work
Figure 1: A Closer look at the PPR Items and Quantity Ordered field before firing PPR
Figure 2: Note the difference in the PPR items after firing PPR event on Quantity Ordered field
Lab 11: Lines: Layout……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-25
Lab 11: Lines: Layout
1: Modify your Lines Create Page Layout
1. Create the Sub-tab Layout Region
2. Modify the LinesCreateCO
3. Delete Button Handling
4. Rebuild and test your work
Figure 3 Lines Create: Quantity Tab
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-26 Oracle Applications Framework - Practices
Figure 4 Accounts Tab
Lab 12: Lines: Update……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-27
Lab 12: Lines: Update
1: Make a Copy of Your LinesCreatePG
1. Copy LinesCreatePG on the File System
2. Copy and Change the Create Page Controller
3. Compile and Save Your Work
2: Modify Search and Update Page Controllers
1. Modify the LinesSearchCO Controller
2. Modify the LinesUpdateCO Controller
3. Rebuild and Test Your Work
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-28 Oracle Applications Framework - Practices
Lab 13: Flexfields
1: Implement your Orders DFF
1. Setup your Orders Flexfield in Orders Create and Update Pages
Create a DFF Layout and column, and set appropriate properties
2. Compile and Test Your Work
Fig: Orders DFF Field Customer Contact Name included
2: Implement your Lines DFF
1. Setup your Order Lines Flexfield in Lines Create and Update Pages
Create a DFF Layout and column, and set appropriate properties
2. Compile and Test Your Work
Fig: Lines DFF Field Additional Preference included
Lab 14: Deploying the project in Oracle Applications……………………………………………………………………………………………………….
……………………………………………………………………………………………………….Oracle Applications Framework - Practices B-29
Lab 14: Deploying the project in Oracle Applications
1. Transfer your class files in zip format to the server
2. Add the classpath entry in jserv.properties
3. Bounce the Apache server
4. In Oracle Apps, create your Function to call the OA Page.
5. Add the function to a menu and responsibility
6. Add the responsibility to your user.
7. Import the pages, which you want to deploy
Appendix B: Practices………………………………………………………………………………………………………
………………………………………………………………………………………………………B-30 Oracle Applications Framework - Practices
Lab 15: Testing and Reviewing Your Pages
1. Test your form for about fifteen minutes to make sure that your form is built to specificationsand that your form features all work correctly. Test for (at least):
Querying master and details works correctly.
Inserts work correctly
Updates work correctly (update only your own inserted records)
Deletes of master and/or details work correctly (update only your own inserted records)
LOVs all work and appear correctly
Order ID populates on insert
Tabbed regions work correctly
Opening and closing of windows works correctly
Flexfields work correctly
Messages, validation logic on date fields work correctly
Find window on Orders works correctly
Function security works correctly
2. Do a fifteen-minute user interface review of the form belonging to the team with the nextlower team number (Team 01 review the highest-numbered team). Use your manuals andyour class notes to help you. List some things the team can do to improve the user interface(especially cosmetics) of their form. Discuss yourfindings with that team when you finish.
a ________________________________________________
b ________________________________________________
c ________________________________________________
d ________________________________________________
C…………………...
Practices and Solutions
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-2 Oracle Applications Framework - Practices and Solutions
OA Framework: DEMO ORDER ENTRY………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-3
OA Framework: DEMO ORDER ENTRY
Overview
The Order Entry Workshop introduces developers to the process of building an OA Frameworkapplication using Jdeveloper 9i (9.0.3) and deploying it on the web. Fundamental knowledge ofOA Framework concepts like MVC Architecture, BC4J (Business Component for Java), EntityObjects (EO), View Objects (VO), Application Modules (AM), OA Controllers is a pre-requisiteto help you enhance your understanding in building an OA Framework application.
This workshop consists of an Orders page, which captures information about orders placed bythe customer and Order Lines page providing lines details for the corresponding order. It helpsyou build simple pages, which are capable of querying, creating, updating and deleting records inthe database. For additional information, it is recommended that you refer the OracleApplications Framework Developers Guide11.5.10 and Online ‘Help Topics’ provided byJDeveloper.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-4 Oracle Applications Framework - Practices and Solutions
Lab 1: Building and Running "Hello, World!"
This tutorial leads you through using Oracle9i JDeveloper OA Extension 9.0.3.8 to create a verysimple page. This tutorial has minimal explanation and as few steps as possible (and no BC4J).
Hello, World Lab Goals
After completing this exercise, you should have learned how to:
Create an Oracle Applications (OA) JDeveloper9i workspace and project.
Configure a project to enable Developer Mode testing and diagnostics.
Use the JDeveloper9i OA Extension to create a very simple page.
Create a controller and associate it with a region.
Handle a submit button press action (an HTTP POST request).
Run a page in regular and debug modes.
The resulting page has the global links (such as Preferences, Logout, and Return to Portal), aheader, footer, a Personalize Region link, one empty field and one Go button. The page doesnothing other than display a message when you enter a value in the field and click the Go button.Your final layout looks like the following:
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-5
Note that there are several profile options that control features such as personalization, the visualappearance of global links, and other features, so what you see may be different from the pictureabove. Differences you are most likely to encounter are not seeing the Personalize Region link,seeing button icons above the corresponding global links, or not seeing certain global links suchas Customize (if personalization is not enabled for your username).
Prerequisite: Set Up Your Development Environment
If it has not been done already, complete the tasks outlined in Setting Up Your DevelopmentEnvironment.
You should also consult the Oracle9i JDeveloper OA Extension FAQ for the latesttroubleshooting information.
Configure the JDEV_USER_HOME Environment Variable on Your PC
Windows 2000
Select My Computer on your desktop, right-click and select Properties.
In the System Properties dialog, select the Advanced tab.
In the Advanced page, select the Environment Variables… button.
In the Environment Variables dialog, select the New... button at the User variablesfor <username> box.
o In the New User Variable dialog,Enter JDEV_USER_HOME in the VariableName field.
o Set the Variable Value field to point to your jdev directory (ex:D:\jdevhome\jdev)
Warning: The variable value should not contain a leading space before the drivename. If it does, your environment will not work properly.
Select OK in each of the dialogs you opened to save the new user environmentvariable.
Get Tutorial.zip File and Extract
Open the D:\jdev\Tutorial.zip file with WinZip.
Extract Tutorial.zip to <JDEVHOME> (it will create jdev subdirectory for you) toget:
o D:\jdev\jdevhome\jdev\myhtml
o D:\jdev\jdevhome\jdev\myprojects
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-6 Oracle Applications Framework - Practices and Solutions
Start JDeveloper and Verify Installation
Launch Oracle 9i Jdeveloper.
Open the OA Framework Toolbox Tutorial workspace file by selecting File > Openfrom the main menu.
o Navigate to <JDEV_USER_HOME>\myprojects and open the filetoolbox.jws.
In the JDeveloper System Navigator, expand the toolbox.jws to display its contents.
o In the System Navigator, select the Tutorial.jpr project and select Project >Project Settings.
In the Project Settings dialog, expand the Oracle Applications node and selectRuntime Connection.
Verify that the DBC file shown in the Connection box matches the database whereyou instructor directs you to work.
If you need to change it: Use the Browse... button to locate the appropriate DBC file(the file should be in the <drive>:\users\dbc_files\secure\ directory. It can beobtained from the server under $FND_TOP/secure
The User Name and Password should be specified for an Oracle Applications userthat has responsibility "Framework Toolbox Tutorial" attached to it
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-7
Expand the Connections node in the JDeveloper System Navigator,
o Then expand the Database node.
o Right-click on the Database node
o Select New Connection... to open the Connection Wizard.
o Follow the JDeveloper instructions to define a new database connection forthe Oracle Applications database identified by the DBC file you selectedabove.
In the System Navigator, select the Tutorial.jpr project again.
o Right-click and select Edit Business Components Project....
In the Business Components Project Wizard, select the Connection option and setthe Connection Name to the connection you just defined.
Select OK to save your changes.
Repeat all steps described above for the LabSolutions.jpr project.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-8 Oracle Applications Framework - Practices and Solutions
In the System Navigator, select toolbox.jws and select Project > Rebuild toolbox.jwsfrom the main menu. You should get 0 errors (warnings are OK and expected).
Expand the HTML Sources category beneath Tutorial.jpr
o Select test_fwktutorial.jsp
o Select Run > Run test_fwktutorial.jsp from the main menu.
The Test Framework Toolbox Tutorial page displays a list of lesson links.
o Select Hello, World! to run a very simple page.
If you cannot run the Hello, World! Page, please revisit the steps listed above toensure that you completed everything correctly.
Make Sure You Have a Working Data Source
Your data source is the database you'll be developing against. You'll need a connection to thedatabase to access the Repository and BC4J objects during development.
Note: The test_<varies>.jsp file (included with the Tutorial.zip) contains connection informationfor running your project within JDeveloper (assuming you are using the dev115 database).
For Oracle Applications Division developers, Repository metadata information and objectsneeded for BC4J, such as tables, are in the same database (although you will not be using theRepository for the Hello World example). If the database you use for development is not in thelist of database connections, please file a bug with Development Services.
If you have completed the development environment setup, including unpacking and running thelatest Tutorial.zip (in your JDEV_USER_HOME directory), when you open up JDeveloper forthe first time you should open the toolbox.jws workspace using File > Open on the main menu).
Warning: Do not import modifications to any Toolbox metadata to the Repository in thedatabase. This metadata in the database is shared by everyone using the Toolbox Lessons inthe same database, and modifying this metadata can make them inoperable.
Note that you can modify your own copies of the Toolbox XML files so long as you do notimport them into the database. Importing to the Repository in the database is a separate processthat uses a command-line interface.
Warning: Any Toolbox application data that you type into a Toolbox form and save will beshared by everyone using these applications, so be cautious about entering or modifying anydata.
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-9
Create a New OA Workspace and Empty OA Project with the New Dialog
Select File > New to open the New... dialog (shown in the following diagram). This dialog isalso called the New Object Gallery.
Choose General > Workspace Configured for Oracle Applications from the New... dialog, orhighlight Workspaces in the Navigator and choose New OA Workspace... from the context menu(right mouse button menu that changes depending on the context).
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-10 Oracle Applications Framework - Practices and Solutions
You'll be prompted to create an OA workspace. Verify that the default workspace directory namepoints to your own <JDEV_USER_HOME>\myprojects directory, as shown in the followingdiagram. Modify the workspace file name as well (any name is okay for a workspace, such asHelloWorldOAWorkspace.jws). Check the Add a New OA Project check box.After you clickOK, you will see the Oracle Applications Project Wizard.
In Step 1 of the wizard, verify that the default project directory name points to your ownJDEV_USER_HOME\myprojects directory, as shown in the following diagram. Modify theproject file name as well (any name is okay for a project, such as HelloWorldOAProject.jpr). Setthe default package name to the following (where "hello" is the component):
oracle.apps.icx.hello
Note: For this exercise and for all later lab exercises, you must use the exact package, page,region, item and variable names specified in the instructions, because the instructions depend onhaving these names. Specifically, you must use oracle.apps.... in your package names for the labseven if you are an Oracle Applications customer or partner (though you would use <3rd partyidentifier>.oracle.apps.... in production objects you create).
For your Hello World project, you do not use the Repository for metadata in the database (theHello World example uses only the XML files). In regular development work, where you usestandard components that have been imported into the Repository, you would check the UseRepository for Design Time check box and provide connection information in Step 2.
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-11
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-12 Oracle Applications Framework - Practices and Solutions
In Step 3 of the wizard, adjust the runtime connection information, if necessary, for the databaseand Oracle Applications username, password, and responsibility you are using (it must be avalid user and responsibility for your installation).
Set Run Options in OA Project Settings
To verify that your project includes all of the appropriate libraries, paths and other settings,select your project in the Navigator and choose Project Settings from the context menu, ordouble-click on your project.
Select the Common > Oracle Applications > Run Options settings page.
Select OADeveloperMode and OADiagnostic, and move them to the On Options List.
OADeveloperMode provides extra code checking and standards checking at runtime.OADiagnostic enables the Diagnostics button in the global buttons at the top of the page,overriding any corresponding profile option set for the application. You should always havethese two modes turned on during development. The other modes are generally used for testingtowards the end of developing your page, and are fully described in Chapter 7.
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-13
Create the OA Components Page File
Within your new workspace, select your new project (your .jpr file). To add an OA Componentspage file to your project, choose New from the context menu or use File > New... on the mainmenu to open the New dialog.
Select Web Tier > OA Components in the Categories column. Then select Page, and press OKas shown in the following diagram:
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-14 Oracle Applications Framework - Practices and Solutions
You will then see a dialog box that asks for the name and package file for your new page. Thisdialog box is shown in the following diagram:
Name your page HelloWorldPG. Your page name cannot include any spaces.
In the Package field, type the following:
oracle.apps.icx.hello.webui
Your package file name (which determines the location of the XML page file in the directorystructure) should be set to oracle.apps.<application_shortname>.<optional_modulename>.<optional_subcomponent>.webui (to comply with Oracle Applications directory structurestandards), where the application shortname is lowercase and is an existing Oracle Applications
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-15
product shortname, such as INV. Note that pages migrated from old AK pages may use adifferent directory structure (pages instead of webui).Be sure to follow the package name,directory location and object naming standards in the OA Framework File / Package / DirectoryStructure standards.
Your initial page structure appears in the Structure window as shown below, with an initialpageLayout region called region1, and a folder called pageLayout Components. The pageLayoutComponents folder contains a standard corporate branding image ("Oracle") that you cannotchange (though you can add other elements).
Modify the Page Layout (Top-level) Region
JDeveloper creates your top-level page layout region for you automatically when you create yourpage.
If the Property Inspector is not already open, select View > Property Inspector from the mainmenu. You can alternate between the alphabetical list of properties and the categorized list byclicking on the Categories button at the top of the Property Inspector (shown above withcategories enabled). Set the following properties for your page layout region:
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-16 Oracle Applications Framework - Practices and Solutions
Set the ID property to PageLayoutRN.
Verify that the Region Style property is set to pageLayout.
Verify that the Form property is set to True.
Verify that the Auto Footer property is set to True.
Set the Window Title property to <your name>: Hello World Window Title. Thisbecomes the window title for the page.
Set the Title property to <your name>: Hello World Page Header. This becomes thepage header for the page (it appears under the blue bar).
Set the AM Definition property to:oracle.apps.fnd.framework.server.OAApplicationModule(you will have to type in the value).This is a generic application module supplied by the OA Framework.
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-17
Create the Second Region (Main Content Region)
Create your second region under the page layout region by selecting the page layout region in theStructure window and choosing New > Region from the context menu
This region is merely going to provide a container for your items and ensure that the items areproperly indented. Set the following properties for your second region:
Replace the default value in the ID property with MainRN.
Set the Region Style property to messageComponentLayout (this provides an indentedsingle- or multiple-column layout for the child items of the region.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-18 Oracle Applications Framework - Practices and Solutions
If you want to, you can run your page at this point. You will see the global links, the copyrightand privacy footer elements, and your page header text.
Create the First Item (Empty Field)
Create your first item under the second region (main content region) by selecting the secondregion in the Structure window and choosing New > messageTextInput from the context menu.
Set the following properties for your item:
Set the ID property to HelloName.
Verify that your Item Style property is set to messageTextInput (this style provides a textlabel and an input field).
Set the Prompt property to Name (in the later labs, you will use an attribute set to set theprompt).
Set the Length to 20.
Set the Maximum Length to 50.
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-19
You can run your page at this point.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-20 Oracle Applications Framework - Practices and Solutions
Create a Container Region for the Go Button
To add a non-message*-type bean such as a submitButton to a messageComponentLayoutregion, you must first add the bean to a messageLayout region.
Select the messageComponentLayout region and select New > messageLayout.
Name this region ButtonLayout.
Create the Second Item (Go Button)
Create your Go button item by selecting the messageLayout region, ButtonLayout, in theStructure window and choosing New > Item from the context menu.
Set the following properties for your button item:
Set the value of the ID property to Go.
Set the Item Style property to submitButton.
Set the Attribute Set property to /oracle/apps/fnd/attributesets/Buttons/Go.
Note that you can search for this attribute set, even though the attribute set file is notpart of your project, by choosing the Search in: Entire MDS XML path option butnot selecting the Show Components in Same Scope Only check box. You can use/oracle/apps/fnd/attributesets/ and % as criteria for your search.
Verify that the Prompt property is now set to Go (this is your button label, inheritedfrom the attribute set).
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-21
If you want to, you can run your page at this point.
Save Your Work
Save your work. Using the menu choice File > Save All will save your metadata changes to anXML file as well as save all your other file changes (such as to a .jsp or .java file).
Tip: Though it usually will not be written out as a separate step in the exercises, you should saveyour work frequently.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-22 Oracle Applications Framework - Practices and Solutions
Run Your Page Using the Run Option
You can try out your page using the Run option on the context menu.
If you are using a database other than what you already have in your project settings, you willneed to modify the Runtime Connection project settings by selection your project file andchoosing Project Settings ... from the main menu. Specifically, you must use a combination ofUsername, Password, (Responsibility) Application Short Name and Responsibility Key that isvalid for your database to enable your session to log in.
You can use the Run option in the context menu to test your page in a standard browser. Thisoption allows you to test your layout as well as functionality such as handling button presses.Select your page or page layout region in the Structure window, and choose Run from thecontext menu.
Alternatively, you can select your page in the Navigator window, and choose Run <page name>from the context menu. You may have to wait a few minutes or more before you see your page ina separate browser window (it often takes longer the first time). If your page does not appearafter a few minutes, or gives errors, check the messages in the Log window. See the Hello,World! Troubleshooting Guide or the Oracle9i JDeveloper OA Extension FAQ.
Your page should look like the following picture (with your own name in the page header andwindow title). You should see your page header, your Name field, and your Go button, alongwith global links and buttons (some global buttons may not appear depending on profile optionsettings). You may or may not see a Personalize Region link below your page header, dependingon profile option settings. Do not personalize this page, as personalizations are data driven andyou will affect anyone else building the Hello World page on the same database.
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-23
Each time you make changes to your layout (by adding regions or items, modifying properties,or changing code), you must run your page again to see your changes. If the Run process seemsto hang for several minutes after you have already run your page previously, you may need toterminate the OC4J server using the Run > Terminate > Embedded OC4J Server main menuoption, and then run again.
Add a Controller
Add a controller to display a message when the user clicks on the Go button. Select your secondregion (MainRN) and choose Set New Controller... from the context menu.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-24 Oracle Applications Framework - Practices and Solutions
Give your controller the package name oracle.apps.icx.hello.webui and an appropriate classname, such as HelloWorldMainCO, and click OK.
Edit Your Controller
Edit your controller code as follows:
Add the following line as the last line of the import section to make the OA FrameworkOAException routines available: import oracle.apps.fnd.framework.OAException;
Lab 1: Building and Running "Hello, World!"………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-25
Code the processFormRequest() method to match the following (making sure to match the itemIDs you chose):
public void processFormRequest(OAPageContext pageContext, OAWebBeanwebBean){super.processFormRequest(pageContext, webBean);if (pageContext.getParameter("Go") != null){String userContent = pageContext.getParameter("HelloName");String message = "Hello, " + userContent + "!";throw new OAException(message, OAException.INFORMATION);
}}
Note that hardcoding a message text string is not translatable and would not be acceptable in areal Oracle Applications product. Normally you would define your message in MessageDictionary and call it from your code using its message name using the OAException routine.
Build Your Controller
Build your controller by selecting Rebuild from the context menu within the code editor window.
Test Your Work Using the Run Option
Save your work, then test it using the Run option. Type something into your field and then clickthe Go button. You should see the your page with an informational message that contains whatyou typed into the field, as shown:
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-26 Oracle Applications Framework - Practices and Solutions
You have finished your first page with Oracle9i JDeveloper and the OA Framework!
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-27
Lab 2: Orders: Search
Overview
In this exercise, we will be implementing a simple search and results page as shown in Figure 1below. Eventually, we will add the ability to view, create and delete orders.
Figure 1: Search Page Exercise Finished Product
1: Create Your Project
As a prerequisite, ensure that your database connection is ready. If not, do the following:
Expand the Connections node in the JDeveloper System Navigator,
Then expand the Database node.
Right-click on the Database node
Select New Connection to open the Connection Wizard.
Follow the JDeveloper instructions to define a new database connection for the OracleApplications database identified:
You have to provide a connection name, username and password, and the host/port details givento you by the instructor.
1.1 Create an Oracle Applications (OA) Project
This is the project where we will create all our lab work.
Note: All the packages and object or file names (directory paths, classes, methods, pages,regions, and UI components) that you specify in the Order Entry exercises must exactly matchthose given in the instructions, with the exception that <yourname> should be your full name
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-28 Oracle Applications Framework - Practices and Solutions
(such as nitinpaul), a similar unique name (such as npaul), or your Global UID(preferably choosethis), or an instructor-supplied name(for instructor led training).
Create a new OA Workspace, select File > New from the main menu, in the Generalmenu choose Workspace Configured for Oracle Applications, and select OK.
In the window that pops up
o Check if the directory name isDrive_name:\<your JDEV_USER_HOME>\myprojects
o In the file name field, fill in OrderEntry.jws
o Ensure that Add a New OA Project checkbox is checked.
If the Welcome page appears, select Next.
Change (or verify) the Directory Name field to your directory<your JDEV_USER_HOME>\myprojects
Change the File Name field to OrderEntry.jpr.
Set the Default Package field to <yourname>.oracle.apps.demxx.orderentry
(In place of xx use your Employee Number)
Select Next and check the “Use repository at design time" check box, and select thedatabase connection that you defined
Select Next to define the runtime connections
Verify your connection information and adjust it if necessary. Unless your instructortells you otherwise, set the following:
Field ValueDBC File Name If this does not default correctly, set this to the correct DBC
file name identified for the current environment.For customers, consultants and others working with localJDeveloper installs, your DBC files are located in your<JDEV_USER_HOME>\myhtml\OA_HTML\secure directoryas described in Setting Up Your Development Environment.Load the DBC file corresponding to the Oracle APPS Instancethat you are working on.
User Name DemxxPassword <Passwd>Application Short Name ICXResponsibility Key FWK_TBX_TUTORIAL
Click the Finish button to create your project.
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-29
1.2 Enable Developer Diagnostics
As a general rule you should ensure that the developer test mode and OA diagnostics are enabledin your projects to help you identify various coding standards violations and leverage the AOL/Jlogging feature.
Select the OrderEntry.jpr project in the Navigator, right-click and select ProjectSettings... from the context menu.
In the Project Settings page, choose Common > Oracle Applications > RunOptions.
Select OADeveloperMode and OADiagnostic, and shuttle them to the SelectedOptions if they aren't there already.
Select OK to exit the Project Settings window.
1.3 Organize Your Project Into Categories
It is far easier to manage and navigate a large project when the files are categorized. Forexample, Figure 2 shows a part of the ToolBox Tutorial project without categorization. All thefiles are listed in alphabetical order regardless of file type.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-30 Oracle Applications Framework - Practices and Solutions
Figure 2: Uncategorized Project in JDeveloper Navigator
If you select the Show Categories toolbar button as shown above, the project's files are organizedas shown in Figure 3.
Figure 3: Categorized Project in JDeveloper Navigator.
Tip: You can also toggle Project > Show Categories in the JDeveloper main menu.
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-31
2: Create Your Page's Model Components
In this task, you'll create the initial standards-compliant packages and objects that make up themodel in your OrderEntry Model-View-Controller (MVC) application.
2.1 Create the BC4J Package for Client (UI) Objects
Create a new Business Components for Java (BC4J) package to contain your user interface (UI)related application modules, view objects and view links.
Select the OrderEntry.jpr project in the Navigator, right-click and select New BusinessComponents Package...from the context menu.
If the Welcome page appears in the Business Components Package Wizard, select Next.
Enter <yourname>.oracle.apps.demxx.orderentry.server as the package name.
For instance:
Fig 4: Create new BC4J package
Verify that the radio button Entity Objects mapped to database schema objects isselected.
Select Next twice.
Select the Finish button to create the package.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-32 Oracle Applications Framework - Practices and Solutions
2.2 Create the BC4J Package for Server (Business Logic) Objects
Create a new BC4J package for entity objects, association objects, validation applicationmodules and validation view objects.
Select the OrderEntry.jpr project in the Navigator, right-click and select New BusinessComponents Package... from the context menu.
If the Welcome page appears in the Business Components Package Wizard, select Next.
Enter <yourname>.oracle.apps.demxx.schema.server as the package name.
Verify that the radio button Entity Objects mapped to database schema objects is selected(you will not be able to create your entity object in this package if you fail to do this).
Select the Finish button to create the package.
2.3 Create Your Root UI Application Module (AM)
Create a new Application Module (AM) to be used as the root UI application module for yourpage.
Select the <yourname>.oracle.apps.demxx.orderentry.server BC4J package in theNavigator, right-click and select New Application Module... from the context menu toopen the Application Module (AM) wizard.
If the Welcome page appears, select Next.
In the Name page, specify OrderEntryAM as the AM name and verify that the Packageis <yourname>.oracle.apps.demxx.orderentry.server.
Click the Next button until you get to Step 4 of 4.
In the Java page, select the Generate Java File(s) checkbox.
Select the Finish button to create the AM.
Note: The packages have been split into orderentry.server and schema.server for betterclassification. orderentry.server will contain the components that involve UI and schema.serverwill contain components that interact with the database. This classification is not mandatory butit is followed to get a better understanding.
2.4 Enable Passivation for the Root UI Application Module
Passivation should be enabled for all root UI application modules.
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-33
Note that passivation is not fully supported in release 11.5.10 production; this is included forpreview purposes.
Select the OrderEntryAM application module in the Navigator, right-click and selectEdit OrderEntryAM... from the context menu.
In the Application Module Wizard, navigate to the Properties page.
In the Name field enter RETENTION_LEVEL.
In the Value field enter MANAGE_STATE.
Warning: you must match the case and spelling exactly as shown.
Select the Add button.
Select the Apply button.
Select the OK button to close the Application Module Wizard window.
2.5 Save Your Work
Save your work using the menu option File > Save All will save your metadata change to anXML file and save all your other file changes (such as to a .jsp or .java file).
Tip: Though it will not be written out as a separate step from here on, you should save yourwork frequently: at least at the end of each task.
2.6 Create an Orders Entity Object (EO)
Create an entity object (EO) for the DEM_ORDERS table in the OA Framework OrderEntryschema.
Tip: Most of the BC4J wizards allow you to resize the wizard window, even though there maynot be visible resize controls. This is helpful for viewing long values and SQL statements.
Select the <yourname>.oracle.apps.demxx.schema.server BC4J package in theNavigator, right-click and select New Entity Object... from the context menu to open theEntity Object wizard.
If the Welcome page appears, select Next.
In the Name page:
o Enter OrderEO in the Name field.
o Verify that the Package is <yourname>.oracle.apps.demxx.schema.server.
o In the Schema Object field, enter DEM_ORDERS. You must type this name
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-34 Oracle Applications Framework - Practices and Solutions
correctly. Otherwise, you can check the Synonyms check box (so both Tables andSynonyms are checked) and choose the correct name from the list.
Select the Next button twice to navigate to the Attribute Settings page (note that all thetable's columns are automatically included as attributes, which complies with the OAFramework Model Coding Standards for Entity Objects.
Verify that the OrderId attribute's Primary Key check box is selected. Do not change anyother default settings.
Select the Next button.
In the Java page, select the Generate Java File check box for the Entity Object Class:OrderEOImpl (you will add business logic to this Java file in a later exercise).
In the Generate Methods region, check the Accessors, Create Method, ValidationMethod and Remove Method check boxes.
Select the Next button.
In the Generate page, deselect the Generate Default View Object check box (or, verifythat it is not selected).
Select the Finish button to create your EO.
Select your EO, right-click and select Edit OrderEO...
Select the Tuning tab. Check the Use Update Batching checkbox and set the Thresholdfield value to 100.
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-35
2.7 Create an OrderSearchVO View Object (VO)
Create a summary-level view object including only those attributes that you need for the Orderssearch results table. This view object is the main view object for your Search page. It shouldleverage the OrderEO (per the OA Framework Model Coding Standards for View Objects, allbut the simplest view objects for things like poplists, lists of values and so on should be based onentity objects).
Select the <yourname>.oracle.apps.demxx.orderentry.server BC4J package in theNavigator, right-click and select New View Object... from the context menu to open theView Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify OrderSearchVO as the view object's name and verify that thePackage is <yourname>.oracle.apps.demxx. orderentry.server.
Select the Next button.
In the Entity Objects page, select the OrderEO in the Available list and shuttle it to theSelected list.
Select the Next button.
In the Attributes page, select the following attributes from the Available list and shuttlethem to the Selected list From OrderEO:
o OrderId
o CustomerId
o SalesRepId
o DateShipped
o OrderStatus
Select the Next button twice.
At this point the query should look like the following in the Query page (without theformatting we've used here to improve readability):SELECT OrderEO.ORDER_ID,OrderEO.CUSTOMER_ID,OrderEO.SALES_REP_ID,OrderEO.DATE_SHIPPED,OrderEO.ORDER_STATUSFROM DEM_ORDERS OrderEO
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-36 Oracle Applications Framework - Practices and Solutions
Select the Expert Mode checkbox. This allows you to edit the generated query.
In the Query Statement text box modify the query so it looks like the followingSELECT OrderEO.ORDER_ID,OrderEO.CUSTOMER_ID,OrderEO.SALES_REP_ID,OrderEO.DATE_SHIPPED,OrderEO.ORDER_STATUS,DemCust.NAME AS CUSTOMER_NAME,DemSale.FIRST_NAME||' '||DemSale.LAST_NAME AS SALES_REP_NAMEFROM DEM_ORDERS OrderEO,DEM_CUSTOMERS DemCust,DEM_SALES_REPS DemSaleWHERE OrderEO.CUSTOMER_ID = DemCust.CUSTOMER_IDAND OrderEO.SALES_REP_ID = DemSale.SALES_REP_ID(+)
Note: The Customer name and sales rep name are obtained in the VO for displaypurpose. The outer join on the sales rep id is to ensure that the order is displayed even ifthe sales rep is not specified for the order.
When you are finished with your editing, select the Test button to ensure your syntax iscorrect.
Select the Next button.
In the Attribute Mappings page, verify that your view object attributes map to thecorrect query columns. If you need to make any changes, place your cursor into theincorrect View Attributes field and select the correct value from the poplist.
Select the Next button.
In the Java page,
o Deselect the Generate Java File for View Object Class: OrderSearchVOImpl (youdon't need to add any code to this view object).
o Do select the Generate Java File for View Row Class: OrderSearchVORowImplto comply with OA Framework coding standards.
Select the Finish button to create your VO.
Now verify that your VO attribute settings match the aliases in your SQL query:
Select the OrderSearchVO in the Navigator, right-click and select EditOrderSearchVO... from the context menu to open the View Object wizard.
Navigate to the Attributes section for your attributes and verify that any aliases in yourquery are shown correctly. Make any necessary changes and select Apply.
Navigate to the Attribute Mappings page and verify that all the mappings are correct.Make any necessary changes and select Apply.
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-37
Select the OK button to finish editing your VO.
2.8 Add Your View Object to the Root UI Application Module
View objects can be used only within the context of a containing application module. Before youcan use the OrderSearchVO in your page, you must add it to the page's root UI ApplicationModule.
Select the OrderEntryAM in the Navigator pane, right-click and select EditOrderEntryAM... from the context menu to open the Application Module wizard.
Navigate to the Data Model page.
Select the OrderSearchVO view object in the Available View Objects list and shuttle itto the Data Model list. The Instance Name appears as OrderSearchVO1 at the rightbottom. Change the instance name to OrderSearchVO.
Tip: Take careful note of the default View Instance name that BC4J creates when youadd your VO to the selected AM (BC4J creates this name by appending a "1" to your VOname). Leave it or change it, your choice. In either case, know what the value is beforecreating your Results table region in the next task.
Select the OK button to finish adding your VO to your root AM.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-38 Oracle Applications Framework - Practices and Solutions
3: Create Your Initial Page
For this task, you will build and run a page with just the Orders : Search page title and theinstruction text
3.1 Create the OrderSearchPG Page
Create a new UI page in the <yourname>.oracle.apps.demxx.orderentry.webui package.
Select the OrderEntry.jpr project in the Navigator, right-click and select "New..."from the context menu.
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Page in the OA Components Items list.
Select the OK button to continue.
In the New Page dialog, enter OrderSearchPG in the Name field and
<yourname>.oracle.apps.demxx.orderentry.webui in the Package field. This packagewill be created and the page will be created under this package
Warning: You MUST use this name and package or your page will not runproperly. In fact, if any package, Java file, region name, item name, etc. is specifiedin the exercise instructions, you must match it exactly in your work.
Select the OK button to create your page.
3.2 Modify the pageLayout Region
Select your OrderSearchPG in the Structure pane and select the region1 thatJDeveloper created for you.
Verify and set (if necessary) the following properties:
Property ValueID PageLayoutRNRegion Style pageLayoutAM Definition <yourname>.oracle.apps.demxx.orderentry.server.OrderEntryAMWindowTitle Order Entry Tutorial: Labs <your name>Title Orders : SearchAutoFooter True
(This ensures that the standard footer, including the Oraclecopyright and privacy notice, render in the page).
Tip: You can set the Property Inspector to list the properties by category or in alphabetical order.To change between category and alphabetical sorting, select the Categories button in toolbar atthe top of the Property.
3.3 Add a Product Branding Image
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-39
Each Oracle Applications page requires a product-branding image.
Select your PageLayoutRN in the Structure pane, right-click and select New ...productBranding from the context menu.
JDeveloper creates a pageLayoutComponents folder containing a productBrandingimage item (named item1). Select this item and set the following properties:
Property ValueID ProdBrandImage URI FNDTAPPBRAND.gifAdditional Text OA Framework Order Entry Tutorial
(This is required per the accessibility coding standards with which allOracle E-Business Suite pages must comply).
3.4 Create the Page Instruction Text
Add the page-level instruction text. Note that we are using an Oracle Applications MessageDictionary message to ensure that the text is translatable. Furthermore, all the properties that youspecify in JDeveloper that can be seen by the user are translatable.
Select the PageLayoutRN in the Structure pane, right-click select New >pageStatus from the context menu (any instruction text or other content added to thepageStatus will render in parallel with any page-level action or navigation buttonsthat you add).
JDeveloper automatically creates a flowLayout region for you beneath thepageStatus component. Select this region and set its ID to PageStatusRN.
Select PageStatusRN, right-click and select New > Item. Set this item's propertiesas follows:
Property ValueID PageHelpItem Style staticStyledTextData Type VARCHAR2CSS Class OraInstructionTextMessage Appl Short Name DEMXXMessage Name ORDLINES_PAGE_GENERAL
3.5 Test Your Work
Select your page in either the Structure pane or the Navigator window, right-click and chooseRun < file name > from the context menu.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-40 Oracle Applications Framework - Practices and Solutions
4: Configure a Results-Based Search
In this section, you will create a simple "results-based" search by leveraging the OA Frameworkquery region. You will see how to enable the user-personalizable Views panel, the SimpleSearch panel, and the Advanced Search panel without explicitly creating the UIs for theseregions. In the next task, you will change from a "results-based" search to an "auto customizationcriteria" search so you can take a bit more control of the UI that displays in the Search region.
Tip: See the Search topic in Chapter 4 of the OA Framework Developer's Guide for additionalinformation about implementing searching in your pages.
The finished region should appear as shown in Figure 5 below when you've completed all thesteps in this task.
Figure 5: Task 4-Finished Product
4.1 Add a Query Bean to Your Page
Add the query bean region to your page.
Select the PageLayoutRN in the Structure pane, right-click and select New >Region from the context menu.
Select the new region (region1), and set/verify its properties as follows:
Property ValueID QueryRNRegion Style queryConstruction Mode resultsBasedSearchInclude Simple Panel TrueInclude Views Panel True
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-41
4.2 Add a Results Data Table to Your QueryRN
Select the QueryRN in the Structure pane, right-click and select New > RegionUsing Wizard from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your OrderEntryAM(<yourname>.oracle.apps.demxx.orderentry.server.OrderEntryAM), and thenselect your OrderSearchVO view object instance from the Available View Objectslist.
DO NOT select the Use this as Application Module Definition for this region checkbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to ResultsTable and setthe Region Style to table.
Select the Next button.
In the View Attributes page, select the following attributes from the Available ViewAttributes list and shuttle them to the Selected View Attributes list:
o OrderId
o OrderStatus
o CustomerId
o CustomerName
o DateShipped
o SalesRepName
Select the Next button.
In the Region Items page, set the ID, Style, and Attribute Set properties as follows
ID Prompt Style Data Type Attribute SetOrderId Order Number messageStyledText NUMBEROrderStatus Order Status messageStyledText VARCHAR2CustomerId Customer Number messageStyledText NUMBERCustomerName Customer Name messageStyledText VARCHAR2DateShipped Ship Date messageStyledText DATESalesRepName Salesperson Name messageStyledText VARCHAR2
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-42 Oracle Applications Framework - Practices and Solutions
Click the Finish button to create your data table.
4.3 Set or Verify Your ResultsTable Region Properties
Select the ResultsTable region in the Structure pane, and set/verify the followingproperties:
Property ValueID ResultsTableRegion Style tableAM Definition Make absolutely sure that you have not inadvertently associated an
application module here. If you have, please delete it.Additional Text Orders Table
(This is required per the accessibility coding standards).Rendered TrueRecords Displayed 10Width 100%User Personalization True (needed so the user can save a Personalized View)
4.4 Set or Verify OrderId Item Properties
Configure this item to support sorting in the table, to be included in the "results-based" searchregion that the OA Framework automatically creates, and to be a selectively required searchvalue (for performance reasons, blind queries are disallowed in Oracle Applications unless theunderlying view object has been tuned to include a performant query so no additional searchcriteria is required).
For the OrderId item set or verify:
o Item Style property to messageStyledText
o Sort Allowed property to yes
o Initial Sort Sequence to first
o Search allowed True
o Selective Search Criteria property to True
o Data Type property to NUMBER
o View Instance to OrderSearchVO
o View Attribute to OrderId
o Prompt to Order Number
o User Personalization property to True (needed so the user can save a
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-43
Personalized View).
Tip: For more information on the Sort Allowed and Initial Sort Sequence properties, refer to theDeveloper's Guide topic on Tables > Sorting.
Tip: For more information on the Search Allowed and Selective Search Criteria properties, referto the Developer's Guide topics on Search > Declarative Implementation: Results Based Searchand Search > Declarative Implementation: Auto Customization Criteria.
4.5 Set or Verify OrderStatus Item Properties
For the OrderStatus item:
o Item Style property to messageStyledText
o Search Allowed property to True
o Selective Search Criteria property to True
o Data Type property to VARCHAR2
o View Instance to OrderSearchVO
o View Attribute to OrderStatus
o Prompt to Order Status
o User Personalization property to True (needed so the user can save aPersonalized View).
o Maximum Length to 1
4.6 Set or Verify CustomerId Item Properties
For the CustomerId item:
o Item Style property to messageStyledText
o Search Allowed property to True
o Selective Search Criteria property to True
o Data Type property to NUMBER
o View Instance to OrderSearchVO
o View Attribute to CustomerId
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-44 Oracle Applications Framework - Practices and Solutions
o Prompt to Customer Number
o User Personalization property to True (needed so the user can save aPersonalized View).
o Maximum Length to 15
4.7 Set or Verify CustomerName Item Properties
For the CustomerName item:
o Item Style property to messageStyledText
o Search Allowed property to True
o Selective Search Criteria property to True
o Data Type property to VARCHAR2
o View Instance to OrderSearchVO
o View Attribute to CustomerName
o Prompt to Customer Name
o User Personalization property to True (needed so the user can save aPersonalized View).
o Maximum Length to 50
4.8 Set or Verify DateShipped Item Properties
For the DateShipped item:
o Item Style property to messageStyledText
o Search Allowed property to True
o Selective Search Criteria property to True
o Data Type property to DATE
o View Instance to OrderSearchVO
o View Attribute to DateShipped
o Prompt to Ship Date
o Tip Type to dateFormat
o User Personalization property to True (needed so the user can save a
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-45
Personalized View).
o Drag and drop the item between OrderStatus and CustomerId
4.9 Set or Verify SalesRepName Item Properties
For the SalesRepName item:
o Item Style property to messageStyledText
o Search Allowed property to True
o Selective Search Criteria property to True
o Data Type property to VARCHAR2
o View Instance to OrderSearchVO
o View Attribute to SalesRepName
o Prompt to Salesperson Name
o User Personalization property to True (needed so the user can save aPersonalized View).
o Maximum Length to 15
4.10 Test Your Work
Test your work. Your results should appear as shown in Figure 5 above. Try selecting theAdvanced Search button, and the Save Search button after executing a query. Also try selectingthe Go button without specifying any search criteria. Try selecting the Views button and saving apersonalized search. Try using your saved search.
Note that you do not have to implement the query; the OA Framework implements this for youautomatically based on the table items that you identified with the Search Allowed property.Furthermore, the OA Framework creates a Search UI based on the data and item types of theSearch Allowed items.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-46 Oracle Applications Framework - Practices and Solutions
5: Convert Search Region to Use Auto Customization Criteria
We have to add an LOV to our search region, we cannot just use the simple "results-based"search because it generates search items automatically based on the columns in our results table.So, we need to convert our query bean to run in "auto customization criteria mode" (that is, wewant to customize our search criteria by adding an LOV). The finished region should appear asshown in Figure 6 below (the LOV icon appears after you finish Task 6).
Figure 6: Task 5-Finished Product
5.1 Change the Query Bean to Use autoCustomizationCriteria
Select the QueryRN in the Structure pane.
Change its Construction Mode property to autoCustomizationCriteria.
Change its Include Views Panel property to False.
Change its Include Advanced Panel property to False.
5.2 Add a Simple Search Region
Select the QueryRN in the Structure pane, right-click and choose New >simpleSearchPanel from the context menu (remember this is a named child of thequery region). A header region (region2) and a messageComponentLayout region(region1) will be created automatically.
Select the header region, set its ID to SimpleSearchHdr and change the default Textproperty value to Simple Search.
Select the default messageComponentLayout region created under thesimpleSearchPanel folder (region1) and set its ID to CustomSimpleSearch.
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-47
5.3 Create an OrderId Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and selectNew > messageTextInput from the context menu.
Select this item, and set or verify its properties as follows
Property ValueID SearchOrdNumItem Style messageTextInputSelective Search Criteria TrueData Type NUMBERMaximum Length 15Prompt Order NumberCSS Class OraFieldTextLength 15
5.4 Create an Order Status Search Item
Select the CustomSimpleSearch region in the Structure pane, right-click and selectNew > messageTextInput from the context menu.
Select this item, and change or verify its properties as follows:
Property ValueID SearchOrdStatusItem Style messageTextInputSelective Search Criteria TrueData Type VARCHAR2Prompt Order StatusCSS Class OraFieldTextLength 15
5.5 Create a DateShipped Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and selectNew >messageTextInput from the context menu.
Select this item, and set or verify its properties as follows
Property ValueID SearchDateShippedItem Style messageTextInputSelective Search Criteria TrueData Type DATE
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-48 Oracle Applications Framework - Practices and Solutions
Property ValueMaximum Length 15Prompt Ship DateCSS Class OraFieldTextLength 15
5.6 Create an CustomerId Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and selectNew >messageTextInput from the context menu.
Select this item, and set or verify its properties as follows
Property ValueID SearchCustIdItem Style messageTextInput (we will change this to LOV later)Selective Search Criteria TrueData Type NUMBERPrompt Customer NumberCSS Class OraFieldTextLength 15
5.7 Create an CustomerName Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and selectNew >messageTextInput from the context menu.
Select this item, and set or verify its properties as follows
Property Value
ID SearchCustNameItem Style messageTextInput (we will change this to LOV later)Selective Search Criteria TrueData Type VARCHAR2Prompt Customer NameCSS Class OraFieldTextLength 15
5.8 Create an SalesRepName Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and selectNew >messageTextInput from the context menu.
Select this item, and set or verify its properties as follows
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-49
Property ValueID SearchSalespersonNameItem Style messageTextInput (we will change this to LOV later)Selective SearchCriteria
TrueData Type VARCHAR2Prompt Salesperson NameCSS Class OraFieldTextLength 15
5.9 Create Search Mappings Between Search Items and ResultsTable
The OA Framework uses the mappings that you define between your custom search items andcolumns in the ResultsTable to handle the query automatically when the user selects the Gobutton.
Select the query bean or the query Components folder in the Structure pane, right-click and choose New > simpleSearchMappings from the context menu.
Select the default mapping created under the simpleSearchMappings and set itsproperties to the following:
Property ValueID OrderNumMapSearch Item SearchOrdNumResults Item OrderId
Select the simpleSearchMappings folder in the Structure pane, right-click andchooseNew > queryCriteriaMap from the context menu.
Select the new mapping and set its properties as follows:
Property ValueID DateShipMapSearch Item SearchDateShipped
Results Item DateShipped
Select the simpleSearchMappings folder in the Structure pane, right-click and chooseNew > queryCriteriaMap from the context menu.
Select the new mapping and set its properties as follows:
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-50 Oracle Applications Framework - Practices and Solutions
Property ValueID CustIdMapSearch Item SearchCustIdResults Item CustomerId
Select the simpleSearchMappings folder in the Structure pane, right-click andchooseNew > queryCriteriaMap from the context menu.
Select the new mapping and set its properties as follows:
Property ValueID CustNameMapSearch Item SearchCustNameResults Item CustomerName
Select the simpleSearchMappings folder in the Structure pane, right-click and chooseNew > queryCriteriaMap from the context menu.
Select the new mapping and set its properties as follows:
Property ValueID OrderStatusMapSearch Item SearchOrdStatusResults Item OrderStatus
Select the simpleSearchMappings folder in the Structure pane, right-click andchooseNew > queryCriteriaMap from the context menu.
Select the new mapping and set its properties as follows:
Property ValueID SalesRepMapSearch Item SearchSalespersonNameResults Item SalesRepName
5.10 Test Your Work
Test your work. Your results should appear as shown in Figure 6 above (but without the LOVicon).
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-51
6: Adding a List of Values (LOV) to a Field
In this section, you will create a reusable list of values (LOV) that you will then configure foruse in the Search page (you will use this same LOV later in the Create page). LOVs covered inthis section are for Customer Number, Customer name and salesperson name. The finishedLOVs should appear as shown in Figure 7(a,b,c).
Figure 7a: Customer Number LOV Window
Figure 7b: Customer Name LOV Window
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-52 Oracle Applications Framework - Practices and Solutions
Figure 7c: Salesperson LOV Window
6.1 Create the BC4J Package for Your LOV-Related Model Objects
All LOV view objects should be created in a common product package.
Select the OrderEntry.jpr project in the Navigator, right-click and select NewBusiness Components Package...to open the Business Components PackageWizard.
If the Welcome page appears, select the Next button.
In the Package Name page, enter <yourname>.oracle.apps.demxx.lov.server
Verify that the radio button Entity Objects mapped to database schema objects isselected.
Click the Finish button to create the LOV BC4J package.
6.2 Create a Common LOV Application Module
Related LOV view objects should be grouped into a common application module. For example,any LOV view objects that you create for the OrderEntry application should be included in oneapplication module.
Select the <yourname>.oracle.apps.demxx.lov.server BC4J package in theNavigator, right-click and select New Application Module... from the context menuto open the Application Module (AM) wizard.
If the Welcome page appears, select Next.
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-53
In the Name page, specify OrderEntryLovAM as the AM name and verify that thePackage is <yourname>.oracle.apps.demxx.lov.server
Click the Next button until you get to Step 4 of 4.
In the Java page, deselect the Generate Java File(s) checkbox (you would not beadding any code to this application module).
Select the Finish button to create the AM.
6.3.1 Create the Customer LOV View Object
Select the <yourname>.oracle.apps.demxx.lov.server package in the Navigator,right-click and select "New View Object..." from the context menu to open theView Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify CustomerLovVO as the view object name and verify thatthe Package is <yourname>.oracle.apps.demxx.lov.server.
Select the Next button until you get to the Query page.
In the Query page, enter the following query into the Query Statement text field.SELECT DC.customer_id CUST_ID
,DC.name CUST_NAMEFROM dem_customers DC
Select the Test button to ensure your syntax is correct.
Select the Next button until you get to the Java page.
In the Java page, deselect the Generate Java File for View Object Class:CustomerLovVOImpl (as you do not have to add any code to this view object). Doselect the Generate Java File for View Row Class: CustomerLovVORowImpl tocomply with OA Framework coding standards.
Select the Finish button to create your VO.
6.3.2 Add the CustomerLovVO to the OrderEntryLovAM
View objects can be used only within the context of a containing application module. Before weuse the
CustomerLovVO in our LOV, we must add it to the LOV application module.
Select the OrderEntryLovAM in the Navigator pane; right-click and select Edit
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-54 Oracle Applications Framework - Practices and Solutions
OrderEntryLovAM... from the context menu to open the Application Modulewizard.
Navigate to the Data Model page.
Select the CustomerLovVO view object in the Available View Objects list andshuttle it to the Data Model list. Change Instance name on the right fromCustomerLovVO1 to CustomerLovVO.
Select the OK button to finish adding this VO to the AM.
6.4.1 Create the SalesRep LOV View Object
Select the <yourname>.oracle.apps.demxx.lov.server package in the Navigator,right-click and select "New View Object..." from the context menu to open theView Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify SalesRepLovVO as the view object name and verify thatthe Package is <yourname>.oracle.apps.demxx.lov.server.
Select the Next button until you get to the Query page.
In the Query page, enter the following query into the Query Statement text field.SELECT first_name || ' ' || last_name sales_rep_name
,sales_rep_idFROM dem_sales_reps
Select the Test button to ensure your syntax is correct.
Select the Next button until you get to the Java page.
In the Java page, deselect the Generate Java File for View Object Class:SalesRepLovVOImpl (as we do not have to add any code to this view object). Doselect the Generate Java File for View Row Class: SalesRepLovVORowImpl tocomply with OA Framework coding standards.
Select the Finish button to create your VO.
6.4.2 Add the SalesRepLovVO to the OrderEntryLovAM
View objects can be used only within the context of a containing application module. Before weuse the
SalesRepLovVO in our LOV, we must add it to the LOV application module.
Select the OrderEntryLovAM in the Navigator pane; right-click and select Edit
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-55
OrderEntryLovAM... from the context menu to open the Application Modulewizard.
Navigate to the Data Model page.
Select the SalesRepLovVO view object in the Available View Objects list andshuttle it to the Data Model list. Change Instance name on the right fromSalesRepLovVO1 to SalesRepLovVO.
Select the OK button to finish adding this VO to the AM.
6.5.1 Create the Shared CustomerLovRN LOV Region
Since the Customer details LOV can be used in many different pages, it must be created as ashared, standalone region.
Select the OrderEntry.jpr project in the Navigator, right-click and select New...from the context menu.
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Region in the OA Components Items list.
Select the OK button to continue.
In the New Region dialog, specify the following values:
o In the Name field enter CustomerLovRN.
o In the Package field enter <yourname>.oracle.apps.demxx.lov.webui.
o In the Style field select listOfValues.
o Click the OK button to create your region.
o Select the CustomerLovRN in the Structure pane, set the AM Definitionproperty to<yourname>.oracle.apps.demxx.lov.server.OrderEntryLovAM, set theAdvanced Search Allowed property to True and set the Scope property toPublic.
6.5.2 Add a Table to the LOV Region
Select the CustomerLovRN in the Structure pane, right-click and select New >table Using Wizard from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your OrderEntryLovAM(<yourname>.oracle.apps.demxx.lov.server.OrderEntryLovAM), then select
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-56 Oracle Applications Framework - Practices and Solutions
your CustomerLovVO view object instance from the Available View Objects list.DO NOT select the Use this as Application Module Definition for this regioncheckbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to CustLovTable andset the Region Style to table.
Select the Next button.
In the View Attributes page, add all the attributes in the CustomerLovVO.
Select the Next button.
In the Region Items page, set the ID, Style properties as follows
ID Prompt Style Data Type Attribute SetCustId Customer Number messageStyledTex
tNUMBER
CustName Customer Name messageStyledText
VARCHAR2
Click the Finish button to create your data table.
Set the Additional Text property on your table to Customer Details List.
Select the CustId and CustName item in the Structure pane, and set their SearchAllowed and Selective Search Criteria properties to True. The first property letsusers search on these values in the LOV, and the second property ensures that theusers specify search criteria for at least one of these values to avoid a blind query.
6.6.1 Create the Shared SalesRepLovRN LOV Region
Since the Salesperson details LOV can be used in many different pages, it must be created as ashared, standalone region.
Select the OrderEntry.jpr project in the Navigator, right-click and select New...from the context menu.
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Region in the OA Components Items list.
Select the OK button to continue.
In the New Region dialog, specify the following values:
o In the Name field enter SalesRepLovRN.
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-57
o In the Package field enter <yourname>.oracle.apps.demxx.lov.webui.
o In the Style field select listOfValues.
o Click the OK button to create your region.
o Select the SalesRepLovRN in the Structure pane, set the AM Definitionproperty to<yourname>.oracle.apps.demxx.lov.server.OrderEntryLovAM, set theAdvanced Search Allowed property to True and set the Scope property toPublic.
6.6.2 Add a Table to the LOV Region
Select the SalesRepLovRN in the Structure pane, right-click and select New > tableUsing Wizard from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your OrderEntryLovAM(<yourname>.oracle.apps.demxx.lov.server.OrderEntryLovAM), then selectyour SalesRepLovVO view object instance from the Available View Objects list.DO NOT select the Use this as Application Module Definition for this regioncheckbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to SalesRepLovTableand set the Region Style to table.
Select the Next button.
In the View Attributes page, add all the attributes in the SalesRepLovVO.
Select the Next button.
In the Region Items page, set the ID, Style properties as follows
ID Prompt Style Data Type Attribute SetSalesRepName Salesperson Name messageStyledText VARCHAR2SalesRepId Salesperson Number messageStyledText NUMBER
Click the Finish button to create your data table.
Set the Additional Text property on your table to Salesperson Details List.
Select the SalesRepName and SalesRepId item in the Structure pane, and set their
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-58 Oracle Applications Framework - Practices and Solutions
Search Allowed and Selective Search Criteria properties to True. The first propertylets users search on these values in the LOV, and the second property ensures thatthe users specify search criteria for at least one of these values to avoid a blindquery.
6.7.1 Make the Customer Id Search Item an LOV
When we first created the Customer Number item, we set its style to messageTextInput (astandard text entry field). Now, we need to configure it to include an LOV.
Select the SearchCustId item in the CustomSimpleSearch panel.
Change its Item Style property to messageLovInput.
When you set the Item Style property to messageLovInput, JDeveloperautomatically creates an inline LOV region (region style listOfValues) and a defaultLOV mapping.
Set the External LOV property to/<yourname>/oracle/apps/demxx/lov/webui/CustomerLovRN.
Note: When we change this property, JDeveloper displays a confirmation message indicatingthat children of our base field, such as the inline LOV region, will be removed by the change.Confirm the change (select the OK button). Once you confirm, the inline LOV region isremoved and the new external LOV region appears in the hierarchy (grayed out because it cannotbe edited directly in your page).
Verify if its Disable Validation property is set to False.
Note: Per the OA Framework View Coding Standards, validation should always be enabled onan LOV field unless the user should be able to enter partial values, as is often the case in a searchcriteria field.
6.7.2 Define LOV Mappings
Create mappings between base page items and LOV items. The mappings identify the datainput/output relationships between base page items and LOV items.
Select the default LOV mapping, change ID as CustIdMap, and set the followingproperties:
o Change the LOV Region Item property by selecting CustId field from thepoplist. This indicates the column selected in the LOV query
o Change the Return Item property by selecting SearchCustId field from thepoplist. This indicates the field to in the screen to which the CustId value isassigned
o Change the Criteria Item property by selecting SearchCustId field from the
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-59
poplist. This indicates the field from which the LOV should take value as asearch criteria.
Right-click lovMappings in the Structure panel, and select New > lovMap from thecontext menu.
Select the default LOV mapping, change ID as CustNameMap, and set thefollowing properties:
o Change the LOV Region Item property by selecting CustName field fromthe poplist.
o Change the Return Item property by selecting SearchCustName field fromthe poplist.
6.8.1 Make the Customer Name Search Item an LOV
When we first created the Customer Name item, we set its style to messageTextInput (a standardtext entry field). Now, we need to configure it to include an LOV.
Select the SearchCustName item in the CustomSimpleSearch panel.
Change its Item Style property to messageLovInput.
When you set the Item Style property to messageLovInput, JDeveloperautomatically creates an inline LOV region (region style listOfValues) and a defaultLOV mapping.
Set the External LOV property to/<yourname>/oracle/apps/demxx/lov/webui/CustomerLovRN.
Note: When you change this property, JDeveloper displays a confirmation message indicatingthat children of your base field, such as the inline LOV region, will be removed by the change.Confirm the change (select the OK button). Once you confirm, the inline LOV region isremoved and the new external LOV region appears in the hierarchy (grayed out because it cannotbe edited directly in your page).
Verify if its Disable Validation property is set to False.
Note: Per the OA Framework View Coding Standards, validation should always be enabled onan LOV f ield unless the user should be able to enter partial values, as is often the case in asearch criteria field.
6.8.2 Define LOV Mappings
Create mappings between base page items and LOV items. The mappings identify the datainput/output relationships between base page items and LOV items.
Select the default LOV mapping, change ID as CustNameMap1, and set thefollowing properties:
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-60 Oracle Applications Framework - Practices and Solutions
o Change the LOV Region Item property by selecting CustName field fromthe poplist.
o Change the Return Item property by selecting SearchCustName field fromthe poplist.
o Change the Criteria Item property by selecting SearchCustName field fromthe poplist.
Right-click lovMappings in the Structure panel, and select New > lovMap from thecontext menu.
Select the default LOV mapping, change ID as CustIdMap1, and set the followingproperties:
o Change the LOV Region Item property by selecting CustId field from thepoplist.
o Change the Return Item property by selecting SearchCustId field from thepoplist.
6.9.1 Make the Salesperson Name Search Item an LOV
When we first created the SalesRepName item, we set its style to messageTextInput (a standardtext entry field). Now, we need to configure it to include an LOV.
Select the SearchSalespersonName item in the CustomSimpleSearch panel.
Change its Item Style property to messageLovInput.
When you set the Item Style property to messageLovInput, JDeveloperautomatically creates an inline LOV region (region style listOfValues) and a defaultLOV mapping.
Set the External LOV property to/<yourname>/oracle/apps/demxx/lov/webui/SalesRepLovRN.
Note: When you change this property, JDeveloper displays a confirmation message indicatingthat children of your base field, such as the inline LOV region, will be removed by the change.Confirm the change (select the OK button). Once you confirm, the inline LOV region isremoved and the new external LOV region appears in the hierarchy (grayed out because it cannotbe edited directly in your page).
Verify if its Disable Validation property is set to False.
Note: Per the OA Framework View Coding Standards, validation should always be enabled onan LOV f ield unless the user should be able to enter partial values, as is often the case in asearch criteria field.
6.9.2 Define LOV Mappings
Lab 2: Orders: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-61
Create mappings between base page items and LOV items. The mappings identify the datainput/output relationships between base page items and LOV items.
Select the default LOV mapping, ID labeled as SalesRepMap, and set the followingproperties:
o Change the LOV Region Item property by selecting SalesRepName fieldfrom the poplist.
o Change the Return Item property by selecting SearchSalespersonNamefield from the poplist.
o Change the Criteria Item property by selecting SearchSalespersonNamefield from the poplist.
Figure 8:Task 6: Finished Product
6.9.3 Test Your Work
Test your work. Your base page (the Orders Search page) should appear as shown in the figureabove. When you select the list of values icon, your LOV windows should appear as shown inFigures 7 above.
Warning: You cannot run and test the LOV page directly. You must run your base page, andthen select the list of values icon to invoke the LOV.
You are now finished with this exercise.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-62 Oracle Applications Framework - Practices and Solutions
Lab 3: Orders: Drilldown to Details
Overview
In this exercise, we will be extending the simple Orders search page you created in the SearchPage Exercise to include a drilldown to a Details page that queries a single order.
Warning: This lab assumes that you have completed the Search lab, and builds on this work. Ifyou have not completed this exercise, please do so before proceeding.
Figure 1: Order Number in Search Page Links to Details Page
Figure 2: Details Page Finished Product
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-63
1: Create the Details Page View Object
1.1 Create the OrderDetailsVO View Object
Create a detail-level view object including all the attributes that we need to create (and later)view an order. This view object should leverage the OrderEO that you created in the Searchexercise.
Select the <yourname>.oracle.apps.demxx.orderentry.server BC4J package in theNavigator, right-click and select New View Object... from the context menu to openthe View Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify OrderDetailsVO as the view object's name and verifythat the Package is <yourname>.oracle.apps.demxx.orderentry.server
Select the Next button.
In the Entity Objects page, select the OrderEO in the Available list and shuttle it tothe Selected list
Select the Next button.
In the Attributes page, select all the attributes from the Available list and shuttlethem to the Selected list (Reason: We may add descriptive flexfields later on (as perthe requirement) in which case we do not have to create another VO to capture otherdetails)
Select the Next button twice to reach the Query Page.
At this point the query should look like the following in the Query page (without theformatting we have used here to improve readability):
SELECT OrderEO.ORDER_ID,OrderEO.LAST_UPDATE_DATE,OrderEO.LAST_UPDATED_BY,OrderEO.CREATION_DATE,OrderEO.CREATED_BY,OrderEO.LAST_UPDATE_LOGIN,OrderEO.CUSTOMER_ID,OrderEO.SALES_REP_ID,OrderEO.PAYMENT_TYPE,OrderEO.CURRENCY_CODE,OrderEO.ORDER_STATUS,OrderEO.DATE_ORDERED,OrderEO.DATE_SHIPPED,OrderEO.CHECK_NUMBER,OrderEO.CC_TYPE,OrderEO.CC_NUMBER,
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-64 Oracle Applications Framework - Practices and Solutions
OrderEO.CC_EXPIRATION,OrderEO.CC_APPROVAL_CODE,OrderEO.ORDER_NOTE,OrderEO.ATTRIBUTE_CATEGORY,OrderEO.ATTRIBUTE1,OrderEO.ATTRIBUTE2,OrderEO.ATTRIBUTE3,OrderEO.ATTRIBUTE4,OrderEO.ATTRIBUTE5,OrderEO.ATTRIBUTE6,OrderEO.ATTRIBUTE7,OrderEO.ATTRIBUTE8,OrderEO.ATTRIBUTE9,OrderEO.ATTRIBUTE10
FROM DEM_ORDERS OrderEO
Select the Expert Mode checkbox. This allows you to edit the generated query.
In the Query Statement text box modify the query (the portion shown in bold is whatyou are expected to add to your already existing query) so that it looks like thefollowing
When you are finished with your editing, select the Test button to ensure your syntaxis correct.
SELECT OrderEO.ORDER_ID,OrderEO.LAST_UPDATE_DATE,OrderEO.LAST_UPDATED_BY,OrderEO.CREATION_DATE,OrderEO.CREATED_BY,OrderEO.LAST_UPDATE_LOGIN,OrderEO.CUSTOMER_ID,OrderEO.SALES_REP_ID,OrderEO.PAYMENT_TYPE,OrderEO.CURRENCY_CODE,OrderEO.ORDER_STATUS,OrderEO.DATE_ORDERED,OrderEO.DATE_SHIPPED,OrderEO.CHECK_NUMBER,OrderEO.CC_TYPE,OrderEO.CC_NUMBER,OrderEO.CC_EXPIRATION,OrderEO.CC_APPROVAL_CODE,OrderEO.ORDER_NOTE,OrderEO.ATTRIBUTE_CATEGORY,OrderEO.ATTRIBUTE1,OrderEO.ATTRIBUTE2,OrderEO.ATTRIBUTE3,OrderEO.ATTRIBUTE4,OrderEO.ATTRIBUTE5,OrderEO.ATTRIBUTE6,OrderEO.ATTRIBUTE7,OrderEO.ATTRIBUTE8,OrderEO.ATTRIBUTE9,OrderEO.ATTRIBUTE10,DemCust.NAME AS CUSTOMER_NAME,DemSale.FIRST_NAME||' '||DemSale.LAST_NAME AS SALES_REP_NAME
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-65
FROM DEM_ORDERS OrderEO,DEM_CUSTOMERS DemCust,DEM_SALES_REPS DemSale
WHERE OrderEO.CUSTOMER_ID = DemCust.CUSTOMER_IDAND OrderEO.SALES_REP_ID = DemSale.SALES_REP_ID(+)
Select the Next button.
In the Attribute Mappings page, verify that your view object attributes map tothe correct query columns. If you need to make any changes, place your cursorinto the incorrect View Attributes field and select the correct value from the poplist.
Select the Next button.
In the Java page, select both the Generate Java File for View Object Class:OrderDetailsVOImpl checkbox and the Generate Java File for View Row Class:OrderDetailsVORowImpl.
Select the Finish button to create your VO.
Now verify that your VO attribute settings match the aliases in your SQL query.
Select the OrderDetailsVO in the Navigator, right-click and select EditOrderDetailsVO... from the context menu to open the View Object wizard.
o Navigate to the Tunings section for your attributes and verify that EnablePassivation checkbox is selected
o Navigate to the Attribute Mappings page and verify that all the mappings arecorrect. Make any necessary changes and select Apply.
o Select the OK button to finish editing your VO.
1.2 Add Your View Object to the Root UI Application Module
The Details page will share the same root UI application module that you used for the Searchpage, so you need to add the page's view object to the OrderEntryAM application module.
Select the OrderEntryAM in the Navigator pane, right-click and select EditOrderEntryAM... from the context menu to open the Application Module wizard.
Navigate to the Data Model page.
Select the OrderDetailsVO view object in the Available View Objects list andshuttle it to the Data Model list. Modify the Instance name shown on the rightbottom from OrderDetailsVO1 to OrderDetailsVO.
Select the OK button to finish adding your VO to your root AM.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-66 Oracle Applications Framework - Practices and Solutions
1.3 Save Your Work
Select the JDeveloper main menu option File > Save All. There is no need to test at this pointsince we have not associated the view object with your UI.
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-67
2: Create the Details Page UI
In this task, you will create a simple view-only page that automatically queries an order when theuser navigates to it by selecting an Order Number link as shown in Figure 1.
2.1 Create the OrderDetailsPG Page
Create a new UI page in the <yourname>.oracle.apps.demxx.orderentry.webui package.
Select OrderEntry.jpr project in the Navigator, right-click and select "New..." fromthe context menu.
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Page in the OA Components Items list.
Select the OK button to continue.
In the New Page dialog, enter OrderDetailsPG in the Name field and<yourname>.oracle.apps.demxx.orderentry.webui in the Package field.
Warning: You MUST use this name and package or your page will not run properly. Infact, if any package, Java file, region name, item name, etc. is specified in the exerciseinstructions, you must match it exactly in your work.
Select the OK button to create your page.
2.2 Modify the pageLayout Region
Select your OrderDetailsPG in the Structure pane and select the region1 thatJDeveloper created.
Verify and set (if necessary) the following properties:
Property ValueID PageLayoutRNRegion Style pageLayoutAM Definition <yourname>.oracle.apps.demxx.orderentry.server.OrderEntryAMWindow Title Order Entry Tutorial: Labs <your name>Title Orders : DrilldownAutoFooter True
Note that this page using the application module type (same AM Definition value) as theOrderSearchPG. Later, we will make sure it uses the same instance of the same applicationmodule type when it renders.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-68 Oracle Applications Framework - Practices and Solutions
2.3 Add a Product Branding Image
Each Oracle Applications page requires a product-branding image.
Select your PageLayoutRN in the Structure pane, right-click and select New ...productBranding from the context menu.
JDeveloper creates a pageLayoutComponents folder containing a productBrandingimage item (named item1). Select this item and set the following properties:
Property ValueID ProdBrandImage URI FNDTAPPBRAND.gifAdditional Text Order Entry Tutorial
2.4 Create the Main Content Region
To achieve the correct indentation of our display fields, add a defaultSingleColumn region toyour PageLayoutRN. Since each of the items in this region will bind to the OrderDetailsVOview instance, we will use the region wizard to quickly create this.
Select the PageLayoutRN in the Structure pane, right-click and select New > RegionUsing Wizard from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your OrderEnryAM(<yourname>.oracle.apps.demxx.orderentry.server.OrderEnryAM), and thenselect your OrderDetailsVO view object instance from the Available View Objectslist.
DO NOT select the Use this as Application Module Definition for this regioncheckbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to MainRN and set theRegion Style to defaultSingleColumn.
Select the Next button.
In the View Attributes page, select the following from the Available View Attributeslist and shuttle them to the Selected View Attributes list:
o OrderId
o CustomerId
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-69
o SalesRepId
o PaymentType
o CurrencyCode
o OrderStatus
o DateOrdered
o DateShipped
o CheckNumber
o CcType
o CcNumber
o CcExpiration
o CcApprovalCode
o OrderNote
o CustomerName
o SalesRepName
o AttributeCategory
o Attribute1
o Attribute2
o Attribute3
o Attribute4
o Attribute5
o Attribute6
o Attribute7
o Attribute8
o Attribute9
o Attribute10
Select the Next button.
In the Region Items page, set the item properties as follows
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-70 Oracle Applications Framework - Practices and Solutions
ID Prompt Style Data Type Attribute SetOrderId Order Number messageStyledText NUMBERCustomerId Customer Number messageStyledText NUMBERSalesRepId Salesperson Number messageStyledText NUMBERPaymentType Payment Type messageStyledText VARCHAR2CurrencyCode Currency Code messageStyledText VARCHAR2OrderStatus Order Status messageStyledText VARCHAR2DateOrdered Order Date messageStyledText DATEDateShipped Ship Date messageStyledText DATECheckNumber Check Number messageStyledText NUMBERCcType Type messageStyledText VARCHAR2CcNumber Creditcard Number messageStyledText VARCHAR2CcExpiration Expiration messageStyledText VARCHAR2CcApprovalCode Approval Code messageStyledText VARCHAR2OrderNote Order Note messageStyledText VARCHAR2CustomerName Customer Name messageStyledText VARCHAR2SalesRepName Salesperson Name messageStyledText VARCHAR2AttributeCategory AttributeCategory messageStyledText VARCHAR2Attribute1 Attribute1 messageStyledText VARCHAR2Attribute2 Attribute2 messageStyledText VARCHAR2Attribute3 Attribute3 messageStyledText VARCHAR2Attribute4 Attribute4 messageStyledText VARCHAR2Attribute5 Attribute5 messageStyledText VARCHAR2Attribute6 Attribute6 messageStyledText VARCHAR2Attribute7 Attribute7 messageStyledText VARCHAR2Attribute8 Attribute8 messageStyledText VARCHAR2Attribute9 Attribute9 messageStyledText VARCHAR2Attribute10 Attribute10 messageStyledText VARCHAR2
Click the Finish button to create your data table.
Select the MainRN region in the Structure pane. Set the Hide Header property toTrue (so no header text or line renders), and leave the Text property blank.
2.5 Finish Setting MainRN Item Properties
Most of the MainRN item properties were set when you created the defaultSingleColumnregion. Open each of the following items in the MainRN and set the following additionalproperties as shown:
OrderId
Property ValueCSS Class OraDataText
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-71
CustomerId
Property ValueCSS Class OraDataText
SalesRepId
Property ValueCSS Class OraDataText
PaymentType
Property ValueCSS Class OraDataText
CurrencyCode
Property ValueCSS Class OraDataText
OrderStatus
Property ValueCSS Class OraDataText
DateOrdered
Property ValueCSS Class OraDataText
DateShipped
Property ValueCSS Class OraDataText
CheckNumber
Property ValueCSS Class OraDataText
CcType
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-72 Oracle Applications Framework - Practices and Solutions
Property ValueCSS Class OraDataText
CcNumber
Property ValueCSS Class OraDataText
CcExpiration
Property ValueCSS Class OraDataText
CcApprovalCode
Property ValueCSS Class OraDataText
OrderNote
Property ValueCSS Class OraDataText
CustomerName
Property ValueCSS Class OraDataText
SalesRepName
Property ValueCSS Class OraDataText
2.6 Change the Main Region's Style
Select the MainRN defaultSingleColumn region and change its Region Style property tomessageComponentLayout. JDeveloper will display the following warning; select the Yesbutton to proceed. Your items will not be adversely affected.
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-73
Tip: The messageComponentLayout region style is new in release 11.5.10 (and should be usedin place of all default* regions which will eventually be deprecated). Since "region usingwizard" creation support is not yet available for the messageComponentLayout, this is the mostefficient way to create a single row region whose items bind to a view object instance.
2.7 Add a messageLayout
Select the MainRN and right-click on it. Choose New -> messageLayout from the list. A defaultmessageLayout1 item gets added at the end. Select the messageLayout item and set its ID toFormValueLayout.
Now drag and drop the following items in the MainRN to the FormValueLayout.
o SalesRepId
o AttributeCategory
o Attribute1
o Attribute2
o Attribute3
o Attribute4
o Attribute5
o Attribute6
o Attribute7
o Attribute8
o Attribute9
o Attribute10
In the Property Inspector, change the Item Style of all these items to formValue andset the following properties for each of them. Note that the View Attribute may bereset when we change the Item Style to formValue.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-74 Oracle Applications Framework - Practices and Solutions
Assign the View Attribute property of all these items back to their original value justin case they are lost.
FormValue Item View AttributeSalesRepId SalesRepIdAttributeCategory AttributeCategoryAttribute1 Attribute1Attribute2 Attribute2Attribute3 Attribute3Attribute4 Attribute4Attribute5 Attribute5Attribute6 Attribute6Attribute7 Attribute7Attribute8 Attribute8Attribute9 Attribute9Attribute10 Attribute10
Also remember to set the Data Type property of SalesRepId to NUMBER.
Note: This method is adopted, as we cannot directly add a non-message item (such as formValueitem) to a messageComponentLayout as a child. In such cases, we add a messageLayout towhich all our non-message items are added.
Before we proceed further, rearrange the other items (by drag-and-drop) to display details in aparticular order in the OrderDetailsPG. The order prescribed here is –
o OrderId
o OrderStatus
o DateOrdered
o DateShipped
o CustomerId
o CustomerName
o SalesRepName
o CurrencyCode
o PaymentType
o CheckNumber
o CcType
o CcNumber
o CcExpiration
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-75
o CcApprovalCode
o OrderNote
2.8 Add a "Return to Orders: Search Page" Link
Add a "Return to Orders: Search Page" link at the bottom of your page beneath the page contentbottom line (the ski).
Select your PageLayoutRN in the Structure pane, right-click and select New >returnNavigation.
Select the returnNavigation link item that JDeveloper creates for you beneath thepageComponents folder and set the following properties:
Property ValueID ReturnLinkDestinationURL
OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/OrderSearchPG&retainAM=Y
Text Return to Orders: Search Page
2.9 Save Your Work
Select the JDeveloper main menu option File > Save All.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-76 Oracle Applications Framework - Practices and Solutions
3: Implement the View Object Query
3.1 Add an initQuery( ) Method to Your OrderDetailsVOImpl Class
This method should take an orderId parameter, set the WHERE clause to ORDER_ID = :1, bindthe orderId parameter to the WHERE clause, and execute the query (in effect, the view objectshould be capable of preparing to query and querying itself).
Note: Pay attention to the import/use of the oracle.jbo.domain.Number. Whenever youinstantiate a Number, you should import this class. If you forget to do this, you may encounter aruntime error complaining about java.lang.Number (the assumed class) being abstract, or youmay get class cast exception errors.
import oracle.jbo.domain.Number;import oracle.apps.fnd.framework.OAException;...
public void initQuery(String orderNumber){if ((orderNumber != null) &&(!("".equals(orderNumber.trim())))){// Do the following conversion for type consistency.Number ordNum = null;try{ordNum = new Number(orderNumber);
}catch(Exception e){throw new OAException("DEMXX", "ORDLINES_INVALID_LINE_NUMBER");
}setWhereClause("ORDER_ID = :1");setWhereClauseParams(null); // Always resetsetWhereClauseParam(0, ordNum);executeQuery();
}} // end initQuery()
3.2 Add an initDetails( ) Method to Your OrderEntryAMImpl Class
You will invoke this method from your UI controller (per the OA Framework coding standards,you should interact only with the OAApplicationModule interface in your controller; you shouldnot interact directly with view objects). This method delegates to the initQuery() method that youjust created on the OrderDetailsVOImpl class.
Note the import/use of the oracle.apps.fnd.framework.OAException andoracle.apps.fnd.common.MessageToken classes.
import oracle.apps.fnd.framework.OAException;import oracle.apps.fnd.common.MessageToken;...
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-77
/**************************************************************************** Initializes the detail order query.******************************************************************************/
public void initDetails(String orderNumber){OrderDetailsVOImpl vo = getOrderDetailsVO();if (vo == null){MessageToken[] errTokens = { new MessageToken("OBJECT_NAME","OrderdetailsVO")};throw new OAException("DEMXX", "ORDLINES_OBJECT_NOT_FOUND",
errTokens);}vo.initQuery(orderNumber);
} // end initDetails()
3.3 Save and Compile Your Work
Select the JDeveloper main menu option File > Save All.
Select your project, right-click and select Rebuild OrderEntry.jpr to compileeverything (you can also select the same option from the main menu).
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-78 Oracle Applications Framework - Practices and Solutions
4: Implement the Drilldown to the OrderDetailsPG
In this section, you will add a link on the OrderId column in the Results table that you added toyour OrderSearchPG in the previous lab. This link navigates to the new Details page that youjust created.
4.1 Configure the OrderId Item as a Link
When the user selects an Order Number link, the Details page should display. As part of thisGET request, we also want to:
Add orderNumber and customerName parameters to the URL. These parametervalues should be sourced from the OrderDetailsVO attributes OrderId andCustomerName respectively.
Indicate that the OrderSearchPG's application module instance should be retainedwhen the OrderDetailsPG renders so these pages can share the same rootapplication module.
Indcate that breadcrumbs should display in the OrderDetailsPG.
To achieve this, select the orderNumber item in the ResultsTable region and set theDestination URI property to:
OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/OrderDetailsPG&orderNumber={@OrderId}&customerName={@CustomerName}&retainAM=Y&addBreadCrumb=Y
At runtime, the OA Framework substitutes the current row's view instance attribute values forthe tokens inside the curly braces. So, for example, &orderNumber={@OrderId} becomes&orderNumber=1234.
4.2 Create a Controller for the Details Page
Since the logic in this controller applies to the page title, it is best to simply add the controller atthe pageLayout level.
Select the PageLayoutRN of the OrderDetailsPG in the Structure pane, right-clickand select Set New Controller ... from the context menu.
In the New Controller dialog, set the Package Name to<yourname>.oracle.apps.demxx.orderentry.webuiand the Class Name to OrderDetailsCO.
Select OK to create your controller.
Lab 3: Orders: Drilldown to Details………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-79
4.3 Add Controller Logic to Initalize Order Query When Page Renders
To automatically query the underlying OrderDetailsVO view object when the OrderDetailsPGrenders, add the following code to the OrderDetailsCO.processRequest( ) method.
Note that you are referencing the orderNumber parameter that you add to the URL when theuser selects the Order Number link.
import java.io.Serializable;import oracle.apps.fnd.framework.OAApplicationModule;...
public void processRequest(OAPageContext pageContext, OAWebBeanwebBean){// Always call this first.super.processRequest(pageContext, webBean);// Get the orderNumber parameter from the URLString orderNumber = pageContext.getParameter("orderNumber");// Now we want to initialize the query for our single order// with all of its details.OAApplicationModule am = pageContext.getApplicationModule(webBean);Serializable[] parameters = { orderNumber };am.invokeMethod("initDetails", parameters);
}
4.4 Programmatically Set the Page Title Text
Per the BLAF UI Guidelines on Header Components, you need to display the current selectedcustomer’s name in the Details page title. To do this, add the following code to your controller'sprocessRequest() method.
Note that this assumes a message (ORDLINES_HDR_TEXT) has already been created in thedatabase with the following content: Order Details for &CUST_NAME.
import oracle.apps.fnd.common.MessageToken;import oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean;
...
public void processRequest(OAPageContext pageContext, OAWebBeanwebBean){// Code from Step 4.3 omitted for clarity... The following should be// added after the code you added above.
// Get the CustomerName parameter from the URLString Name = pageContext.getParameter("customerName");
// Always use a translated value from Message Dictionary when setting// strings in your controllers.// Instantiate an array of message tokens and set the value for the// CUST_NAME token.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-80 Oracle Applications Framework - Practices and Solutions
MessageToken[] tokens = { new MessageToken("CUST_NAME", Name)};
// Now, get the translated message text including the token value.String pageHeaderText =pageContext.getMessage("DEMXX","ORDLINES_HDR_TEXT", tokens);
// Set the order-specific page title (which also appears in// the breadcrumbs). Note that we know this controller is// associated wit the pageLayout region, which is why we cast the// webBean to an OAPageLayoutBean before calling setTitle.
((OAPageLayoutBean)webBean).setTitle(pageHeaderText);}
4.5 Save and Test Your Work
Select the JDeveloper main menu option File > Save All.
Select your project, right-click and select Rebuild OrderEntry.jpr to compileeverything (you can also select the same option from the main menu).
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml (if youwant to debug, select Debug EmpSearchPG.xml).
To test the Details page, query one or more orders and select the Order Number link.The Details page should render as shown in Figure 2 above. Note that thebreadcrumbs will not render if you run the page directly from JDeveloper asdescribed here since the associated application menu does not render in this mode(breadcrumbs render only if the menu renders).
You are now finished with this exercise.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-81
Lab 4: Orders: Create
Overview
In this exercise, we will add a Create Order button to our Orders search page
Warning: This lab assumes that you have completed the Search Exercise and the Drilldown toDetails Exercise, and builds on that work. If you have not completed these exercises, please doso before proceeding.
Figure 1: Create Page Finished Product
1: Revise the Search Page to Include a Create Order Button
1.1 Add a "Create Order" Button to Your Search Page
First, you need to revise the OrderSearchPG to include a Create Order button above the resultstable. To do this, you will need to add a tableAction component to the Results table that youcreated in the Search Exercise.
Select the ResultsTable region in the Structure pane, right-click and select New >tableActions from the context menu.
JDeveloper automatically creates a flowLayout region for you. Change this region's
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-82 Oracle Applications Framework - Practices and Solutions
ID to ButtonLayout.
Select the ButtonLayout region, right-click and select New > Item. Set this item'sproperties as follows:
Property ValueID CreateItem Style SubmitButtonAttribute Set /oracle/apps/fnd/attributesets/Buttons/CreatePrompt Create OrderAdditional Text Select to create an order
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
1.2 Add "Create Order" Button Press Handler to Your Search Page
When the user presses the Create Order submitButton, you need processFormRequest() code todetermine that this button has been pressed and navigate the user to the OrderCreatePG thatyou will be creating in Task 3 below.
First, create a controller and associate with the PageLayoutRN region in the OrderSearchPG.
Select the PageLayoutRN region in the OrderSearchPG, right-click and select SetNew Controller ... from the context menu.
In the Package Name field enter<yourname>.oracle.apps.demxx.orderentry.webui.
In the Name field enter OrderSearchCO.
Select the OK button to create your controller.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-83
Then, add the following code to the OrderSearchCO.processFormRequest( ) method:import oracle.apps.fnd.framework.webui.OAWebBeanConstants;...
public void processFormRequest(OAPageContext pageContext, OAWebBeanwebBean){// Always call this first
super.processFormRequest(pageContext, webBean);
if (pageContext.getParameter("Create")!=null){
// Navigate to the Order Create Page while retaining the AM.// Note the use of KEEP_MENU_CONTEXT as opposed to
GUESS_MENU_CONTEXT// since we know the current tab should remain highlighted.
pageContext.setForwardURL("OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/OrderCreatePG",
null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null, //HashMaptrue, // Retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_YES,OAWebBeanConstants.IGNORE_MESSAGES);
}}
1.3 Compile and Save Your Work
At this point, you are not ready for testing.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-84 Oracle Applications Framework - Practices and Solutions
2: Create a View Object for the Order Status Poplist
The Create Order page will include a poplist for choosing the order's status. Before creating thepage, we need to create a view object to be used for the poplist data.
To learn more about poplists (and other standard basic components like text fields, checkboxes,radio buttons, list boxes and so forth), see Standard Web Widgets in the OA FrameworkDeveloper's Guide.
2.1 Create a Poplist View Object BC4J Package
Per the OA Framework File Standards, all view objects created explicitly for use in poplists mustbe created in a special, product-level directory.
In your OrderEntry.jpr project, create a new business components package with
<yourname>.oracle.apps.demxx.poplist.server as the package name.
2.2.1 Create the OrderStatusVO in the Poplist BC4J Package
In the <yourname>.oracle.apps.demxx.poplist.server package, create a new viewobject with OrderStatusVO as the view object name and verify that the Package is<yourname>.oracle.apps.demxx.poplist.server.
A poplist view object includes two attributes: one for the display value, and one forthe internal selection value. Use the following query (in this case, meaning is thedisplay value and lookup_code is the internal developer value):
SELECT meaning, lookup_codeFROM fnd_lookupsWHERE lookup_type = 'ORDER_STATUS_LOOKUP'
You should not generate a *VOImpl file (you will not need any code for this), butyou must generate the *VORowImpl file as usual per the coding standards.
2.2.2 Add the OrderStatusVO to the OrderEntryAM
Add the OrderStatusVO view object to the OrderEntryAM.
2.3.1 Create the CcTypeVO in the Poplist BC4J Package
In the <yourname>.oracle.apps.demxx.poplist.server package, create a new viewobject with CcTypeVO as the view object name and verify that the Package is<yourname>.oracle.apps.demxx.poplist.server.
A poplist view object includes two attributes: one for the display value, and one forthe internal selection value. Use the following query (in this case, meaning is the
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-85
display value and lookup_code is the internal developer value):SELECT meaning, lookup_codeFROM fnd_lookupsWHERE lookup_type = 'CCTYPE_LOOKUP'
You should not generate a *VOImpl file (you will not need any code for this), butyou must generate the *VORowImpl file as usual per the coding standards.
2.3.2 Add the CcTypeVO to the OrderEntryAM
Add the CcTypeVO view object to the OrderEntryAM.
2.4 Compile and Save Your Work
At this point, you are not ready for testing.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-86 Oracle Applications Framework - Practices and Solutions
3: Build the Create Page
In this section, you will create an order Create page as shown in Figure 1 above.
3.1 Create the OrderCreatePG Page
Create a new OA Components page in the<yourname>.oracle.apps.demxx.orderentry.webui package calledOrderCreatePG.
3.2 Modify the pageLayout Region
Verify and set (if necessary) the following properties for the pageLayout region ofyour new OrderCreatePG:
Property ValueID PageLayoutRNRegion Style pageLayoutAM Definition <yourname>.oracle.apps.demxx.orderentry.server.OrderEntryAMWindow Title Order Entry Tutorial: Labs <your name>Title Orders: CreateWarn About Changes TrueAutoFooter True
Note that setting the Warn About Changes property to True ensures that users are warned whenthey try to navigate from this data entry page with pending changes (the page's Cancel button isan exception, as you will see later). See the Save Model documentation for additionalinformation about this.
3.3 Add a Product Branding Image
Add the product branding image, FNDTAPPBRAND.gif, to your page, similar tothe step done in Order search page. Make sure you include additional text for thesame.
3.4 Add Page-Level Apply and Cancel Buttons
Per the BLAF UI guidelines, all page-level buttons render twice on the page: below the pagetitle, and below the ski. However, you only need to add them once using a specialpageButtonBar region.
First, select the PageLayoutRN in the Structure pane, then right-click and selectNew > Region from the context menu.
Set the following properties for this region:
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-87
Property ValueID PageButtonsRegion Style pageButtonBar
Second, add a Cancel button. Right-click PageButtons in the Structure pane, andselect New > Item from the context menu. Set or verify the following properties forthis item:
Property ValueID CancelItem Style submitButtonAttribute Set /oracle/apps/fnd/attributesets/Buttons/Cancel
(Always use the standard OA Framework attribute sets for commonbuttons.)
Disable Server SideValidation
True(So the user can leave the page by selecting this button withoutencountering server- side validation errors.)
Disable Client SideValidation
True(So the user can leave the page by selecting this button withoutencountering client- side validation errors.)
Prompt Cancel(Set automatically when you specify the attribute set.)
Warn About Changes False(So the user can leave the page by selecting this button without beingwarned about pending changes.)
Additional Text Select to cancel this transaction.(This is required per the accessibility coding standards).
Third, add an Apply button. Right-click PageButtons in the Structure pane, andselect New > Item from the context menu. Set or verify the following properties forthis item:
Property ValueID ApplyItem Style submitButtonAttribute Set /oracle/apps/fnd/attributesets/Buttons/ApplyPrompt Apply
(Set by the attribute set.)Additional Text Select to save this order.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-88 Oracle Applications Framework - Practices and Solutions
3.5 Create the Main Content Region
To achieve the correct indentation of our display fields, add a defaultSingleColumn region toyour PageLayoutRN. Since each of the items in this region will bind to the OrderDetailsVOview instance, we will use the region wizard to quickly create this.
Select the PageLayoutRN in the Structure pane, right-click and select New >Region Using Wizard from the context menu.
In the BC4J Objects page, select your OrderEntryAM(<yourname>.oracle.apps.demxx.orderentry.server.OrderEntryAM), and thenselect your OrderDetailsVO view object instance from the Available View Objectslist.
DO NOT select the Use this as Application Module Definition for this regioncheckbox.
In the Region Properties page, set the Region ID field value to MainRN and set theRegion Style to defaultSingleColumn.
In the View Attributes page, select the following attributes in the Available ViewAttributes list and shuttle them to the Selected View Attributes list:
o OrderId
o CustomerId
o SalesRepId
o PaymentType
o CurrencyCode
o OrderStatus
o DateOrdered
o DateShipped
o CheckNumber
o CcType
o CcNumber
o CcExpiration
o CcApprovalCode
o OrderNote
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-89
o CustomerName
o SalesRepName
o AttributeCategory
o Attribute1
o Attribute2
o Attribute3
o Attribute4
o Attribute5
o Attribute6
o Attribute7
o Attribute8
o Attribute9
o Attribute10
In the Region Items page, set the ID, Prompt, Style as follows:
ID Prompt Style Data Type Attribute SetOrderId Order Number messageStyledText NUMBERCustomerId Customer Number messageLovInput NUMBERSalesRepId Salesperson Number messageTextInput NUMBERPaymentType Payment Type messageTextInput VARCHAR2CurrencyCode Currency messageLovInput VARCHAR2OrderStatus Order Status messageChoice VARCHAR2DateOrdered Order Date messageTextInput DATEDateShipped Ship Date messageTextInput DATECheckNumber Number messageTextInput NUMBERCcType Type messageChoice VARCHAR2CcNumber Number messageTextInput VARCHAR2CcExpiration Expiration messageTextInput VARCHAR2CcApprovalCode Approval Code messageTextInput VARCHAR2OrderNote Order Note messageTextInput VARCHAR2CustomerName Customer Name messageLovInput VARCHAR2SalesRepName Salesperson Name messageLovInput VARCHAR2AttributeCategory AttributeCategory messageTextInput VARCHAR2Attribute1 Attribute1 messageTextInput VARCHAR2Attribute2 Attribute2 messageTextInput VARCHAR2Attribute3 Attribute3 messageTextInput VARCHAR2
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-90 Oracle Applications Framework - Practices and Solutions
ID Prompt Style Data Type Attribute SetAttribute4 Attribute4 messageTextInput VARCHAR2Attribute5 Attribute5 messageTextInput VARCHAR2Attribute6 Attribute6 messageTextInput VARCHAR2Attribute7 Attribute7 messageTextInput VARCHAR2Attribute8 Attribute8 messageTextInput VARCHAR2Attribute9 Attribute9 messageTextInput VARCHAR2Attribute10 Attribute10 messageTextInput VARCHAR2
Click the Finish button to create your data table.
3.6 Finish Setting MainRN Item Properties
Before we proceed further, rearrange the items (by drag-and-drop) to display details in aparticular order in the OrderCreatePG. The order prescribed here is –
o OrderId
o DateOrdered
o OrderStatus
o DateShipped
o CustomerId
o CustomerName
o SalesRepName
o CurrencyCode
o PaymentType
o CheckNumber
o CcType
o CcNumber
o CcExpiration
o CcApprovalCode
o OrderNote
o SalesRepId
o AttributeCategory
o Attribute1
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-91
o Attribute2
o Attribute3
o Attribute4
o Attribute5
o Attribute6
o Attribute7
o Attribute8
o Attribute9
o Attribute10
Most of the MainRN item properties were set when you created the defaultSingleColumnregion. Now, you need to complete the process of setting their properties.
Open each of the following items in the MainRN and set/verify the followingadditional properties as shown.
OrderId
We are going to automatically generate the new order number using a database sequence, so thisvalue is display only.
Property ValueRequired YesCSS Class OraDataText
DateOrdered
Property ValueRequired YesCSS Class OraFieldTextTip Type DateFormat
Whenever you set the Required property to yes, a required field indicator renders next to theprompt. Also, when the page is submitted, UIX verifies that this field is non-null before issuing aPOST request to the server.
OrderStatus
The OrderStatus item is a poplist. You have already specified the data source for the item's value(the OrderStatus view object attribute): like any other text field, this is the view object attribute
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-92 Oracle Applications Framework - Practices and Solutions
value that we will set in the OrderDetailsVO view object based on the user's poplist selection.In this step, you need to associate the 2- value view object that you created in Task 2 with thepoplist so the poplist can display its list of selectable values.
Tip: If the "Picklist" properties do not display in the property inspector, verify that the ItemStyle is messageChoice.
Property ValueRequired yesPicklist View Instance OrderStatusVO
(Name of the view object to be used for the poplist values.)Picklist Display Attribute Meaning
(The value to display in the poplist.)Picklist Value Attribute LookupCode
(The internal developer value.)CSS Class OraFieldText
DateShipped
Property ValueCSS Class OraFieldText
CustomerId
The CustomerId field requires a list of values; we can reuse the CustomerLovRN that wealready created in the Search lab.
Tip: If the External LOV property does not display in the property inspector, verify that the ItemStyle is messageLovInput.
Property ValueRequired YesExternal LOV /<yourname>/oracle/apps/demxx/lov/webui/CustomerLovRNMaximum Length 15CSS Class OraFieldTextLOV Mappings You must create LOV mappings for the
following:LOV Map 1 ID: CustIdMap Lov Region Item: CustId Return Item: CustomerId Criteria Item: CustomerIdLOV Map 2 ID: CustNameMap Lov Region Item: CustName Return Item: CustomerName
CustomerName
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-93
The CustomerName field requires a list of values as well; similarly we can reuse theCustomerLovRN that we already created in the Search lab.
Tip: If the External LOV property does not display in the property inspector, verify that the ItemStyle is messageLovInput.
Property ValueRequiredRequired
Yes
External LOV /<yourname>/oracle/apps/demxx/lov/webui/CustomerLovRNMaximum Length 50CSS Class OraFieldTextLOV Mappings You must create LOV mappings for the following:
LOV Map 1 ID: CustNameMap1 Lov Region Item: CustName Return Item: CustomerName Criteria Item: CustomerNameLOV Map 2 ID: CustIdMap1 Lov Region Item: CustId Return Item: CustomerId
SalesRepName
The SalesRepName field again requires a list of values; hence we can reuse the SalesRepLovRNthat we already created in the Search lab.
Tip: If the External LOV property does not display in the property inspector, verify that the ItemStyle is messageLovInput.
Property ValueExternal LOV /<yourname>/oracle/apps/demxx/lov/webui/SalesRepLovRNMaximum Length 101CSS Class OraFieldTextLOV Mappings You must create LOV mappings for the following:
LOV Map 1 ID: RepNameMap Lov Region Item: SalesRepName Return Item: SalesRepName Criteria Item: SalesRepNameLOV Map 2 ID: RepIdMap Lov Region Item: SalesRepId Return Item: SalesRepId
CurrencyCode
Create the CurrencyCode LOV View Object
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-94 Oracle Applications Framework - Practices and Solutions
Select the <yourname>.oracle.apps.demxx.lov.server package in the Navigator,right-click and select "New View Object..." from the context menu to open theView Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify CurrencyCodeLovVO as the view object name andverify that the Package is <yourname>.oracle.apps.demxx.lov.server.
Select the Next button until you get to the Query page.
In the Query page, enter the following query into the Query Statement text field.SELECT currency_code
,nameFROM fnd_currencies_active_v
Select the Test button to ensure your syntax is correct.
Select the Next button until you get to the Java page.
In the Java page, deselect the Generate Java File for View Object Class:CurrencyCodeLovVOImpl (as you do not have to add any code to this view object).Do select the Generate Java File for View Row Class:CurrencyCodeLovVORowImpl to comply with OA Framework coding standards.
Select the Finish button to create your VO.
Add the CurrencyCodeLovVO to the OrderEntryLovAM
View objects can be used only within the context of a containing application module. Before weuse the CurrencyCodeLovVO in our LOV, we must add it to the LOV application module.
Select the OrderEntryLovAM in the Navigator pane; right-click and select EditOrderEntryLovAM... from the context menu to open the Application Modulewizard.
Navigate to the Data Model page.
Select the CurrencyCodeLovVO view object in the Available View Objects list andshuttle it to the Data Model list. Change Instance name on the right fromCurrencyCodeLovVO1 to CurrencyCodeLovVO. Select the OK button to finishadding this VO to the AM.
Create the Shared CurrencyCodeLovRN LOV Region
Since the Customer details LOV can be used in many different pages, it must be created as ashared, standalone region.
Select the OrderEntry.jpr project in the Navigator, right-click and select New...from the context menu.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-95
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Region in the OA Components Items list.
Select the OK button to continue.
In the New Region dialog, specify the following values:
o In the Name field enter CurrencyCodeLovRN.
o In the Package field enter <yourname>.oracle.apps.demxx.lov.webui.
o In the Style field select listOfValues.
o Click the OK button to create your region.
o Select the CurrencyCodeLovRN in the Structure pane, set the AMDefinition property to<yourname>.oracle.apps.demxx.lov.server.OrderEntryLovAM,set the Advanced Search Allowed property to True and set the Scopeproperty to Public.
Add a Table to the LOV Region
Select the CurrencyCodeLovRN in the Structure pane, right-click and select New >table Using Wizard from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your OrderEntryLovAM(<yourname>.oracle.apps.demxx.lov.server.OrderEntryLovAM),then select your CurrencyCodeLovVO view object instance from the AvailableView Objects list. DO NOT select the Use this as Application Module Definition forthis region checkbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to CurrCodeLovTableand set the Region Style to table. Select the Next button.
In the View Attributes page, add all the attributes in the CurrencyCodeLovVO.
Select the Next button.
In the Region Items page, set the ID, Style properties as follows
ID Prompt Style Data Type Attribute Set
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-96 Oracle Applications Framework - Practices and Solutions
CurrencyCode Code messageStyledText VARCHAR2CurrencyName Name messageStyledText VARCHAR2
Click the Finish button to create your data table.
Set the Additional Text property on your table to Currency Details List.
Select the CurrencyCode and CurrencyName item in the Structure pane, and set their SearchAllowed properties to True. Thefirst property lets users search on these values in the LOV.
Now select your CurrencyCode item in your OrderCreatePG and set the following properties:
Property ValueRequired yesExternal LOV /<yourname>/oracle/apps/demxx/lov/webui/CurrencyCodeLovRNMaximum Length 15Length 5CSS Class OraFieldTextLOV Mappings You must create LOV mappings for the following:
LOV Map 1 ID: CodeMap Lov Region Item: CurrencyCode Return Item: CurrencyCode Criteria Item: CurrencyCode
CheckNumber
Property ValueMaximum Length 15CSS Class OraFieldText
CcType
The CcType item is a poplist. You have already specified the data source for the item's value (theCcType view object attribute): like any other text field, this is the view object attribute value thatwe will set in the OrderDetailsVO view object based on the user's poplist selection. In this step,you need to associate the 2- value view object that you created in Task 2 with the poplist so thepoplist can display its list of selectable values.
Tip: If the "Picklist" properties do not display in the property inspector, verify that the ItemStyle is messageChoice.
Property ValuePicklist View Instance CcTypeVO
(Name of the view object to be used for the poplist values.)Picklist Display Attribute Meaning
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-97
(The value to display in the poplist.)Picklist Value Attribute LookupCode
(The internal developer value.)CSS Class OraFieldText
CcNumber
Property ValueMaximum Length 30CSS Class OraFieldText
CcExpiration
Property ValueMaximum Length 5CSS Class OraFieldText
CcApprovalCode
Property ValueMaximum Length 15CSS Class OraFieldText
OrderNote
Property ValueMaximum Length 2000CSS Class OraFieldTextLength 110
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-98 Oracle Applications Framework - Practices and Solutions
3.7 Focus on Layout
3.7.1 Convert the MainRN Style from defaultSingleColumn tomessageComponentLayout
As we did in the Drilldown to Details exercise, change the MainRN Region Style tomessageComponentLayout:
Select the MainRN defaultSingleColumn region and change its Region Style propertyto messageComponentLayout. JDeveloper will display a warning; select the Yes button to
proceed. Your items will not be adversely affected.
Tip: The messageComponentLayout region style is new in release 11.5.10 (and should be usedin place of all default* regions which will eventually be deprecated). Since "region usingwizard" creation support is not yet available for the messageComponentLayout, this is the mostefficient way to create a single row region whose items bind to a view object instance.
Select the messageComponentLayout region, right-click and select New >messageLayout.
Set the messageLayout ID to FormValueLayout.
Select the following items and drag and drop each of them beneath themessageLayout region.
Now drag and drop the following items in the MainRN to the FormValueLayout.
o SalesRepId
o AttributeCategory
o Attribute1
o Attribute2
o Attribute3
o Attribute4
o Attribute5
o Attribute6
o Attribute7
o Attribute8
o Attribute9
o Attribute10
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-99
In the Property Inspector, change the Item Style of all these items to formValue andset the following properties for each of them. Note that the View Attribute may bereset when we change the Item Style to formValue.
Assign the View Attribute property of all these items back to their original value justin case they are lost.
FormValue Item View AttributeSalesRepId SalesRepIdAttributeCategory AttributeCategoryAttribute1 Attribute1Attribute2 Attribute2Attribute3 Attribute3Attribute4 Attribute4Attribute5 Attribute5Attribute6 Attribute6Attribute7 Attribute7Attribute8 Attribute8Attribute9 Attribute9Attribute10 Attribute10
Also remember to set the Data Type property of SalesRepId to NUMBER.
Note: We have to create this extra region, as we cannot directly add a non-message item (such asformValue item) to a messageComponentLayout as a child. In such cases, we add amessageLayout to which all our non-message items are added. To learn more about workingwith the messageComponentLayout region, see Page Layout (How to Place Content) in the OAFramework Developer's Guide.
3.7.2 Create a new messageComponentLayout Region for PaymentTypeRN
Select the PageLayoutRN, right-click and select New > Region
Select the header region region1 that JDeveloper creates for you beneath theMainRN component and set its ID to PaymentTypeRN.
Set the Region Style Property to messageComponentLayout.
Now drag and drop the following items in the MainRN to the PaymentTypeRN aschildren:
o PaymentType
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-100 Oracle Applications Framework - Practices and Solutions
o CheckNumber
o CcType
o CcNumber
o CcExpiration
o CcApprovalCode
3.7.3 Create a new messageComponentLayout Region for FooterRN
Select the PageLayoutRN, right-click and select New > Region
Select the header region region1 that JDeveloper creates for you beneath thePaymentTypeRN component and set its ID to FooterRN.
Set the Region Style Property to messageComponentLayout.
Now drag and drop the OrderNote item in the MainRN to the FooterRN as child.
3.7.4 Adjusting the Layout for MainRN
Select the MainRN, in the property inspector set the following properties
Property ValueRows 8Columns 2
Select the MainRN, right-click and select New > messageLayout.
Set the messageLayout ID to TableContentLayout.
Select the TableContentLayout, right-click and select New > Region.
Set the region ID to TableLayout.
Set the Region Style of this region to tableLayout.
Set the Horizontal Alignment to center
Set the Width to 100%
Select the TableLayout, right-click and select New > rowLayout.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-101
Set the region ID to RowOneRN.
Select the RowOneRN , right-click and select New > cellFormat.
Set the region ID to CellOne.
Select the RowOneRN , right-click and select New > cellFormat.
Set the region ID to CellTwo.
Repeat the steps mentioned above to get rest of the cells.
For RowTwoRN
Select the TableLayout, right-click and select New > rowLayout.
Set the region ID to RowTwoRN.
Select the RowTwoRN, right-click and select New > cellFormat.
Set the region ID to CellThree.
Select the RowTwoRN, right-click and select New > cellFormat.
Set the region ID to CellFour.
For RowThreeRN
Select the TableLayout, right-click and select New > rowLayout.
Set the region ID to RowThreeRN.
Select the RowThreeRN, right-click and select New > cellFormat.
Set the region ID to CellFive.
For RowFourRN
Select the TableLayout, right-click and select New > rowLayout.
Set the region ID to RowFourRN.
Select the RowFourRN, right-click and select New > cellFormat.
Set the region ID to CellSix.
For RowFiveRN
Select the TableLayout, right-click and select New > rowLayout.
Set the region ID to RowFiveRN.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-102 Oracle Applications Framework - Practices and Solutions
Select the RowFiveRN, right-click and select New > cellFormat.
Set the region ID to CellSeven.
Select the RowFiveRN, right-click and select New > cellFormat.
Set the region ID to CellEight.
Set the items into different cells as follows
Now individually drag-and-drop
OrderId into CellOne as child
DateOrdered into CellTwo as child
OrderStatus into CellThree as child
DateShipped into CellFour as child
CustomerId into CellFive as child
CustomerName into CellSix as child
SalesRepName into CellSeven as child
CurrencyCode into CellEight as child
Set or verify the following properties for the items- CellOne, CellTwo, CellThree, CellFour,CellFive, CellSix, CellSeven and CellEight
Property ValueHorizontal Alignment centerVertical Alignment top
Drag-and-drop FormValueLayout to the end below TableContentLayout so that the Structurewindow looks similar to what is shown in the figure below:
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-103
3.7.5 Adjusting the Layout for PaymentTypeRN
Select the PaymentTypeRN, in the property inspector set the following properties
Property ValueRows 6Columns 3
Select the PaymentTypeRN, right-click and select New > messageLayout.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-104 Oracle Applications Framework - Practices and Solutions
Set the messageLayout ID to PaymentContentLayout.
Select the PaymentContentLayout, right-click and select New > Region.
Set the region ID to PaymentTypeTable.
Set the Region Style of this region to tableLayout.
Set the Horizontal Alignment to center.
Set the Width to 100%
Select the PaymentTypeTable, right-click and select New > rowLayout.
Set the region ID to FirstRowRN.
Select the FirstRowRN, right-click and select New > cellFormat.
Set the region ID to FirstCell.
Select the FirstRowRN, right-click and select New > cellFormat.
Set the region ID to SecondCell.
Repeat the steps mentioned above to create rest of the cells.
For SecondRowRN
Select the PaymentTypeTable, right-click and select New > rowLayout.
Set the region ID to SecondRowRN.
Select the SecondRowRN, right-click and select New > cellFormat.
Set the region ID to ThirdCell.
Select the SecondRowRN, right-click and select New > cellFormat.
Set the region ID to FourthCell.
Select the SecondRowRN, right-click and select New > cellFormat.
Set the region ID to FifthCell.
For ThirdRowRN
Select the PaymentTypeTable, right-click and select New > rowLayout.
Set the region ID to ThirdRowRN.
Select the ThirdRowRN, right-click and select New > cellFormat.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-105
Set the region ID to SixthCell.
Select the ThirdRowRN, right-click and select New > cellFormat.
Set the region ID to SeventhCell.
For FourthRowRN
Select the PaymentTypeTable, right-click and select New > rowLayout.
Set the region ID to FourthRowRN.
Select the FourthRowRN, right-click and select New > cellFormat.
Set the region ID to EighthCell.
For FifthRowRN
Select the PaymentTypeTable, right-click and select New > rowLayout.
Set the region ID to FifthRowRN.
Select the FifthRowRN, right-click and select New > cellFormat.
Set the region ID to NinthCell
For SixthRowRN
Select the PaymentTypeTable, right-click and select New > rowLayout.
Set the region ID to SixthRowRN.
Select the SixthRowRN, right-click and select New > cellFormat.
Set the region ID to TenthCell
We populate the different cells with the items as follows
Select FirstCell, right-click and select New > Region.
Set the Region ID to PaymentTypeHdr.
Set the Text property to Payment Type.
Select SecondCell, right-click and select New > Item.
Set the following properties for the item
Property ValueID FirstVertiSpaceItem Style spacer
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-106 Oracle Applications Framework - Practices and Solutions
Height 70Width 1
Select ThirdCell, right-click and select New > Item.
Set the following properties for the item
Property ValueID cashRBItem Style messageRadioButtonChecked Value CASHView Instance OrderDetailsVOView Attribute PaymentTypePrompt Cash
Select FourthCell, right-click and select New > Item.
Set the following properties for the item
Property ValueID checkRBItem Style messageRadioButtonChecked Value CHECKView Instance OrderDetailsVOView Attribute PaymentTypePrompt Cheque
Select FifthCell, right-click and select New > Item.
Set the following properties for the item
Property ValueID creditCardRBItem Style messageRadioButtonChecked Value CHARGEView Instance OrderDetailsVOView Attribute PaymentTypePrompt Credit Card
Now individually drag-and-drop
CheckNumber into SixthCell as child.
CcType into SeventhCell as child.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-107
CcNumber into EighthCell as child
CcExpiration into NinthCell as child
CcApprovalCode into TenthCell as child
Set or verify the following properties for the mentioned regions and items –
For FirstRowRN
Property ValueHorizontal Alignment start
For SecondRowRN
Property ValueHorizontal Alignment center
For ThirdRowRN
Property ValueHorizontal Alignment rightVertical Alignment top
For FourthRowRN
Property ValueHorizontal Alignment right
For FifthRowRN
Property ValueHorizontal Alignment right
For SixthRowRN
Property ValueHorizontal Alignment right
For SecondCell
Property Value
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-108 Oracle Applications Framework - Practices and Solutions
Property ValueColumn Span 2
For ThirdCell
Property ValueVertical Alignment topRow Span 5
For SixthCell
Property ValueHorizontal Alignment rightVertical Alignment topRow Span 4
For SeventhCell
Property ValueHorizontal Alignment right
Now delete the PaymentType messageTextInputType item by right-clicking on it and selectingdelete so that the Structure window looks similar to what is shown in the figure below
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-109
3.7.6 Adjusting the Layout for FooterR
Select the FooterRN, in the property inspector set the following properties
Property ValueRows 3
Select the FooterRN, right-click and select New > messageLayout.
Set the messageLayout ID to OrderNoteLayout.
Select the OrderNoteLayout, right-click and select New > Region.
Set the region ID to OrderNoteRowRN.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-110 Oracle Applications Framework - Practices and Solutions
Set the Region Style of this region to rowLayout.
Drag and drop OrderNote to OrderNoteRow as a child.
Select the FooterRN, right-click and select New > messageLayout.
Set the messageLayout ID to ButtonLayout
Select the ButtonLayout, right-click and select New > Region
Set the region ID to ButtonRowRN
Set the Region Style of this region to rowLayout
Select the ButtonRowRN, right-click and select New > Item
Set the item ID to OrderLinesButton,Style to submitButton and Prompt toOrder Lines
Set the Disable Server Side Validation to True
The FooterRN now should appear as shown in the figure below.
Select OrderNoteRowRN and set the Horizontal Alignment property to center.
Select OrderNoteRowRN Item, right-click and select New > Item.
Set the following properties for the item
Property ValueID OrdNoteVertiSpaceItem Style SpacerWidth 1Height 75
Drag-and-drop the OrdNoteVertiSpace before OrderNote
Select ButtonRowRN and set the Horizontal Alignment property to right.
Select ButtonRowRN Item, right-click and select New > Item.
Set the following properties for the item
Property ValueID LastRowVertiSpaceItem Style SpacerWidth 1Height 35
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-111
3.8 Add an "Indicates Required Field" Region
The "Indicates Required Field" region should render on the same line as the page-levelaction/navigation buttons. To achieve this, always add page-level keys like this to a pageStatuscomponent.
Select the PageLayoutRN, right-click and select New > pageStatus.
Select the flowLayout region that JDeveloper creates for you beneath thepageStatus component and set its ID to PageStatusRN.
Select PageStatusRN, right-click and select New > Region.
Set the following properties for this region (whenever you need a BLAF-standard"Indicates Required Field" key in your page, you can simply extend the common OAFramework region shown below).
Property ValueID RequiredKeyExtends /oracle/apps/fnd/framework/webui/OAReqFieldDescRGWidth 100%
Note: When you set the Extends property to this region, JDeveloper may display a confirmationmessage like the following. If so, select Yes to proceed.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-112 Oracle Applications Framework - Practices and Solutions
Component "/oracle/apps/fnd/framework/webui/OAReqFieldDescRG" cannot be referenced from
"/<yourname>/oracle/apps/demxx/orderentry/webui/OrderCreatePG.RequiredKey" because itviolates scope restrictions. Are you sure you want to use component
"/oracle/apps/fnd/framework/webui/OAReqFieldDescRG"?
For additional information about configuring content to render in parallel with page-levelaction/navigation buttons, see Page Stamps in the OA Framework Developer's Guide.
3.9 Save and Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
Select the Create Order button. The CreateOrderPG should appear approximatelyas shown in Figure 1 (without the order number and with no radio button selected).You will not be able to do anything in the ‘Orders: Create’ page because you havenot yet added any logic.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-113
4: Implement Browser Back Button Safe Page Initialization andcreate/rollback Methods
4.1 Add a createOrderEntry( ) Method to Your OrderEntryAMImpl Class
Add the following method to your OrderEntryAMImpl class for creating a new order in theOrderDetailsVO view object (the call to vo.createRow() ultimately calls a create( ) method inyour OrderEOImpl entity object that you will be coding a bit later).
import oracle.apps.fnd.framework.OAViewObject;import oracle.apps.fnd.framework.OARow;
...
/********************************************************** Creates a new Order********************************************************/
public void createOrderEntry(){OAViewObject orderEntryVO = (OAViewObject)getOrderDetailsVO();if(orderEntryVO != null){OARow orderEntryRow =(OARow)orderEntryVO.createRow();if(orderEntryRow != null){orderEntryVO.setMaxFetchSize(0);orderEntryVO.insertRow(orderEntryRow);orderEntryRow.setNewRowState(orderEntryRow.STATUS_INITIALIZED);orderEntryVO.setCurrentRow(orderEntryRow);
}}
}
4.2 Add a rollbackOrder( ) Method to Your OrderEntryAMImpl Class
Add the following method to your OrderEntryAMImpl class for rolling back the database and themiddle tier (you will see how you are going to use this a bit later).
Note that we call getTransaction() here to use an oracle.jbo.Transaction instead of callinggetOADBTransaction() to get an OAF subclassoracle.apps.fnd.framework.server.OADBTransaction because the super class has the behavior weneed, and as a rule, you should always instantiate the class that includes the behavior you want touse. Avoid instantiating subclasses if the additional behavior is not required.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-114 Oracle Applications Framework - Practices and Solutions
import oracle.jbo.Transaction;.../************************************************************************ Executes a rollback including the database and the middle tier.**********************************************************************/public void rollbackOrder(){
Transaction txn = getTransaction();// This small optimization ensures that we don't perform a rollback// if we don't have to.
if (txn.isDirty()){txn.rollback();
}} // end rollbackOrder()
4.3 Add Back Button Handling to the OrderSearchCO processRequest( )
To account for various Back button navigation patterns between the Create Order page and theSearch page, add the following logic to your OrderSeachCO controller's processRequest()method. This ensures that any unfinished order objects are cleared from the middle tier cachewhen the user navigates to the Search page using the browser Back button, and then tries tocreate a new order.
Note: When you are ready to start building your own products, you can learn more about codingfor the browser Back button in the OA Framework Developer's Guide advanced topic Supportingthe Browser Back Button. You can learn about passivation in the OA Framework StateManagement (Passivation) topic.
Note that you will be adding the rollbackOrder() method to your OrderEntryAMImpl class a bitlater in this exercise.
import oracle.apps.fnd.framework.webui.TransactionUnitHelper;import oracle.apps.fnd.framework.OAApplicationModule;...public void processRequest(OAPageContext pageContext, OAWebBean
webBean){super.processRequest(pageContext, webBean);OAApplicationModule am = pageContext.getApplicationModule(webBean);
// The following checks to see if the user navigated back to thispage
// without taking an action that cleared an "in transaction"indicator.
// If so, we want to rollback any changes that he abandoned to ensurethey
// aren't left lingering in the BC4J cache to cause problems with// subsequent transactions. For example, if the user navigates to the// Create Orders page where you start a "create" transaction unit,// then navigates back to this page using the browser Back button and
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-115
// selects the Create Orders button again, the OA Framework detectsthis
// Back button navigation and steps through processRequest() so thiscode
// is executed before you try to create another new order.
if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"ordCreateTxn", false))
{am.invokeMethod("rollbackOrder");TransactionUnitHelper.endTransactionUnit(pageContext,
"ordCreateTxn");}
}
4.4 Add Create Page Initialization
This page includes logic to ensure that the user does not encounter errors due to navigation usingthe browser Back button. For example, it is important to ensure that there are no partially createdOrderEO entity objects in the middle tier cache when the user tries to create a new order. Whilethe solution prevents page access after "invalid" Back button navigation, the code below allowsthe page to be properly rebuilt if the transaction is passivated.
First, create a controller and associate with the pageLayoutRN region in the OrderCreatePG.
Select the pageLayoutRN region in the OrderCreatePG, right-click and select SetNew Controller ... from the context menu.
In the Package Name field enter<yourname>.oracle.apps.demxx.orderentry.webui.
In the Name field enter OrderCreateCO.
Select the OK button to create your controller.
Then, add the following code to your processRequest() method to be called when the page isinitialized:
import oracle.apps.fnd.framework.OAApplicationModule;import oracle.apps.fnd.framework.webui.OADialogPage;import oracle.apps.fnd.framework.webui.TransactionUnitHelper;importoracle.apps.fnd.framework.webui.beans.message.OAMessageRadioButtonBean;importoracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;importoracle.apps.fnd.framework.webui.beans.message.OAMessageDateFieldBean;import oracle.apps.fnd.framework.server.OADBTransaction;importoracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;...public void processRequest(OAPageContext pageContext, OAWebBean
webBean)
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-116 Oracle Applications Framework - Practices and Solutions
{// Always call this first.super.processRequest(pageContext, webBean);// If isBackNavigationFired = false, we're here after a valid
navigation// (the user selected the Create Order button) and we should proceed// normally and initialize a new order.if (!pageContext.isBackNavigationFired(false)){// We indicate that we are starting the create transaction (this// is used to ensure correct Back button behavior).
TransactionUnitHelper.startTransactionUnit(pageContext,"ordCreateTxn");
// This test ensures that we don't try to create a new order if// we had a JVM fail over, or if a recycled application module// is activated after passivation. If these things happen, BC4J will// be able to find the row that you created so the user can resume// work.
if (!pageContext.isFormSubmission()){OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
am.invokeMethod("createOrderEntry", null);
// Add Default RadioButton Selection during Page Initialization// The radio-buttons added for PaymentType have to be configured as
a// single group first. The cash radio-button should be selected as
default// when the page renders.// The following logic does that.
/************ Radiobuttons as a Group Horizontally*******************/
// Configure the radio buttons as a group by 1) assigning them allthe
// same name and 2) assigning values to each radio button.
OAMessageRadioButtonBean rb1 =(OAMessageRadioButtonBean)webBean.findChildRecursive("cashRB");
rb1.setSelected(true); //for setting initial default valuewhilepage loads
rb1.setName("paymentTypeRG");rb1.setValue("CASH");
OAMessageRadioButtonBean rb2 =(OAMessageRadioButtonBean)webBean.findChildRecursive("checkRB");
rb2.setName("paymentTypeRG");rb2.setValue("CHECK");
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-117
OAMessageRadioButtonBean rb3 =(OAMessageRadioButtonBean)webBean.findChildRecursive("creditCardRB");
rb3.setName("paymentTypeRG");rb3.setValue("CHARGE");
// Make Current Date the Minimum Value for Order Date// The DateOrdered item displays a calendar to choose a date for
Order// Date.We should add logic to ensure that customers cannot place
an// order based on a date that has already passed.Therefore we make
the// current date as the minimum value to choose from the calendar
display
/*************** Min SYSDATE for ORDERED DATE*********************/
OAMessageDateFieldBean startDateBean =(OAMessageDateFieldBean)webBean.findIndexedChildRecursive("DateOrdered");
if (startDateBean != null){OADBTransaction transaction =
(OADBTransaction)pageContext.getApplicationModule(webBean).getTransaction();
java.util.Calendar currCal = java.util.Calendar.getInstance();
currCal.setTime((java.util.Date)transaction.getCurrentDBDate().dateValue());
currCal.add(java.util.Calendar.DATE, -1);startDateBean.setMinValue(currCal.getTime());
}}
}else{if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext,
"ordCreateTxn", true)){// We got here through some use of the browser "Back" button, so we// want to display a stale data error and disallow access to the
page.
// If this were a real application, we would probably display amore
// context-specific message telling the user he can't use thebrowser
// "Back" button and the "Create" page. Instead, we want toillustrate
// how to display the Applications standard NAVIGATION ERRORmessage.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-118 Oracle Applications Framework - Practices and Solutions
OADialogPage dialogPage = new OADialogPage(NAVIGATION_ERROR);pageContext.redirectToDialogPage(dialogPage);
}}
} // end processRequest
4.5 Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
When the Search page renders, select the Create Order button
Note that your invocation of the createOrderEntry() method ultimately results in BC4J callingyour entity object's create() method. The OrderCreatePG should appear as shown in Figure 1,but without the order number.
Try navigating to the Search page from the Create Order page using the browserBack button. Verify that your page renders without any errors.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-119
5: Implement Order Business Logic
Part 1: Declarative Validation and Initialization
The following table summarizes the order business rules to be implemented in this lab. Boldedrules can be implemented using declarative validation.
5.1 Lay down your Business Needs
EntityAttribute
Business Rules
OrderId Defaults when an Order entity object is created using theDEM_ORDERS_S sequence to generate your unique identifier.
Must be unique across the system. Required; cannot be null. Cannot be updated on a committed row.
DateOrdered Required; cannot be null Defaults to SYSDATE when an Order entity object is created Must be >= sysdate
OrderStatus Required; cannot be null Must be a valid status (valid means it exists in the
FND_LOOKUPS table)DateShipped If specified, must be >= START_DATECustomerId Required; cannot be nullCustomerName Required; cannot be nullCurrencyCode Required; cannot be null
cashRB (PPR) checkRB (PPR) creditCardRB (PPR)
------------------
Enable the followingCheckNumber
Enable the followingCcTypeCcNumberCcExpiration
PaymentType
Disable the followingCheckNumberCcTypeCcNumberCcExpirationCcApprovalCode
Disable the followingCcTypeCcNumberCcExpirationCcApprovalCode
Disable the followingCheckNumberCcApprovalCode
CcType Must be a valid Type(Should not be null)PPR – Partial Page Render on CcTypeIf Visa
o Enable CcApprovalCode and make it RequiredElse
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-120 Oracle Applications Framework - Practices and Solutions
o Disable CcApprovalCode
OrderLinesButton
Should take us to Lines Create Page.
5.2 Add Import Statements
Add the following import statements to your OrderEOImpl class:import oracle.jbo.server.EntityDefImpl;import oracle.jbo.server.AttributeDefImpl;import oracle.jbo.AttributeList;import oracle.jbo.domain.Number;import oracle.jbo.domain.Date;import oracle.jbo.Key;import oracle.apps.fnd.framework.OAAttrValException;import oracle.apps.fnd.framework.OARowValException;import oracle.apps.fnd.framework.server.OADBTransaction;import oracle.apps.fnd.framework.OAException;import oracle.apps.fnd.framework.server.OAEntityImpl;import oracle.jbo.RowIterator;import oracle.jbo.server.EntityImpl;
Within the context of the entity object, note that we use an OADBTransaction (unlike the superclass Transaction that we used in our application module above) because the OAEntityImplsuper class provides a convenience getOADBTransaction() method for us to use in ourOrderEOImpl subclass. See the oracle.apps.fnd.framework.server.OAEntityImpl for additionalinformation.
5.3 Override the setOrderId( ) Method
Add the following validation logic to the setOrderId() method in the OrderEOImpl class. Thisverifies that the order id is unique.
See Java Entity Objects in the OA Framework Developer's Guide for additional information.Instructions for creating PL/SQL Entity Objects are also available (this workshop focusesexclusively on Java Entity Objects; once you understand these basic concepts, you can easilypick up the PL/SQL alternative).
Note: You are strongly encouraged to copy the validation logic introduced in the next severaltasks. It will be quite time-consuming to type this in directly, the risk of mistakes is higher, andyou might not include the comments that will help explain what is happening as you debug thecode.
Tip: If you copy this code and paste it into your setOrderId() method, make sure you do not endup with duplicate calls to setAttributeInternal() since this call is automatically added to thedefault implementation of this method. The resulting method should appear as shown below.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-121
Note this same consideration when adding validation logic to other setters.
/***************************************************************** Sets <code>value</code> as the attribute value for OrderId***************************************************************/
public void setOrderId(Number value){// Because of the declarative validation that you specified for this// attribute, BC4J validates that this can be updated only on a new
line,// and that this mandatory attribute is not null. This code adds the// additional// check of only allowing an update if the value is null to prevent
changes// while the object is in memory.
if (getOrderId() != null){throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK"OrderId", // Attribute Namevalue, // Attribute value"DEMXX", // Message product short name"ORDLINES_ORD_ID_NO_UPDATE"); // Message name
}
if (value != null){// Order id must be unique. To verify this, you must check both the// entity cache and the database. In this case, it's appropriate// to use findByPrimaryKey() because you're unlikely to get a match,
and// and are therefore unlikely to pull a bunch of large objects into// memory.// Note that findByPrimaryKey() is guaranteed to check all orders.// First it checks the entity cache, then it checks the database.
OADBTransaction transaction = getOADBTransaction();Object[] orderKey = {value};EntityDefImpl ordDefinition = OrderEOImpl.getDefinitionObject();OrderEOImpl order =
(OrderEOImpl)ordDefinition.findByPrimaryKey(transaction, newKey(orderKey));
if (order != null){throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-122 Oracle Applications Framework - Practices and Solutions
"OrderId", // Attribute Namevalue, // Attribute value"DEMXX", // Message product short name"ORDLINES_ORDER_ID_UNIQUE"); // Message name
}}
// Note that this is the point at which the value is actually set onthe EO
// cache(during the scope of setAttributeInternal processing). If youdon't
// make this call after you perform your validation, your value willnot be
// set correctly. Also, any declarative validation that you definefor this
// attribute is executed within this method.
setAttributeInternal(ORDERID, value);
} //end setOrderId()
5.4 Override the create( ) Method
The create() method is called when your OrderEOImpl class is instantiated. Any programmaticdefaulting logic should be added to this method. In this case, we're setting an order id based on adatabase sequence value, and we're setting the start date to the database SYSDATE.
Note that we call the set<AttributeName>() methods and pass them the values we want to set.This ensures that all attribute-level validation is performed.
/**
*************************************************************************
** Add attribute defaulting logic here.
*************************************************************************
*/public void create(AttributeList attributeList){super.create(attributeList);OADBTransaction transaction = getOADBTransaction();Number numberOrderId = transaction.getSequenceValue("DEM_ORDERS_S");setOrderId(numberOrderId);
// Ordered Date should be set to SYSDATEsetDateOrdered(transaction.getCurrentDBDate());
} // end create()
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-123
5.5 Save and Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
Select the Create Order button. Verify that your create() method is called asexpected, and that your setDateOrdered() and setOrderId() methods are behavingcorrectly.
The OrderCreatePG should appear approximately as shown in Figure 1, but thistime you should see your default Order Number and Order Date values.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-124 Oracle Applications Framework - Practices and Solutions
6: Implement Order Business Logic
Part 2: Entity Expert, VAM and VVO Validation
In this task, you will create an Entity Expert, a Validation Application Module (VAM) andseveral Validation View Objects (VVO) to be used in OrderStatus. In each of these cases, wehave to execute some SQL statements in order to implement the required business rules. Thistask shows the correct way to implement this.
6.1 Create an Order Validation Application Module
Create an application module to hold validation view objects used by your OrderEO and itsentity expert. Validation application modules are not used by the UI, so they are created in thesame package as your entity object (the "schema" package).
In the <yourname>.oracle.apps.demxx.schema.server BC4J package, create a newapplication module called OrderVAM, and verify that the Package is set to<yourname>.oracle.apps.demxx.schema.server
In the Java page, deselect the Generate Java File checkbox (you will not be addingany code to this application module)
6.2 Register the Order Validation Application Module with OrderEO Entity Object
Associate the OrderVAM with the OrderEO so you can use certain convenience methods in theOAEntityExpert class (you will need this in a few steps).
Select the OrderEO in the Navigator, right-click and select Edit OrderEO... fromthe context menu.
Navigate to the Properties page.
Create a new property with the following Name and Value, and select the Addbutton (note that the case must match exactly):
o Name: VAMDef
o Value: <yourname>.oracle.apps.demxx.schema.server.OrderVAM
Select the OK button to create your new property.
6.3 Create an OrderStatus Validation View Object
Validation view objects encapsulate simple validation queries that you would otherwise writedirectly in your entity object or expert. For example, the OrderStatusVVO simply checks to seeif the given status exists in the database.
In the <yourname>.oracle.apps.demxx.schema.server BC4J package, create a newview object called OrderStatusVVO and verify that Package is set to<yourname>.oracle.apps.demxx.schema.server
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-125
Use the following query:SELECT lookup_codeFROM fnd_lookupsWHERE lookup_code = :1AND lookup_type = 'ORDER_STATUS_LOOKUP'
Generate both the *VOImpl and the *VORowImpl for this VO.
6.4 Add the OrderStatusVVO to the OrderVAM Validation Application Module
Add the OrderStatusVVO view object to the OrderVAM.
Change the instance name on the right from OrderStatusVVO1 toOrderStatusVVO.
6.5 Add an initQuery( ) Method to the OrderStatusVVO Validation View Object
Add the following simple initQuery() method to the OrderStatusVVOImpl class.public void initQuery(String orderStatus){setWhereClauseParams(null); // Always resetsetWhereClauseParam(0, orderStatus);executeQuery();
}
6.6 Create an Entity Expert Class
Entity experts are singletons (meaning there is one instance that is global to the application andshared by all users) that are closely affiliated with entity objects. They can be used to performinternal work on behalf of the entity object, and they can be used for lightweight operations byother classes instead of requiring multiple entity object instances.
Select OrderEntry.jpr in the Navigator, right-click and select New> Class from thecontext menu.
In the New Class dialog window:
In the Name field enter OrderEntityExpert.
In the Package field enter <yourname>.oracle.apps.demxx.schema.server.
In the Extends field browse down to and chooseoracle.apps.fnd.framework.server.OAEntityExpert.
In the Optional Attributes region, only select the Public checkbox.
Select OK to create your Java class.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-126 Oracle Applications Framework - Practices and Solutions
6.7 Associate the Entity Expert with the OrderEO Entity Object
Entity expert classes are officially registered with their owning entity object.
Select the OrderEO in the Navigator, right-click and select Edit OrderEO ... fromthe content menu.
Navigate to the Properties page, and change the Name field to ExpertClass.
Change the Value field to<yourname>.oracle.apps.demxx.schema.server.OrderEntityExpert.
Select the Add button.
Select the OK button.
6.8 Add a Convenience Method for Expert Access in the OrderEOImpl Class
Add the following static method to your OrderEOImpl class (we want this to be a static methodso it can be called without the client having to instantiate your OrderEOImpl class).
import oracle.apps.fnd.framework.server.OADBTransaction;.../*********************************************************** Convenience method returns the OrderEntityExpert.*********************************************************/public static OrderEntityExpert getOrderEntityExpert (OADBTransaction
txn){return
(OrderEntityExpert)txn.getExpert(OrderEOImpl.getDefinitionObject());} // end getOrderEntityExpert()
6.9 Add the isOrderStatusValid( ) Method to the Entity Expert
Add the following new method to your OrderEntityExpert class.
Tip: If you fail to complete Step 6.2 above to register the OrderVAM with the OrderEO, thefindValidationViewObject() method below will return null.
/**
****************************************************************************** Returns true if the given order status is valid.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-127
*******************************************************************************/
public boolean isOrderStatusValid(String orderStatus){boolean isActive = false;
// Note that we want to use a cached, declaratively defined VOinstead of
// creating one from a SQL statement which is far less performant.
OrderStatusVVOImpl orderStatusVO =(OrderStatusVVOImpl)findValidationViewObject("OrderStatusVVO");
orderStatusVO.initQuery(orderStatus);
// We are just doing a simple existence check. If we don't find amatch,
//return false.
if (orderStatusVO.hasNext()){isActive = true;
}return isActive;
} // end isOrderStatusValid()
6.10 Add Validation Logic to setOrderStatus() Method in OrderEOImpl Class
Add the following logic to the setOrderStatus() method in your OrderEOImpl class. It calls theentity expert isOrderStatusValid() method, and if this call returns false, it throws an attribute-level exception.
/********************************************************************* Sets <code>value</code> as the attribute value for OrderStatus******************************************************************
*/public void setOrderStatus(String value){// BC4J ensures that this mandatory attribute is non-nullif ((value != null) || (!("".equals(value.trim())))){OrderEntityExpert expert =
getOrderEntityExpert(getOADBTransaction());if (!(expert.isOrderStatusValid(value))){
throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK"OrderStatus", // Attribute Name
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-128 Oracle Applications Framework - Practices and Solutions
value, // Attribute value"DEMXX", // Message product short name"ORDLINES_ORDSTATUS_INVALID"); // Message name
}}setAttributeInternal(ORDERSTATUS, value);
}
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-129
6.11 Compile and Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
Select the Create Order button; verify if your new methods are called correctly(again, your data will be cached in the middle tier, but not yet saved to the database).
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-130 Oracle Applications Framework - Practices and Solutions
7: Implement Order Business Logic
Part 3: Miscellaneous Attributes
The following methods complete the business rules implementation for the order, however, ifyou are pressed for time you may skip this task since failing to implement this validation will notharm anything.
7.1 Add Logic to setDateShipped() Method; Add a validateDateShipped () Method
These methods are virtually identical to the setDateOrdered() and validateDateOrdered()methods that you implemented earlier.
Add the following logic to the setDateShipped() method in your OrderEOImpl class./******************************************************************* Sets <code>value</code> as the attribute value for DateShipped******************************************************************/
public void setDateShipped(Date value){validateDateShipped(value);setAttributeInternal(DATESHIPPED, value);
}
Add the following new method to your OrderEOImpl class./**
************************************************************************
* Verifies that the order's Ship Date is valid.** Business Rules:* This is an optional value which can be updated at any time.* Cannot be earlier than sysdate.
*************************************************************************/protected void validateDateShipped(Date value){// If a value has been set, validate it.if (value != null){
OADBTransaction transaction = getOADBTransaction();
// Note that we want to truncate these values to allow for thepossibility
// that we are trying to set them to be the same day. Calling
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-131
// dateValue() does not include time. Were we to want the timeelement,
// we would call timestampValue(). Finally, we cannot compare// oracle.jbo.domain.Date objects directly. Instead, convert the
value to// a long as shown.
long dateOrdered = getDateOrdered().dateValue().getTime();long dateShipped = value.dateValue().getTime();
if (dateShipped < dateOrdered){
throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK"DateShipped", // Attribute Namevalue, // Attribute value"DEMXX", // Message product short name"ORDLINES_ORDER_SHIP_BAD"); // Message name
}}
} // end validateDateShipped()
7.2 Save and Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
Select the Create Order button; verify that your new methods are called correctly(we still are not saving anything to the database).
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-132 Oracle Applications Framework - Practices and Solutions
8: Implement Order Business Logic
Part 4: Entity-Level Validation
All cross-attribute validation must be added to the entity level validateEntity() method in yourentity object (you cannot control the sequence in which BC4J calls individual attribute setters, soany validation that you add to a set<AttributeName>() method can refer only to that attribute'svalue). When values are posted back to the middle tier, BC4J calls each of the appropriateattribute setters, and then calls the validateEntity() method for any "dirty" (changed) entities. So,this logic always executes after all your attribute setters have been called.
Add the following logic to the validateEntity() method in your OrderEOImpl class./********************************************************************* Add Entity- and Cross-Attribute validation code in this method.*******************************************************************/
protected void validateEntity(){// Always call this first.super.validateEntity();
if (getOrderStatus() == null){
throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK"OrderStatus", // Attribute NamegetOrderStatus(), // Attribute value"DEMXX", // Message product short name"ORDLINES_STATUS_REQUIRED"); // Message name
}
/************* Ensuring CcType is entered if Credit Card is chosen********/
if ((getPaymentType().equalsIgnoreCase("CHARGE")) && (getCcType() ==null))
{throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK"CcType", // Attribute NamegetCcType(), // Attribute value"DEMXX", // Message product short name"ORDLINES_CCTYPE_INVALID"); // Message name
}
/******** Ensuring ApprovalCode is entered if CcType is Visa**********/
if ((getPaymentType().equalsIgnoreCase("CHARGE"))&& (getCcType().equalsIgnoreCase("V"))&& (getCcApprovalCode() == null) )
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-133
{throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK"CcApprovalCode", // Attribute NamegetCcApprovalCode(), // Attribute value
"DEMXX", // Message product short name"ORDLINES_CCAPPCODE_ENTER"); // Message name
}
/************* Ensuring Check Number is non Negitive *************/
if((getPaymentType().equalsIgnoreCase("CHECK"))&& (getCheckNumber().intValue()<0)){
throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK"CheckNumber", // Attribute NamegetCheckNumber(), // Attribute value"DEMXX", // Message product short name"ORDLINES_CHECK_NO_BAD"); // Message name
}
} // end validateEntity()
8.2 Compile and Save Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
Select the Create Order button; verify that your attribute setters are called first, andthen your validateEntity() method is called.
9: Implement the Apply and Cancel Button Handling
When the user presses the Apply button, you need to commit and navigate back to the Searchpage where you will display a confirmation message. When the user presses the Cancel button,you need to rollback the transaction and navigate back to the Search page (the rollback isrequired per the Back button guidelines in this particular use case).
9.1 Create an apply( ) Method in Your OrderEntryAMImpl Class
Since controller code shouldn't access server-side objects except for the OAApplicationModuleinterface, we need to create an apply() method in the OrderEntryAMImpl class to actuallyissue the commit. We will then add controller code to invoke this method on the AM.
Add the following method to your OrderEntryAMImpl class.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-134 Oracle Applications Framework - Practices and Solutions
/*
****************************************************************************** Commits the transaction.
******************************************************************************/public void apply(){getTransaction().commit();
} // end apply()
9.2 Add processFormRequest( ) Logic to Your OrderCreateCO Class
Add the following code to the OrderCreateCO class to handle Apply and Cancel buttonselection.
Note: Remember to enter proper values for <yourname> and demxx while copying the code toyour processFormRequest()at both ‘apply’ and ‘cancel’ button-handling.
import oracle.jbo.domain.Number;import oracle.apps.fnd.common.MessageToken;import oracle.apps.fnd.framework.OAApplicationModule;import oracle.apps.fnd.framework.OAException;import oracle.apps.fnd.framework.OAViewObject;import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
...
public void processFormRequest(OAPageContext pageContext, OAWebBeanwebBean){// Always call this first.super.processFormRequest(pageContext, webBean);
OAApplicationModule am =(OAApplicationModule)pageContext.getApplicationModule(webBean);
// Pressing the "Apply" button means the transaction should bevalidated
// and committed.if (pageContext.getParameter("Apply") != null){// Generally we have illustrated// all BC4J interaction on the server (except for the AMs, of
course).Here,
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-135
// we are dealing with the VO directly so the comments about thereasons
// why we are obtaining values from the VO and not the request makesense
// in context.
OAViewObject vo = (OAViewObject)am.findViewObject("OrderDetailsVO");
// Note that we have to get this value from the VO because the EOwill
// assemble it during its validation cycle.
// For performance reasons,// we don't want to do this// on the client so we are illustrating the interface-appropriate
call. If// we implement this code in the AM where it belongs, we would use
the// other approach.// We need to get a String so we can pass it to the MessageToken
array// below. Note that we are getting this value from the VO (we could
also// get it from the Bean as shown in the Drilldown to Details)
because the// item style is messageStyledText, so the value is not put on the
request// like a messaqeTextInput value is.
Number orderNumber =(Number)vo.getCurrentRow().getAttribute("OrderId");
String orderNum = String.valueOf(orderNumber.intValue());
// Simply telling the transaction to commit will cause all theEntity
// Object validation to fire.// Note: there's no reason for a developer to perform a rollback.
This is// handled by the framework if errors are encountered.
am.invokeMethod("apply");
// Assuming the "commit" succeeds, navigate back to the "Search"page with
// the user's search criteria intact and display a "Confirmation"message
// at the top of the page.
MessageToken[] tokens = { new MessageToken("ORD_NUMBER", orderNum)};
OAException confirmMessage = new OAException("DEMXX","ORDLINES_ORD_CREATE_CONFIRM",tokens,OAException.CONFIRMATION, null);
// Per the UI guidelines, we want to add the confirmation message atthe
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-136 Oracle Applications Framework - Practices and Solutions
// top of the search/results page and we want the old searchcriteria and
// results to display.
pageContext.putDialogMessage(confirmMessage);
pageContext.forwardImmediately("OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/OrderSearchPG",
null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,true, // retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_NO);
}else if (pageContext.getParameter("Cancel") != null){am.invokeMethod("rollbackOrder");
// Indicate that the Create transaction is complete.TransactionUnitHelper.endTransactionUnit(pageContext,
"ordCreateTxn");
pageContext.forwardImmediately("OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/OrderSearchPG",
null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,true, // retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_NO);
}}//end processFormRequest()
9.3 Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml
Select the Create Order button. The OrderCreatePG should appear as shown inFigure 1.
Enter an order, and select the Apply button. The confirmation message shoulddisplay in the OrderSearchPG as shown in Figure 2.
Also try navigating to the OrderCreatePG and selecting the Cancel button.
Lab 4: Orders: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-137
Figure 2: Orders Search Page with Create Confirmation Message
You are now finished with this exercise.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-138 Oracle Applications Framework - Practices and Solutions
Lab 5: Orders: Partial Page Rendering (PPR)
Overview
In this exercise, we will modify the Create Order page to implement a dynamic user interfaceusing partial page rendering (PPR) for the payment type radio-button value changes.
When the user clicks the any one of the radio-buttons (Cash, Cheque or CreditCard) we need todisable the fields listed below the other two. For instance, if the user initially clicks on Creditcardand fills out details, then decides he wants to pay through Cheque and so clicks on Cheque radio-button we need to clear attribute values set for Creditcard fields (CcType, CcNumber,CcExpiration, CcApprovalCode) and disable these fields.
Warning: This lab assumes that you have completed the Create Lab, and builds on that work. Ifyou have not completed this exercise, please do so before proceeding.
Figure 1: Create Page Finished Product initial rendering
Lab 5: Orders: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-139
Figure 2: A Closer look at the Payment Type region when the page renders first time
Figure 3: A Closer look at the Payment Type region when Credit Card radio button is chosen
1: Create an "Application Properties" View Object
To enable PPR in this page, you must create an OA Framework standard applications propertiesview object (PVO) including a transient attribute for tracking the state of the Rendered propertyfor the PPR fields. This view object will ultimately include a single row which you will initializeand update as the user interacts with the page (you will see a bit later how the PPR field binds tothis view object attribute to determine whether it should be disabled or not, and you willconfigure the cashRB, checkRB, creditCardRB and CcType fields to fire PPR events wheneach of their values change).
Note: See the Dynamic User Interface topic in the OA Framework Developer's Guide foradditional information about leveraging PPR in your product.
The application properties view object should be created in the same package as your module'sother UI BC4J components. Note that you should have only one application properties viewobject per application module (it can include attributes used by different pages that share thesame root UI application module). This view object should follow the naming convention:<AssociatedApplicationModuleName>PVO. Since you will be associating your applicationproperties view object with your OrderEntryAM root UI application module, it should be
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-140 Oracle Applications Framework - Practices and Solutions
named OrderEntryPVO.
1.1 Create the OrderEntryPVO View Object
In the <yourname>.oracle.apps.demxx.orderentry.server package, create theOrderEntryPVO view object and verify that the Package is<yourname>.oracle.apps.demxx.orderentry.server.
In the Attributes page, select the New... button and create a transient attribute withthe following properties:
o Name: checkNumber
o Type: Boolean
o Updateable: Always
Select the New... button again and create a transient attribute with the followingproperties:
o Name: creditCardType
o Type: Boolean
o Updateable: Always
Select the New... button again and create a transient attribute with the followingproperties:
o Name: creditCardNumber
o Type: Boolean
o Updateable: Always
Select the New... button again and create a transient attribute with the followingproperties:
o Name: creditCardExpirationDate
o Type: Boolean
o Updateable: Always
Select the New... button again and create a transient attribute with the followingproperties:
o Name: approvalCode
o Type: Boolean
Lab 5: Orders: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-141
o Updateable: Always
You need not generate any Java files for this PVO.
After you create the PVO, reopen and navigate to the Tuning page. Check theEnable Passivation and For All Transient Attributes checkboxes (it is important thatthe transient attributes in an application properties view object be properlypassivated).
1.2 Add the OrderEntryPVO View Object to the OrderEntryAM
Add the OrderEntryPVO view object to the OrderEntryAM.
Change the instance name on the right bottom from OrderEntryPVO1 toOrderEntryPVO.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-142 Oracle Applications Framework - Practices and Solutions
2: Configure the PPR items to fire a PPR Action when changed
Configure the relevant items to fire a PPR action. They are configured in the following way:
2.1 Set the PPR Properties for Cash RadioButton
Set the following properties for the cashRB item in your Create page:
Property ValueDisable Server Side Validation True
(Ignore any server-side validation errors when this radio-button changes and the form is submitted. For example,ignore invalid field values)
Disable Client Side Validation(this property appears after you set theAction Type property to firePartialAction)
True(Do not perform any client side Javascript validation whenthis radio-button value changes and the form is submitted.For example, ignore null required field values.)
Action Type firePartialAction(Enables a PPR event for this radio-button)
Event(this property appears after you set theAction Type property to firePartialAction)
cashEvent(Name of PPR event added to request when the radio-button value changes)
Submit(this property appears after you set theAction Type property to firePartialAction)
True(Perform a form submit when the radio-button valuechanges)
2.2 Set the PPR Properties for Cheque RadioButton
Set the following properties for the checkRB item in your Create page:
Property ValueDisable Server Side Validation TrueDisable Client Side Validation TrueAction Type firePartialActionEvent checkEventSubmit True
2.3 Set the PPR Properties for Credit Card RadioButton
Set the following properties for the creditCardRB item in your Create page:
Property ValueDisable Server Side Validation TrueDisable Client Side Validation TrueAction Type firePartialActionEvent creditCardEventSubmit True
Lab 5: Orders: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-143
2.4 Set the PPR Properties for Credit Card Type Dropdown
Set the following properties for the CcType item in your Create page:
Property ValueDisable Server Side Validation TrueDisable Client Side Validation TrueAction Type firePartialActionEvent visaEventSubmit True
Note: We add a PPR to CcType item because we need to enable the CcApprovalCode item onlyif the CcType poplist value is Visa. Please note that for other values of the CcType poplist theCcApprovalCode item should be disabled.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-144 Oracle Applications Framework - Practices and Solutions
3: Configure the PPR field items to react to PPR Events
Set the value of the Disabled property to the following SPEL ("Simplest Possible ExpressionLanguage") syntax indicating that the property value should be obtained from theOrderEntryPVO instance's transient attributes.
For CheckNumber Item
Property ValueDisabled ${oa.OrderEntryPVO.checkNumber}
For CcType Item
Property ValueDisabled ${oa.OrderEntryPVO.creditCardType}
For CcNumber Item
Property ValueDisabled ${oa.OrderEntryPVO.creditCardNumber}
For CcExpiration Item
Property ValueDisabled ${oa.OrderEntryPVO.creditCardExpirationDate}
For CcApprovalCode Item
Property ValueDisabled ${oa.OrderEntryPVO.approvalCode}
Note that you must use the Enter key to get the new value to "stick" in the property. If you usethe mouse to click directly out of the property after typing the SPEL value, the property resets toTrue. At runtime, this item will render according to the value of the transient attributes in theOrderEntryPVO application view object.
Lab 5: Orders: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-145
4: Implement PPR Event Handling
4.1 Add PPR Handling Methods (Enable/Disable) to the OrderEntryAMImpl
We have created the application properties VO (OrderEntryPVO), configured the relevantitems to fire a PPR event, and we have configured the relevant field's Disabled property to bindto the OrderEntryPVO's transient attributes. Now, we need to add the code to handle the PPRchange events and initialize the OrderEntryPVO.
Your controller code will invoke the following method whenever a field's PPR event is fired.
Add the following code to your OrderEntryAMImpl class. This checks the radio-button clickedand disables/enables the associated OrderDetailsVO attributes.
Note: In this case, a transient property set to Boolean.FALSE indicates that the SPEL associatedfield is enabled and vice versa.
/********************* Coding PPR Handlers ************************/
/********************* CheckNumber ************************/
/*************************************************************** PPR for CheckNumber Enable*************************************************************/
public void enableCheckNumber(){OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}OARow row = (OARow)vo.first();if(row!=null)
row.setAttribute("checkNumber", Boolean.FALSE);}
}
/*************************************************************** PPR for CheckNumber Disable*************************************************************/
public void disableCheckNumber(){
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-146 Oracle Applications Framework - Practices and Solutions
OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");OAViewObject dbVO = (OAViewObject)findViewObject("OrderDetailsVO");if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}
OARow row = (OARow)vo.first();OARow dbRow = (OARow)dbVO.getCurrentRow(); // handle to CurrentRow
if(row!=null)row.setAttribute("checkNumber", Boolean.TRUE);
if(dbRow!=null)dbRow.setAttribute("CheckNumber", null); // set null to
CheckNumber}
}
/********************* CcType ************************/
/*************************************************************** PPR for CcType Disable*************************************************************/
public void disableCcType(){
OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");OAViewObject dbVO = (OAViewObject)findViewObject("OrderDetailsVO");if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}
OARow row = (OARow)vo.first();OARow dbRow = (OARow)dbVO.getCurrentRow(); // handle to
CurrentRow
if(row!=null)row.setAttribute("creditCardType", Boolean.TRUE);
if(dbRow!=null)dbRow.setAttribute("CcType", null); // set null to CcType
}}
/*************************************************************** PPR for CcTpe Enable*************************************************************/
Lab 5: Orders: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-147
public void enableCcType(){OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}OARow row = (OARow)vo.first();if(row!=null)row.setAttribute("creditCardType", Boolean.FALSE);
}}
/********************* CcNumber ************************/
/*************************************************************** PPR for CcNumber Disable*************************************************************/
public void disableCcNumber(){
OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");OAViewObject dbVO = (OAViewObject)findViewObject("OrderDetailsVO");if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}
OARow row = (OARow)vo.first();OARow dbRow = (OARow)dbVO.getCurrentRow(); // handle to
CurrentRow
if(row!=null)row.setAttribute("creditCardNumber", Boolean.TRUE);
if(dbRow!=null)dbRow.setAttribute("CcNumber", null); // set null to CcNumber
}}
/*************************************************************** PPR for CcNumber Enable*************************************************************/
public void enableCcNumber(){
OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-148 Oracle Applications Framework - Practices and Solutions
if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}OARow row = (OARow)vo.first();if(row!=null)row.setAttribute("creditCardNumber", Boolean.FALSE);
}}
/********************* CcExpiration ************************/
/*************************************************************** PPR for CcExpiration Disable*************************************************************/
public void disableCcExpiration(){
OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");OAViewObject dbVO = (OAViewObject)findViewObject("OrderDetailsVO");if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}
OARow row = (OARow)vo.first();OARow dbRow = (OARow)dbVO.getCurrentRow(); // handle to
CurrentRow
if(row!=null)row.setAttribute("creditCardExpirationDate", Boolean.TRUE);
if(dbRow!=null)dbRow.setAttribute("CcExpiration", null); // set null to
CcExpiration
}}
/*************************************************************** PPR for CcExpiration Enable*************************************************************/
public void enableCcExpiration(){OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");if (vo != null){
Lab 5: Orders: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-149
if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}OARow row = (OARow)vo.first();if(row!=null)row.setAttribute("creditCardExpirationDate", Boolean.FALSE);
}}
/********************* CcApprovalCode ************************/
/*************************************************************** PPR for CcApprovalCode Disable*************************************************************/
public void disableCcApprovalCode(){OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");OAViewObject dbVO = (OAViewObject)findViewObject("OrderDetailsVO");if (vo != null){
if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}
OARow row = (OARow)vo.first();OARow dbRow = (OARow)dbVO.getCurrentRow(); // handle to
CurrentRow
if(row!=null)row.setAttribute("approvalCode", Boolean.TRUE);
if(dbRow!=null)dbRow.setAttribute("CcApprovalCode", null); // set null
}}
/*************************************************************** PPR for CcApprovalCode Enable*************************************************************/
public void enableCcApprovalCode(){OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}OARow row = (OARow)vo.first();
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-150 Oracle Applications Framework - Practices and Solutions
if(row!=null)row.setAttribute("approvalCode", Boolean.FALSE);
}}
Lab 5: Orders: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-151
4.2 Add an init( ) Method to the OrderEntryAM
The following code ensures that your OrderEntryPVO includes a single row and initializesthe application properties VO and defines the default values of transient attributes when the pagerenders.
/**
****************************************************************************** Initializes the transient application properties VO.
******************************************************************************/public void init(){
OAViewObject appPropsVO =(OAViewObject)findViewObject("OrderEntryPVO");
if (appPropsVO != null){// Do not reinitialize the VO unless needed. Note that this method
call// does not try to query the database for VOs with no SELECT
statement and// only transient attributes.
if (appPropsVO.getFetchedRowCount() == 0){// Setting the max fetch size to 0 for an in-memory VO// prevents it from trying to query rows. Calling// executeQuery() ensures that rows are not lost after// a commit in the transaction (BC4J known issue workaround).
appPropsVO.setMaxFetchSize(0);appPropsVO.executeQuery();
// You must create and insert a row in the VO before you can start// setting properties.appPropsVO.insertRow(appPropsVO.createRow());
// Initialize the application properties VO (and the UI) based onthe
// default order payment value set on the underlying object.
OARow row = (OARow)appPropsVO.first();row.setAttribute("checkNumber", Boolean.TRUE);row.setAttribute("creditCardType", Boolean.TRUE);row.setAttribute("creditCardNumber", Boolean.TRUE);row.setAttribute("creditCardExpirationDate", Boolean.TRUE);row.setAttribute("approvalCode", Boolean.TRUE);
}}
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-152 Oracle Applications Framework - Practices and Solutions
} // end init()
4.3 Call the init( ) Method from processRequest( )
Add the following code to your OrderCreateCO processRequest() method after the call toam.invokeMethod("createOrderEntry"). This ensures that your application properties VO isproperly initialized when the page renders.
// Add the following code after am.invokeMethod("createOrderEntry")
// Initialize the application properties VO for PPR. am.invokeMethod("init");
4.4 Handle PPR Event
Remember that we configured the radio-buttons and the poplist to perform a form submit. Addthe following code to your existing OrderCreateCO processFormRequest() method to check tosee if their PPR events have been fired, and if so, invoke the enable/disable methods coded inOrderEntryAMImpl to handle the change.
/*********** PPR Event Handling for Payment Type RadioButtons************/
String event = pageContext.getParameter(EVENT_PARAM);
if(event.equalsIgnoreCase("checkEvent")){am.invokeMethod("enableCheckNumber");am.invokeMethod("disableCcType");am.invokeMethod("disableCcNumber");am.invokeMethod("disableCcExpiration");am.invokeMethod("disableCcApprovalCode");
}else if (event.equalsIgnoreCase("cashEvent")){am.invokeMethod("disableCheckNumber");am.invokeMethod("disableCcType");am.invokeMethod("disableCcNumber");am.invokeMethod("disableCcExpiration");am.invokeMethod("disableCcApprovalCode");
}else if (event.equalsIgnoreCase("creditCardEvent")){am.invokeMethod("disableCheckNumber");am.invokeMethod("enableCcType");am.invokeMethod("enableCcNumber");am.invokeMethod("enableCcExpiration");am.invokeMethod("disableCcApprovalCode");
}else if (event.equalsIgnoreCase("visaEvent")){OAMessageChoiceBean ccType =
(OAMessageChoiceBean)webBean.findChildRecursive("CcType");
Lab 5: Orders: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-153
String cc = (String)ccType.getValue(pageContext);if(cc.equalsIgnoreCase("v")){am.invokeMethod("enableCcApprovalCode");
}else{am.invokeMethod("disableCcApprovalCode");
}}
4.5 Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml
Select the Create Order button. The OrderCreatePG should appear as shown in Fig.1. Change the radio-button’s value to Cheque and the UI should appear as shown inFig. 2.
You are now finished with this exercise.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-154 Oracle Applications Framework - Practices and Solutions
Lab 6: Orders: Delete
Overview
In this exercise, you will be revising the simple Orders search page you created earlier to add aDelete image column and implement a delete action including a Warning page dialog. Figure 1shows the updated Orders page including the Delete column with an image that is enabled basedon the order's state.
Figure 1: Delete Finished Product
Lab 6: Orders: Delete………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-155
Figure 2: Revised Orders Search Page showing the ResultTable alone
Warning: This lab assumes that you have completed the Create Exercise and builds on thiswork. If you have not completed this exercise, please do so before proceeding.
1: Implement a Delete in Your OrderEOImpl Class
Verify the that you have the following remove() method to your OrderEOImpl class. If not, addit and then compile and save your change.
/*
****************************************************************************** Add entity delete logic here.
******************************************************************************/public void remove(){super.remove();
} // end remove()
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-156 Oracle Applications Framework - Practices and Solutions
2: Implement a Delete Switcher
Switchers can be used in tables to conditionally display alternate content in a column. In thistask, you will configure a switcher to display an appropriate Delete image based on the order'sstatus.
See Table Content Switchers in the OA Framework Developer's Guide for more informationabout this feature.
2.1 Add an Attribute to the OrderSearchVO View Object
To add a Delete switcher column to our results table, we need to modify our OrderSearchVO toinclude a decode attribute for this column that implements the following rules:
If the order is active, the Delete trashcan is disabled.
If the order is inactive, the Delete trashcan is enabled.
Note: For simplicity, the business rules assume that the presence of a non-null DATE_SHIPPEDimplies that the order is inactive, regardless of the DATE_SHIPPED value.
Select the OrderSearchVO in the Navigator, right-click and select EditOrderSearchVO... from the context menu to edit your VO.
In the Query Statement text box, modify your query to look like the following query(add the new content in bold). When you finish, select the Test button to ensure yoursyntax is correct.
SELECT OrderEO.ORDER_ID,OrderEO.CUSTOMER_ID,OrderEO.SALES_REP_ID,OrderEO.DATE_SHIPPED,
OrderEO.ORDER_STATUS,DemCust.NAME AS CUSTOMER_NAME,DemSale.FIRST_NAME||' '||DemSale.LAST_NAME AS SALES_REP_NAME,
DECODE(NVL(TO_CHAR(OrderEO.DATE_SHIPPED), 'N'),'N', 'DeleteDisabled', 'DeleteEnabled') AS DELETE_SWITCHERFROM DEM_ORDERS OrderEO,
DEM_CUSTOMERS DemCust,DEM_SALES_REPS DemSale
WHERE OrderEO.CUSTOMER_ID = DemCust.CUSTOMER_IDAND OrderEO.SALES_REP_ID = DemSale.SALES_REP_ID
Select the OK button to update your view object and leave the VO editor.
Now verify that your VO attribute settings match the aliases in your SQL query:
Select the OrderSearchVO in the Navigator, right-click and select EditOrderSearchVO... from the context menu to open the View Object wizard.
o Navigate to the Attributes section for your attributes and verify that any aliases in
Lab 6: Orders: Delete………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-157
your query are shown correctly. Make any necessary changes and select Apply.
o Navigate to the Attribute Mappings page and verify that all the mappings arecorrect. Make any necessary changes and select Apply.
o Select the OK button to finish editing your VO.
The decode that you added checks whether a DATE_SHIPPED has been specified, and if set, itreturns the value DeleteEnabled as the query's DELETE_SWITCHER value. If not, it returnsDeleteDisabled.
2.2 Create the Switcher Region
Create the switcher bean that will bind to the DeleteSwitcher view attribute you just created todetermine which Delete icon to display.
Select the ResultsTable in the Navigator, right-click and select New > switcherfrom context menu.
Select this region, and set its properties as follows:
Property ValueID DeleteSwitcherRegion Style switcherAttribute Set /oracle/apps/fnd/attributesets/Buttons/Delete
(You should use the standard Button attribute sets for standard image actioncolumns)
View Instance OrderSearchVOView Attribute DeleteSwitcher
2.3 Configure the Default Switcher Case
Switchers mimic a programmatic switch: you create a separate "case" for each option that mightdisplay. The switcher bean binds to the view object attribute that returns the name of the case torender. Each case that you add must have an ID value that matches one of your decode returnvalue names.
Configure the first switcher case item to show the disabled Delete image.
Select the default <case> switcher case in the Structure pane, and select New > Itemfrom context menu.
Select this new item, and set its properties as follows:
Property ValueID DeleteDisabled
(Note that this name MUST match the corresponding DECODE return value you defined forthis case in Step 1.1 above.)
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-158 Oracle Applications Framework - Practices and Solutions
Item Style imageImage URI deleteicon_disabled.gifAdditionalText
Delete order action is disabled.
Height 24Width 24
Note that you must specify the Height and Width properties for any images that you add to apage, except for the branding image. To find the values to enter, look for your image in either theOracle Browser Look and Feel UI Guideline Icon Repository (internal link | external link) or theAncillary Graphic Repository (internal link | external link). See the Adding Images to YourPages document for additional information about icon creation and use procedures.
2.4 Create a New Switcher Case
Configure the second switcher case item to show the enabled Delete image.
When the user selects the Delete icon, we want to submit the form so we can handle the event inprocessFormRequest(). Normally, when you simply set a Destination URI property for an image,its selection results in an HTTP GET and not a POST; we want to perform a POST. To do this,we will be explicitly configuring the image to perform a form submit when selected.
See the Developer's Guide Submitting the Form topic for additional information about manuallyforcing a form submit on a component that doesn't ordinarily do this.
Select the DeleteSwitcher in the Structure pane, right-click and select New > casefrom context menu.
Select this new <case> node, right-click and select New > Item from the contextmenu.
Configure this item's properties as follows.
Property ValueID DeleteEnabled
(Note that this name MUST match the corresponding DECODEreturn value you defined for this case in Step 1.1 above.)
Item Style imageImage URI deleteicon_enabled.gifAdditional Text Delete order action is enabled.Height 24Width 24Action Type fireAction
(Enables a form submit event for this image.)Event(This property appears after you set theAction Type property to fireAction)
delete(Name of form submit event added to request when the Deleteimage is selected.)
Lab 6: Orders: Delete………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-159
Submit(This property appears after you set theAction Type property to fireAction)
True
Next, you need to define request parameters for the order number and name associated with thecurrent row when the user selects a Delete icon. You will use these values a bit later to performthe delete action and display a dialog.
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 whosevalue is ${oa.OrderSearchVO.OrderId}. This SPEL ("Simplest Possible ExpressionLanguage") syntax indicates that the value for the ordNum parameter will beobtained from the OrderId attribute in the OrderSearchVO view instance.
Select the Add Parameters button and define a second parameter whose name iscustName and whose value is ${oa.OrderSearchVO.CustomerName}. This SPELsyntax indicates that the value for the custName parameter will be obtained from theCustomerName attribute in the OrderSearchVO view instance.
Select the OK button to create your request parameters.
At runtime, the OA Framework automatically creates and populates formParameter (hidden)items for the custName and ordNum parameters you configure. These formParameter valuesare then added to the request.
2.5 Format the Delete Column
All image columns should be centered. Image columns are automatically centered, but switchercolumns (even when displaying images) are not. To ensure the correct alignment for your Deletecolumn, add the following code to your OrderSearchCO controller in the processRequest()method:
import oracle.cabo.ui.data.DictionaryData;import oracle.cabo.ui.data.DataObjectList;import oracle.apps.fnd.framework.webui.beans.table.OATableBean;...
// This controller is associated with the table.
OATableBean table =(OATableBean)webBean.findChildRecursive("ResultsTable");
// We need to format the Switcher image column so the image iscentered
// (this isn't done automatically for Switchers as it is for// plain image columns). We start by getting the table's// column formats.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-160 Oracle Applications Framework - Practices and Solutions
// NOTE!!! You must call the prepareForRendering() method on thetable
// *before* formatting columns. Furthermore, this call must besequenced
// *after* the table is queried and *after* you do any control bar// manipulation.
table.prepareForRendering(pageContext);DataObjectList columnFormats = table.getColumnFormats();DictionaryData columnFormat = null;int childIndex = pageContext.findChildIndex(table, "DeleteSwitcher");columnFormat =(DictionaryData)columnFormats.getItem(childIndex);columnFormat.put(COLUMN_DATA_FORMAT_KEY, ICON_BUTTON_FORMAT);
...
2.6 Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml
At this point, your Delete column should appear in your results table as illustrated inFigure 1 above.
Lab 6: Orders: Delete………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-161
3: Implement the Delete Action
In this task, you'll be adding the code to handle the Delete icon selection. When you queryorders, you may see a deleteable entry as shown in Figure 1 above. When the user presses theDelete icon, a warning dialog displays as shown in Figure 3 below. If the user selects the OKbutton to proceed with the delete action, a confirmation message is displayed at the top of theOrders page as shown in Figure 4.
Figure 3: Delete Warning Dialog
Figure 4: Delete Confirmation Message
3.1 Add a deleteOrder( ) Method to the OrderEntryAM
Add a method to the OrderEntryAMImpl class that takes an orderNumber parameter and looksfor a matching row in OrderSearchVO view object. Note that calling the remove() method on
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-162 Oracle Applications Framework - Practices and Solutions
your OrderSearchVORowImpl class delegates to the remove() method that you added to yourOrderEOImpl class in Task 1 above.
Tip: This code illustrates how to iterate through the result set manually so you can see how thisworks, however, as of release 11.5.10 there are new convenience methods in theoracle.apps.fnd.framework.server.OAViewObjectImpl class that let you quickly find one or morematching rows for given values. See the Javadoc for additional information.
import oracle.jbo.domain.Number;import oracle.jbo.RowSetIterator;.../*
****************************************************************************** Deletes an order.
******************************************************************************/
public void deleteOrder(String orderNumber){// First, we need to find the selected order in our VO.// When we find it, we call remove( ) on the row which in turn// calls remove on the associated OrderEOImpl object.
int ordToDelete = Integer.parseInt(orderNumber);
OAViewObject vo =(OAViewObject)getOrderSearchVO();OrderSearchVORowImpl row = null;
// This tells us the number of rows that have been fetched in the// row set, and will not pull additional rows in like some of the// other "get count" methods.
int fetchedRowCount = vo.getFetchedRowCount();
// We use a separate iterator -- even though we could step throughthe
// rows without it -- because we don't want to affect row currency.
RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");if (fetchedRowCount > 0){deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedRowCount);for (int i = 0; i < fetchedRowCount; i++){row = (OrderSearchVORowImpl)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.
Lab 6: Orders: Delete………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-163
Number primaryKey = row.getOrderId();if (primaryKey.compareTo(ordToDelete) == 0){// This performs the actual delete.
row.remove();getTransaction().commit();break; // only one possible selected row in this case
}}
}
// Always close the iterator when you're done.deleteIter.closeRowSetIterator();
} // end deleteOrder
3.2 Add Delete Selection Handler Code to OrderSearchCO
Add the following code to your OrderSearchCO.processFormRequest() method to ascertainwhether the Delete icon has been selected, and if so, display the Warning dialog.
See the Dialog Pages topic in the OA Framework Developer's Guide for additional informationabout this component.
Note: Add this to the processFormRequest() if statement that you already added to handle theCreate Order button press.
import com.sun.java.util.collections.HashMap;import oracle.apps.fnd.framework.webui.OADialogPage;import oracle.apps.fnd.common.MessageToken;import oracle.apps.fnd.framework.OAException;...
/************************ Delete Selection Handler********************/
else if ("delete".equals(pageContext.getParameter(EVENT_PARAM))){
// The user has clicked a "Delete" icon so we want to display a"Warning"
// dialog asking if he really wants to delete the order. 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 orderNumber = pageContext.getParameter("ordNum");String customerName = pageContext.getParameter("custName");
MessageToken[] tokens = { new MessageToken("ORD_NUM", orderNumber)};
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-164 Oracle Applications Framework - Practices and Solutions
OAException mainMessage = new OAException("DEMXX","ORDLINES_ORDER_DELETE_WARN", tokens);
// Note that even though we are going to make our Yes/No buttonssubmit a
// form, we still need some non-null value in the constructor'sYes/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("DEMXX", "ORDLINES_ORDER_YES",null);
String no = pageContext.getMessage("DEMXX", "ORDLINES_ORDER_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 "Order" 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);
// We need to keep hold of the orderNumber and customerName.// 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.
java.util.Hashtable formParams = new java.util.Hashtable(1);formParams.put("ordNum", orderNumber);formParams.put("custName", customerName);dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);}
3.3 Add Delete Confirmation Handler Code to OrderSearchCO
Add the following code to your OrderSearchCO processFormRequest() method to handle theWarning dialog button's OK press indicating the user does wish to the delete the selected order.
Lab 6: Orders: Delete………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-165
Note: Add this to the processFormRequest() if statement that you already added to handle theDelete icon selection.
import java.io.Serializable;...
/************** Delete Confirmation Code Handler*********************/
else if (pageContext.getParameter("DeleteYesButton") != null){// User has confirmed that he wants to delete this order.// Invoke a method on the AM to set the current row in the VO and// call remove() on this row.String orderNumber = pageContext.getParameter("ordNum");String customerName = pageContext.getParameter("custName");Serializable[] parameters = { orderNumber };OAApplicationModule am = pageContext.getApplicationModule(webBean);am.invokeMethod("deleteOrder", parameters);
// Now, redisplay the page with a confirmation message at the top.Note
// that the deleteOrder() method in the AM commits, and our code// won't get this far if any exceptions are thrown.
MessageToken[] tokens = { new MessageToken("ORD_NUM", orderNumber) };OAException message = new OAException("DEMXX","ORDLINES_ORD_DELETE_CONFIRM", tokens, OAException.CONFIRMATION,
null);pageContext.putDialogMessage(message);
}
3.4 Test Your Work
Rebuild your project and run the OrderSearchPG
Select the Create Order button to create a new order. Be sure to set the Ship Datevalue to any date >= Ordered Date. You can not test deleting an order unless youcreate one with a non-null ship date.
Query your new order in the Search page and verify that the Delete icon is enabledand the Status image is correct as shown in Figure 2.
Select the Delete icon and verify that the Warning dialog displays as shown inFigure 3.
Select the OK button in the Warning dialog to delete your order. Verify that theconfirmation displays as shown in Figure 4.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-166 Oracle Applications Framework - Practices and Solutions
Lab 7: Orders: Update
Overview
In this exercise, you will be implementing an order update transaction.
Warning: This lab assumes that you have completed the Create Exercise and builds on thiswork. If you have not completed this exercise, please do so before proceeding.
1: Make a Copy of Your OrderCreatePG
For the most part, a single page update and insert page are identical. Since you already created aninsert page, the quickest way to implement a new corresponding update page with the same itemsand underlying view object is to simply copy the page definition and then make any necessarymodifications.
Note: We are using the page copy technique shown here to avoid having you recreate a page thatis 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 userinterface. The Partial Page Rendering lab introduces you to this technology; read the DynamicUser Interface topic in the Developer's Guide for additional information about how to leveragethis in your development.
1.1 Copy OrderCreatePG on the File System
Since the JDeveloper OA Extension does not yet support the ability to "save as" or copy/paste apage 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-clickand select Copy.
Select the webui directory node, right-click and select Paste. Your new file will benamed Copy of OrderCreatePG.
Select the new file in the Explorer, right-click and select Rename. Change the nameto OrderUpdatePG.
Start JDeveloper, expand the OA Components category in your project, and selectthe Add File toolbar icon to open the Add Files or Directories to <your projectname> dialog. Locate your OrderUpdatePG and select OK to add this file to yourproject.
Lab 7: Orders: Update………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-167
1.2 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 Asfrom the main menu. Name your new file OrderUpdateCO.
Change the class name in your new OrderCreateCO file to OrderUpdateCO.
Tip: If you forgot to change class name to match the file name and you recompile, you will get awarning like this: Warning(28,8): class OrderCreateCO is public; should be declared in a filenamed OrderCreateCO.java; or the class should be renamed to OrderDescriptionCO to match thefilename.
Select the OrderUpdatePG page's PageLayoutRN region in the JDeveloperstructure 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 inRowOneLayout.
Set the Read Only property to True (as Order Date should be update-disallowed).
1.3 Compile and Save Your Work
Rebuild your project and save your work.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-168 Oracle Applications Framework - Practices and Solutions
2: Add an Update Column to the Search Page
In this task, you will add an Update image column to your Orders Results table as shown inFigure 1.
Figure 1: Order Search page: Update column included
2.1 Add the "Update" Column to the Results Table
Note that the Update icon should be declaratively configured to perform a form submit whenselected.
Select the ResultsTable in the Structure pane, right-click and select New > Itemfrom context menu.
Configure this item's properties as follows:
Property ValueID UpdateImageItem Style imageAttribute Set /oracle/apps/fnd/attributesets/Buttons/UpdateImage URL updateicon_enabled.gifAdditional Text Select to update this order.Height 24
Lab 7: Orders: Update………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-169
Width 24Action Type fireActionEvent updateSubmit 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 whosevalue is ${oa.OrderSearchVO.OrderId}.
Select the Add Parameters button and define a second parameter whose name iscustName and whose value is ${oa. OrderSearchVO.CustomerName}.
Select the OK button to create your request parameters.
2.2 Modify the OrderSearchCO Controller
First, add processRequest() logic to handle Back button navigation. Add the else if logic shownin bold to the if statement that you already added in the Create lab.
if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"ordCreateTxn", false))
{am.invokeMethod("rollbackOrder");TransactionUnitHelper.endTransactionUnit(pageContext,
"ordCreateTxn");}
else if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"ordUpdateTxn", false))
{am.invokeMethod("rollbackOrder");TransactionUnitHelper.endTransactionUnit(pageContext,
"ordUpdateTxn");}
Then, add code to your processFormRequest() method to determine if the Update icon isselected.
Note: Remember to fill-in value for <yourname> and demxx while using this code....
/******************* Update Icon Click Handler *********************/
else if ("update".equals(pageContext.getParameter(EVENT_PARAM))){
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-170 Oracle Applications Framework - Practices and Solutions
// 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 AMOAWebBeanConstants.ADD_BREAD_CRUMB_NO,OAWebBeanConstants.IGNORE_MESSAGES);
}
2.3 Modify the OrderUpdateCO Controller
Now you need to change the logic in the OrderUpdateCO controller to properly support theupdate action and page flow. Create logic needs to be removed.
Delete the logic in your processRequest() method and add the following instead:import oracle.apps.fnd.framework.webui.TransactionUnitHelper;import java.io.Serializable;...
public void processRequest(OAPageContext pageContext, OAWebBeanwebBean){
super.processRequest(pageContext, webBean);
// Put a transaction value indicating that the update transaction// is now in progress.
TransactionUnitHelper.startTransactionUnit(pageContext,"ordUpdateTxn");
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);
/************** Radio Button as a Group configured *****************/
Lab 7: Orders: Update………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-171
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 componentsam.invokeMethod("init");
} // end processRequest
...
Change the name of the "in transaction indicator" in the processFormRequest() method fromordCreateTxn to ordUpdateTxn, and change the confirmation message name fromORDLINES_ORD_CREATE_CONFIRM to ORDLINES_ORD_UPDATE_CONFIRM.
2.4 Rebuild and Test Your Work
Rebuild your project and run the OrderSearchPG
At this point, your Update column should appear in your results table as illustrated inFigure 1 above. Select it to open and test your new update page.
You are now finished with this exercise.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-172 Oracle Applications Framework - Practices and Solutions
Lab 8: Lines: Search
Overview
In this exercise, we will be implementing a simple search and results page as shown in Figure 1below. Eventually, we will add the ability to view, create and delete orders.
Figure 1: Search Page Exercise Finished Product
1: Create Your Page's Model Components
1.1 Create a Lines Entity Object (EO)
Create an entity object (EO) for the DEM_ORDER_LINES table in the OA FrameworkOrderEntry schema.
Tip: Most of the BC4J wizards allow you to resize the wizard window, even though there maynot be visible resize controls. This is helpful for viewing long values and SQL statements.
Select the <yourname>.oracle.apps.demxx.schema.server BC4J package in theNavigator, right-click and select New Entity Object... from the context menu to openthe Entity Object wizard.
If the Welcome page appears, select Next.
In the Name page:
o Enter LinesEO in the Name field.
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-173
o Verify that the Package is <yourname>.oracle.apps.demxx.schema.server.
o In the Schema Object field, enter DEM_ORDER_LINES. You must type thisname correctly. Otherwise, you can check the Synonyms check box (so bothTables and Synonyms are checked) and choose the correct name from the list.
Select the Next button. Click on New From Table button and choose ROWID.
Select the Next button to navigate to the Attribute Settings page (note that all thetable's columns are automatically included as attributes, which complies with the OAFramework Model Coding Standards for Entity Objects.
Select the RowID attribute’s Primary Key check box. Do not change any otherdefault settings.
Select the Next button.
In the Java page, select the Generate Java File check box for the Entity Object Class:OrderEOImpl (you will add business logic to this Java file in a later exercise).
In the Generate Methods region, check the Accessors, Create Method, ValidationMethod and Remove Method check boxes.
Select the Next button.
In the Generate page, deselect the Generate Default View Object check box (or,verify that it is not selected).
Select the Finish button to create your EO.
Select your EO, right-click and select Edit OrderEO...
1.2 Create an Order to Lines Association Object
Select the <yourname>.oracle.apps.demxx.schema.server BC4J package in theNavigator; right-click and select New Association Object to open the AssociationWizard.
If the Welcome page appears, select Next.
In the Name page (Step 1 of 3):
o Enter OrderToLinesAO in the Name field
o Verify that the Package is <yourname>.oracle.apps.demxx.schema.server.
o DO NOT enter a value in the Extends Association field
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-174 Oracle Applications Framework - Practices and Solutions
o Select Next to proceed.
In the Entity Objects page (Step 2 of 3),
o Select OrderEO on the left half; expand it and select OrderId as Source JoinAttribute
o Select LinesEO on the right half; expand it and select OrderId as DestinationJoin Attribute
o Specify 1 to * in the association's cardinality (as Order to Lines is a one-to-manyrelationship)
o Select the Add button to create the join.
o Select Next to proceed.
Figure 2: Selecting source and destination entity objects and attributes in the Entity Object page
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-175
In the Association Properties page (Step 3 of 3):
o Verify if both the Expose Accessor options are checked for the source anddestination objects
o Select the Composition Association checkbox if the destination object cannotexist outside the context of the source object.
o Ensure that Implement cascade delete is also checked
Note: For compositions, always check the Expose Accessor option on the destination object.Optionally enable this for the source object as required in your code.
o Do not select any of the other page options.
o Select Finish to save your association.
1.3 Create a LinesSearchVO View Object (VO)
Create a summary-level view object including only those attributes that you need for the Linessearch results table. This view object is the main view object for your Search page. It shouldleverage the LinesEO (per the OA Framework Model Coding Standards for View Objects, allbut the simplest view objects for things like poplists, lists of values and so on should be based onentity objects).
Select the <yourname>.oracle.apps.demxx.orderentry.server BC4J package in theNavigator, right-click and select New View Object... from the context menu to openthe View Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify LinesSearchVO as the view object's name and verify thatthe package is <yourname>.oracle.apps.demxx.orderentry.server.
Select the Next button.
In the Entity Objects page, select the LinesEO in the Available list and shuttle it tothe Selected list.
Select the Next button.
In the Attributes page, select the following attributes from the Available list andshuttle them to the Selected list.
o From LinesEO:
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-176 Oracle Applications Framework - Practices and Solutions
OrderId
OrderLineNum
ProductId
GlAccountCcId
OrderedQuantity
AttributeCategory
Attribute1
Attribute2
Attribute3
Attribute4
Attribute5
Attribute6
Attribute7
Attribute8
Attribute9
Attribute10
RowID
Select the Next button twice.
At this point the query should look like the following in the Query page (without theformatting we've used here to improve readability):
SELECT LinesEO.ORDER_ID,LinesEO.ORDER_LINE_NUM,LinesEO.PRODUCT_ID,LinesEO.GL_ACCOUNT_CC_ID,LinesEO.ORDERED_QUANTITY,LinesEO.ATTRIBUTE_CATEGORY,LinesEO.ATTRIBUTE1,LinesEO.ATTRIBUTE2,LinesEO.ATTRIBUTE3,LinesEO.ATTRIBUTE4,LinesEO.ATTRIBUTE5,LinesEO.ATTRIBUTE6,LinesEO.ATTRIBUTE7,LinesEO.ATTRIBUTE8,LinesEO.ATTRIBUTE9,LinesEO.ATTRIBUTE10,
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-177
LinesEO.ROWIDFROM DEM_ORDER_LINES LinesEO
Select the Expert Mode checkbox. This allows you to edit the generated query.
In the Query Statement text box modify the query so it looks like the following
SELECT LinesEO.ORDER_ID,LinesEO.ORDER_LINE_NUM,LinesEO.PRODUCT_ID,LinesEO.GL_ACCOUNT_CC_ID,LinesEO.ORDERED_QUANTITY,LinesEO.ATTRIBUTE_CATEGORY,LinesEO.ATTRIBUTE1,LinesEO.ATTRIBUTE2,LinesEO.ATTRIBUTE3,LinesEO.ATTRIBUTE4,LinesEO.ATTRIBUTE5,LinesEO.ATTRIBUTE6,LinesEO.ATTRIBUTE7,LinesEO.ATTRIBUTE8,LinesEO.ATTRIBUTE9,LinesEO.ATTRIBUTE10,LinesEO.ROWID,DemProd.DESCRIPTION,DemProd.SUGGESTED_PRICE,DemProd.UNIT_OF_MEASURE,
LinesEO.ORDERED_QUANTITY * DemProd.SUGGESTED_PRICEAS TOTAL_PRICE
FROM DEM_ORDER_LINES LinesEO,DEM_PRODUCTS DemProd
WHERE LinesEO.PRODUCT_ID = DemProd.PRODUCT_ID
When you are finished with your editing, select the Test button to ensure your syntaxis correct.
Select the Next button.
In the Attribute Mappings page, verify that your view object attributes map to thecorrect query columns. If you need to make any changes, place your cursor into theincorrect View Attributes field and select the correct value from the poplist.
Select the Next button.
In the Java page,
o Select the Generate Java File for View Object Class: LinesSearchVOImpl
o Select the Generate Java File for View Row Class: LinesSearchVORowImpl
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-178 Oracle Applications Framework - Practices and Solutions
to comply with OA Framework coding standards.
Select the Finish button to create your VO.
Now verify that your VO attribute settings match the aliases in your SQL query:
Select the LinesSearchVO in the Navigator, right-click and select EditLinesSearchVO... from the context menu to open the View Object wizard.
Navigate to the Attributes section for your attributes and verify that any aliases inyour query are shown correctly. Make any necessary changes and select Apply.
Navigate to the Attribute Mappings page and verify that all the mappings are correct.Make any necessary changes and select Apply.
Select the OK button to finish editing your VO.
1.4 Add the LinesSearchVO View Object to the OrderEntryAM
Add the LinesSearchVO view object to the OrderEntryAM.
Change the instance name on the right bottom from LinesSearchVO1 toLinesSearchVO.
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-179
2: Create Your Initial Page
2.1 Create the LinesSearchPG Page
Create a new UI page in the <yourname>.oracle.apps.demxx.orderentry.webui package.
Select the OrderEntry.jpr project in the Navigator, right-click and select "New..."from the context menu.
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Page in the OA Components Items list.
Select the OK button to continue.
In the New Page dialog, enter LinesSearchPG in the Name field and
<yourname>.oracle.apps.demxx.orderentry.webui in the Package field.
Warning: You MUST use this name and package or your page will not runproperly. In fact, if any package, Java file, region name, item name, etc. is specifiedin the exercise instructions, you must match it exactly in your work.
Select the OK button to create your page.
2.2 Modify the pageLayout Region
Select your LinesSearchPG in the Structure pane and select the region1 thatJDeveloper created for you.
Verify and set (if necessary) the following properties:
Property ValueID PageLayoutRNRegion Style pageLayoutAM Definition <yourname>.oracle.apps.demxx.orderentry.server.OrderEntryAMWindow Title Order Entry Tutorial: Labs <your name>Title Lines : SearchAutoFooter True
(This ensures that the standard footer, including the Oracle copyright andprivacy notice, render in the page).
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-180 Oracle Applications Framework - Practices and Solutions
2.3 Add a Product Branding Image
Each Oracle Applications page requires a product-branding image.
Select your PageLayoutRN in the Structure pane, right-click and select New ...productBranding from the context menu.
JDeveloper creates a pageLayoutComponents folder containing a productBrandingimage item (named item1). Select this item and set the following properties:
Property ValueID ProdBrandImage URI FNDTAPPBRAND.gifAdditionalText
OA Framework Order Entry Tutorial(This is required per the accessibility coding standards with which all Oracle E-BusinessSuite pages must comply)
2.4 Create the Page Instruction Text
Add the page-level instruction text. Note that we are using an Oracle Applications MessageDictionary message to ensure that the text is translatable. Furthermore, all the properties that youspecify in JDeveloper that can be seen by the user are translatable.
Select the PageLayoutRN in the Structure pane, right-click select New >pageStatus from the context menu (any instruction text or other content added to thepageStatus will render in parallel with any page-level action or navigation buttonsthat you add).
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-181
JDeveloper automatically creates a flowLayout region for you beneath thepageStatus component. Select this region and set its ID to PageStatusRN.
Select PageStatusRN, right-click and select New > Item. Set this item's propertiesas follows:
Property ValueID PageHelpItem Style staticStyledTextData Type VARCHAR2CSS Class OraInstructionTextMessage Appl Short Name DEMXXMessage Name ORDLINES_PAGE_GENERAL
2.5 Test Your Work
Select your page in either the Structure pane or the Navigator window, right-click and chooseRun < file name > from the context menu.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-182 Oracle Applications Framework - Practices and Solutions
3: Configure a Results-Based Search
In this section, you will create a simple "results-based" search by leveraging the OA Frameworkquery region. You will see how to enable the user-personalizable Views panel, the SimpleSearch panel, and the Advanced Search panel without explicitly creating the UIs for theseregions. In the next task, you will change from a "results-based" search to an "auto customizationcriteria" search so you can take a bit more control of the UI that displays in the Search region.
Tip: See the Search topic in Chapter 4 of the OA Framework Developer's Guide for additionalinformation about implementing searching in your pages.
The finished region should appear as shown in Figure 3 below when you've completed all thesteps in this task.
Figure 3: Task 3-Finished Product
3.1 Add a Query Bean to Your Page
Add the query bean region to your page.
Select the PageLayoutRN in the Structure pane, right-click and select New >Region from the context menu.
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-183
Select the new region (region1), and set/verify its properties as follows:
Property ValueID QueryRNRegion Style queryConstruction Mode resultsBasedSearchInclude Simple Panel TrueInclude Views Panel TrueInclude Advanced Panel True
3.2 Add a Results Data Table to Your QueryRN
Select the QueryRN in the Structure pane, right-click and select New > RegionUsing Wizard from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your OrderEntryAM(<yourname>.oracle.apps.demxx.orderentry.server.OrderEntryAM), and thenselect your LinesSearchVO view object instance from the Available View Objectslist.
DO NOT select the Use this as Application Module Definition for this regioncheckbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to ResultsTable and setthe Region Style to table.
Select the Next button.
In the View Attributes page, select the following attributes from the Available ViewAttributes list and shuttle them to the Selected View Attributes list:
o OrderId
o OrderLineNum
o ProductId
o GlAccountCcId
o OrderedQuantity
o Description
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-184 Oracle Applications Framework - Practices and Solutions
o SuggestedPrice
o UnitOfMeasure
o TotalPrice
Select the Next button.
In the Region Items page, set the ID, Style, and Attribute Set properties as follows
ID Prompt Style Data Type Attribute SetOrderId Order Number messageStyledText NUMBEROrderLineNum Line messageStyledText NUMBERProductId Number messageStyledText NUMBERGlAccountCcId Account messageStyledText NUMBEROrderedQuantity Quantity Ordered messageStyledText NUMBERDescription Description messageStyledText VARCHAR2SuggestedPrice Price messageStyledText NUMBERUnitOfMeasure UOM messageStyledText VARCHAR2TotalPrice Total Price messageStyledText NUMBER
Click the Finish button to create your data table.
3.3 Set or Verify Your ResultsTable Region Properties
Select the ResultsTable region in the Structure pane, and set/verify the followingproperties:
Property ValueID ResultsTableRegion Style tableAM Definition Make absolutely sure that you have not inadvertently associated an application
module here. If you have, please delete it.Additional Text Lines Table
(This is required per the accessibility coding standards).Rendered TrueRecordsDisplayed
10
Width 100%User True (needed so the user can save a Personalized View)
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-185
Personalization
3.4 Set or Verify OrderId Item Properties
Configure this item to support sorting in the table, to be included in the "results-based" searchregion that the OA Framework automatically creates, and to be a selectively required searchvalue (for performance reasons, blind queries are disallowed in Oracle Applications unless theunderlying view object has been tuned to include a performant query so no additional searchcriteria is required).
For the OrderId item set or verify:
o Item Style property to messageStyledText
o Search Allowed property to True
o Sort Allowed property to yes
o Initial Sort Sequence to first
o Selective Search Criteria property to True
o Data Type property to NUMBER
o View Instance to LinesSearchVO
o View Attribute to OrderId
o Prompt to Order Number
o User Personalization property to True (needed so the user can save a PersonalizedView).
o Maximum Length to 15
3.5 Set or Verify OrderLineNum Item Properties
For the OrderLineNum item:
o Item Style property to messageStyledText
o Search Allowed property to True
o Selective Search Criteria property to True
o Data Type property to NUMBER
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-186 Oracle Applications Framework - Practices and Solutions
o View Instance to LinesSearchVO
o View Attribute to OrderLineNum
o Prompt to Line
o User Personalization property to True
o Maximum Length to 15
3.6 Set or Verify ProductId Item Properties
For the ProductId item:
o Item Style property to messageStyledText
o Search Allowed property to True
o Selective Search Criteria property to True
o Data Type property to NUMBER
o View Instance to LinesSearchVO
o View Attribute to ProductId
o Prompt to Number
o User Personalization property to True
o Maximum Length to 15
3.7 Set or Verify Description Item Properties
For the Description item:
o Item Style property to messageStyledText
o Search Allowed property to True
o Selective Search Criteria property to True
o Data Type property to VARCHAR2
o View Instance to LinesSearchVO
o View Attribute to Description
o Prompt to Description
o User Personalization property to True
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-187
o Maximum Length to 255
3.8 Set or Verify GlAccountCcId Item Properties
For the GlAccountCcId item:
o Item Style property to messageStyledText
o Selective Search Criteria property to True
o Data Type property to NUMBER
o View Instance to LinesSearchVO
o View Attribute to GlAccountCcId
o Prompt to Account
o User Personalization property to True
o Maximum Length to 38
3.9 Set or Verify OrderedQuantity Item Properties
For the OrderedQuantity item:
o Item Style property to messageStyledText
o Selective Search Criteria property to True
o Data Type property to NUMBER
o View Instance to LinesSearchVO
o View Attribute to OrderedQuantity
o Prompt to Quantity Ordered
o User Personalization property to True
o Maximum Length to 15
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-188 Oracle Applications Framework - Practices and Solutions
3.10 Set or Verify SuggestedPrice Item Properties
For the SuggestedPrice item:
o Item Style property to messageStyledText
o Selective Search Criteria property to True
o Data Type property to NUMBER
o View Instance to LinesSearchVO
o View Attribute to SuggestedPrice
o Prompt to Price
o User Personalization property to True
o Maximum Length to 25
3.11 Set or Verify UnitOfMeasure Item Properties
For the UnitOfMeasure item:
o Item Style property to messageStyledText
o Selective Search Criteria property to True
o Data Type property to VARCHAR2
o View Instance to LinesSearchVO
o View Attribute to UnitOfMeasure
o Prompt to UOM
o User Personalization property to True
o Maximum Length to 25
3.12 Set or Verify TotalPrice Item Properties
For the TotalPrice item:
o Item Style property to messageStyledText
o Selective Search Criteria property to True
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-189
o Data Type property to NUMBER
o View Instance to LinesSearchVO
o View Attribute to TotalPrice
o Prompt to Total Price
o User Personalization property to True
3.13 Test Your Work
Test your work. Your results should appear as shown in Figure 3 above.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-190 Oracle Applications Framework - Practices and Solutions
4: Convert your search region to use Auto Customization Criteria
We have to add an LOV to our search region, so, we need to convert our query bean to run in"auto customization criteria mode" (that is, we want to customize our search criteria by addingan LOV). The finished region after Task 4 should appear as shown in Figure 4 below (the LOVicon appears after you finish Task 5).
Figure 4: Task 4-Finished Product
Before you proceed with Task 4, arrange your items (drag-drop in the following order:
o OrderId
o OrderLineNum
o ProductId
o Description
o OrderedQuantity
o SuggestedPrice
o UnitOfMeasure
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-191
o TotalPrice
o GlAccountCcId
4.1 Change the Query Bean to Use autoCustomizationCriteria
Select the QueryRN in the Structure pane.
Change its Construction Mode property to autoCustomizationCriteria.
Change its Include Views Panel property to False.
Change its Include Advanced Panel property to False.
4.2 Add a Simple Search Region
Select the QueryRN in the Structure pane, right-click and choose New >simpleSearchPanel from the context menu (remember this is a named child of thequery region). A header region (region2) and a messageComponentLayout region(region1) will be created automatically.
Select the header region, set its ID to SimpleSearchHdr and change the default Textproperty value to Search.
Select the default messageComponentLayout region created under thesimpleSearchPanel folder (region1) and set its ID to CustomSimpleSearch.
4.3 Create an OrderId Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and selectNew > messageTextInput from the context menu.
Select this item, and set or verify its properties as follows
Property ValueID SearchOrdNumItem Style messageTextInput
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-192 Oracle Applications Framework - Practices and Solutions
Property ValueSelective SearchCriteria
True
Data Type NUMBERMaximum Length 15Prompt Order NumberCSS Class OraFieldTextLength 5
4.4 Create an OrderLineNum Search Item
Select the CustomSimpleSearch region in the Structure pane, right-click and selectNew > messageTextInput from the context menu.
Select this item, and change or verify its properties as follows:
Property ValueID SearchOrdLineNumItem Style messageTextInputSelective Search Criteria TrueData Type NUMBERPrompt LineCSS Class OraFieldTextLength 15
4.5 Create a ProductId Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and selectNew > messageTextInput from the context menu.
Select this item, and set or verify its properties as follows
Property ValueID SearchProdNumItem Style messageTextInput (we will change this to LOV later)Selective Search Criteria TrueData Type NUMBERMaximum Length 15Prompt NumberCSS Class OraFieldTextLength 15
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-193
4.6 Create a Description Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and selectNew > messageTextInput from the context menu.
Select this item, and set or verify its properties as follows
Property ValueID SearchDescItem Style messageTextInput (we will change this to LOV later)Selective SearchCriteria
True
Data Type VARCHAR2Prompt DescriptionCSS Class OraFieldTextMaximum Length 255Length 15
4.7 Create Search Mappings Between Search Items and ResultsTable
The OA Framework uses the mappings that you define between your custom search items andcolumns in the ResultsTable to handle the query automatically when the user selects the Gobutton.
Select the query bean or the query Components folder in the Structure pane, right-click and choose New > simpleSearchMappings from the context menu.
Select the default mapping created under the simpleSearchMappings and set itsproperties to the following:
Property ValueID OrderNumMapSearch Item SearchOrdNumResults Item OrderId
Select the simpleSearchMappings folder in the Structure pane, right-click andchoose New > queryCriteriaMap from the context menu.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-194 Oracle Applications Framework - Practices and Solutions
Select the new mapping and set its properties as follows:
Property ValueID OrdLineMapSearch Item SearchOrdLineNumResults Item OrderLineNum
Select the simpleSearchMappings folder in the Structure pane, right-click andchoose New > queryCriteriaMap from the context menu.
Select the new mapping and set its properties as follows:
Property ValueID ProdNumMapSearch Item SearchProdNumResults Item ProductId
Select the simpleSearchMappings folder in the Structure pane, right-click andchoose New > queryCriteriaMap from the context menu.
Select the new mapping and set its properties as follows:
Property ValueID DescMapSearch Item SearchDescResults Item Description
4.8 Test Your Work
Test your work. Your results should appear as shown in Figure 4 above (but without the LOVicon).
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-195
5: Adding a List of Values (LOV) to a Field
In this section, you will create a reusable list of values (LOV) that you will then configure foruse in the Search page (you will use this same LOV later in the Create page). The finished LOVshould appear as shown in Figure 5.
Figure 5a: Product Number LOV Window
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-196 Oracle Applications Framework - Practices and Solutions
Figure 5b: Description LOV Window
5.1 Create the Product LOV View Object
Select the <yourname>.oracle.apps.demxx.lov.server package in the Navigator,right-click and select "New View Object..." from the context menu to open theView Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify ProductLovVO as the view object name and verify thatthe package is <yourname>.oracle.apps.demxx.lov.server.
Select the Next button until you get to the Query page.
In the Query page, enter the following query into the Query Statement text field.
SELECT D.PRODUCT_ID,D.DESCRIPTION,D.UNIT_OF_MEASURE,
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-197
D.SUGGESTED_PRICEFROM DEM_PRODUCTS DORDER BY PRODUCT_ID, DESCRIPTION
Select the Test button to ensure your syntax is correct.
Select the Next button until you get to the Java page.
In the Java page, deselect the Generate Java File for View Object Class:ProductLovVOImpl.
Do select the Generate Java File for View Row Class: ProductLovVORowImpl tocomply with OA Framework coding standards.
Select the Finish button to create your VO.
5.2 Add the ProductLovVO to the OrderEntryLovAM
View objects can be used only within the context of a containing application module. Before weuse the ProductLovVO in our LOV, we must add it to the LOV application module.
Select the OrderEntryLovAM in the Navigator pane; right-click and select EditOrderEntryLovAM... from the context menu to open the Application Modulewizard.
Navigate to the Data Model page.
Select the ProductLovVO view object in the Available View Objects list andshuttle it to the Data Model list. Change Instance name on the right fromProductLovVO1 to ProductLovVO.
Select the OK button to finish adding this VO to the AM.
5.3 Create the Shared ProductLovRN LOV Region
Since the Product details LOV can be used in many different pages, it must be created as ashared, standalone region.
Select the OrderEntry.jpr project in the Navigator, right-click and select New...from the context menu.
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Region in the OA Components Items list.
Select the OK button to continue.
In the New Region dialog, specify the following values:
o In the Name field enter ProductLovRN.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-198 Oracle Applications Framework - Practices and Solutions
o In the Package field enter <yourname>.oracle.apps.demxx.lov.webui.
o In the Style field select listOfValues.
o Click the OK button to create your region.
Select the ProductLovRN in the Structure pane, set the AM Definition property to<yourname>.oracle.apps.demxx.lov.server.OrderEntryLovAM, set the AdvancedSearch Allowed property to True and set the Scope property to Public.
5.4 Add a Table to the LOV Region
Select the ProductLovRN in the Structure pane, right-click and select New > tableUsing Wizard from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your OrderEntryLovAM(<yourname>.oracle.apps.demxx.lov.server.OrderEntryLovAM), then selectyour ProductLovVO view object instance from the Available View Objects list.DO NOT select the Use this as Application Module Definition for this regioncheckbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to ProdLovTable andset the Region Style to table.
Select the Next button.
In the View Attributes page, add all the attributes in the ProductLovVO.
Select the Next button.
In the Region Items page, set the ID, Style properties as follows
ID Prompt Style Data Type Attribute SetProdId Product Number messageStyledText NUMBERDescription Description messageStyledText VARCHAR2Uom UOM messageStyledText VARCHAR2SugPrice Price messageStyledText NUMBER
Click the Finish button to create your data table.
Set the Additional Text property on your table to Product Details List.
Select the ProdId and Description items in the Structure pane
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-199
o Set their Search Allowed properties to True
Select the Uom and SugPrice items in the Structure pane
o Set their Search Allowed and Selective Search Criteria properties to True.
5.5 Make the Product Id Search Item an LOV
When we first created the Product Number item, we set its style to messageTextInput (a standardtext entry field). Now, we need to configure it to include an LOV.
Select the SearchProdNum item in the CustomSimpleSearch panel.
Change its Item Style property to messageLovInput.
When you set the Item Style property to messageLovInput, JDeveloperautomatically creates an inline LOV region (region style listOfValues) and a defaultLOV mapping.
Set the External LOV property to/<yourname>/oracle/apps/demxx/lov/webui/ProductLovRN.
Note: When we change this property, JDeveloper displays a confirmation message indicatingthat children of our base field, such as the inline LOV region, will be removed by the change.Confirm the change (select the OK button). Once you confirm, the inline LOV region isremoved and the new external LOV region appears in the hierarchy (grayed out because it cannotbe edited directly in your page).
Verify if its Disable Validation property to False.
Note: Per the OA Framework View Coding Standards, validation should always be enabled onan LOV field unless the user should be able to enter partial values, as is often the case in a searchcriteria field.
5.6 Define LOV Mappings
Create mappings between base page items and LOV items. The mappings identify the datainput/output relationships between base page items and LOV items.
Select the default LOV mapping, ID labeled as lovMap1, and set the followingproperties:
o Change the LOV Region Item property by selecting ProdId field from thepoplist.
o Change the Return Item property by selecting SearchProdNum field from thepoplist.
o Change the Criteria Item property by selecting SearchProdNum field from
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-200 Oracle Applications Framework - Practices and Solutions
the poplist.
Right-click lovMappings in the Structure panel, and select New > lovMap from thecontext menu.
Select the default LOV mapping, ID labeled as lovMap2, and set the followingproperties:
o Change the LOV Region Item property by selecting Description field fromthe poplist.
o Change the Return Item property by selecting SearchDesc field from thepoplist.
5.7 Make the Description Search Item an LOV
When we first created the SearchDesc item, we set its style to messageTextInput (a standard textentry field). Now, we need to configure it to include an LOV.
Select the SearchDesc item in the CustomSimpleSearch panel.
Change its Item Style property to messageLovInput.
When you set the Item Style property to messageLovInput, JDeveloperautomatically creates an inline LOV region (region style listOfValues) and a defaultLOV mapping.
Set the External LOV property to/<yourname>/oracle/apps/demxx/lov/webui/ProductLovRN.
Verify if its Disable Validation property to True.
5.8 Define LOV Mappings
Create mappings between base page items and LOV items. The mappings identify the datainput/output relationships between base page items and LOV items.
Select the default LOV mapping, ID labeled as lovMap3, and set the followingproperties:
o Change the LOV Region Item property by selecting Description field fromthe poplist.
o Change the Return Item property by selecting SearchDesc field from thepoplist.
o Change the Criteria Item property by selecting SearchDesc field from thepoplist.
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-201
Right-click lovMappings in the Structure panel, and select New > lovMap from thecontext menu.
Select the default LOV mapping, ID labeled as lovMap4, and set the followingproperties:
o Change the LOV Region Item property by selecting ProdId field from thepoplist.
o Change the Return Item property by selecting SearchProdNum field from thepoplist.
5.9 Test Your Work
Test your work. Your base page (the Orders Search page) should appear as shown in the figureabove. When you select the list of values icon, your LOV windows should appear as shown inFigures 5 (a/b).
Warning: You cannot run and test the LOV page directly. You must run your base page, andthen select the list of values icon to invoke the LOV.
Figure 6: Revised Search Page Finished Product
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-202 Oracle Applications Framework - Practices and Solutions
6: Revise the Search Page to include a Goto Order Search button
6.1 Add a "Goto Order Search" Button to Your Search Page
First, you need to revise the LinesSearchPG to include a Goto Order Search button above theresults table. To do this, you will need to add a tableAction component to the Results table thatyou created in the Lines Search Exercise.
Select the ResultsTable region in the Structure pane, right-click and select New >tableActions from the context menu.
JDeveloper automatically creates a flowLayout region for you.
Change this region's ID to ButtonLayout.
Select the ButtonLayout region, right-click and select New > Item. Set this item'sproperties as follows:
Property ValueID GotoItem Style SubmitButtonAttribute Set /oracle/apps/fnd/attributesets/Buttons/GoPrompt Goto Order SearchAdditional Text Select to query an order
Select the LinesSearchPG, right-click and select Run LinesSearchPG.xml. Yourpage should appear as shown in Figure 1.
6.2 Add " Goto Order Search" Button Press Handler to Your Search Page
When the user presses the Goto Order Search submitButton, you need processFormRequest()code to determine that this button has been pressed and navigate the user to theOrderSearchPG.
First, create a controller and associate with the PageLayoutRN region in the LinesSearchPG.
Select the PageLayoutRN region in the LinesSearchPG, right-click and select SetNew Controller ... from the context menu.
In the Package Name field enter<yourname>.oracle.apps.demxx.orderentry.webui.
In the Name field enter LinesSearchCO.
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-203
Select the OK button to create your controller.
Then, add the following code to the LinesSearchCO.processFormRequest( ) method:import oracle.apps.fnd.framework.webui.OAWebBeanConstants;...
public void processFormRequest(OAPageContext pageContext, OAWebBeanwebBean){// Always call this first
super.processFormRequest(pageContext, webBean);
if (pageContext.getParameter("Goto")!=null){// Navigate to the Order Search Page while retaining the AM.// Note the use of KEEP_MENU_CONTEXT as opposed to
GUESS_MENU_CONTEXT// since we know the current tab should remain highlighted.
pageContext.setForwardURL("OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/OrderSearchPG",
null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null, //HashMapfalse, // Retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_YES,OAWebBeanConstants.IGNORE_MESSAGES);
}}
6.3 Compile and Save Your Work
Select the LinesSearchPG, right-click and select Run LinesSearchPG.xml.
Your page should appear as shown in Figure 1.
At this point, your Goto Order Search button click should navigate to Orders Search page.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-204 Oracle Applications Framework - Practices and Solutions
7: Implement the View Object Query
7.1 Add an initQuery( ) Method to Your LinesSearchVOImpl Class
This method should take an orderId parameter, set the WHERE clause to ORDER_ID = :1, bindthe orderId parameter to the WHERE clause, and execute the query.
import oracle.jbo.domain.Number;import oracle.apps.fnd.framework.OAException;...
public void initQuery (String orderNumber){if ((orderNumber != null) && (!("".equals(orderNumber.trim())))){setWhereClause(null);setWhereClauseParams(null);executeQuery();
Number ordNum = null;
try{ordNum = new Number(orderNumber);
}catch(Exception e){throw new OAException("DEMXX", "ORDLINES_INVALID_LINE_NUMBER");
}
setWhereClause(null);setWhereClauseParams(null);setWhereClause("ORDER_ID = :1");setWhereClauseParam(0,ordNum);executeQuery();
}
} // end initQuery()...
7.2 Add an initLinesDetails( ) Method to Your OrderEntryAMImpl Class
You will invoke this method from your UI controller.This method delegates to the initQuery()method that you just created on the LinesSearchVOImpl class.
import oracle.apps.fnd.framework.OAException;import oracle.apps.fnd.common.MessageToken;...
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-205
/*****************************************************************************
* Initializes the detail order-lines query.
*****************************************************************************
*/
public void initLinesDetails(String orderNumber){LinesSearchVOImpl vo = (LinesSearchVOImpl)getLinesSearchVO();if (vo == null){MessageToken[] errTokens = { new MessageToken("OBJECT_NAME",
"LinesSearchVO") };throw new OAException("DEMXX", "ORDLINES_OBJECT_NOT_FOUND",
errTokens);}vo.initQuery(orderNumber);
} // end initLinesDetails()
7.3 Save and Compile Your Work
Select the JDeveloper main menu option File > Save All.
Select your project, right-click and select Rebuild OrderEntry.jpr to compile everything
Figure 7a: Configure OrderId Item in OrderDetailsPG as a Drilldown link to LinesSearchPG
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-206 Oracle Applications Framework - Practices and Solutions
Figure 7b: LinesSearchPG renders as follows on selecting OrderId
Lab 8: Lines: Search………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-207
8: Implement the Drilldown to the LinesSearchPG
In this section, you will add a link on the OrderId item in the OrderDetailsPG in the previouslab. This link navigates to the LinesSearch page that you just created.
8.1 Configure the OrderId Item as a Link
When the user selects an Order Number link, the Lines Search page should display informationregarding the corresponding Order. As part of this GET request, we also want to:
Add orderNumber parameter to the URL. This parameter value should be sourcedfrom the OrderDetailsVO attributes OrderId.
Indicate that the OrderDetailsPG's application module instance should be retainedwhen the LinesSearchPG renders so these pages can share the same root applicationmodule.
Indicate that breadcrumbs should display in the OrderDetailsPG.
To achieve this, select the OrderId item in the OrderDetailsPG and set the Destination URIproperty to:
OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/LinesSearchPG
&orderNumber={@OrderId}
&retainAM=Y&addBreadCrumb=Y
Set the CSS Class property to : OraLinkText
8.2 Modify the Controller Logic to Initalize Order Query When Page Renders
To automatically query the underlying LinesSearchVO view object when the LinesSearchPGrenders, add the following code to the LinesSearchCO.processRequest( ) method.
Note that you are referencing the orderNumber parameter that you add to the URL when theuser selects the Order Number link.
import java.io.Serializable;import oracle.apps.fnd.framework.OAApplicationModule;...
public void processRequest(OAPageContext pageContext, OAWebBeanwebBean){
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-208 Oracle Applications Framework - Practices and Solutions
super.processRequest(pageContext, webBean);// Get the orderNumber parameter from the URLString orderNumber = pageContext.getParameter("orderNumber");
// Now we want to initialize the query for our single order// with all of its lines details.OAApplicationModule am = pageContext.getApplicationModule(webBean);Serializable[] parameters = { orderNumber };am.invokeMethod("initLinesDetails", parameters);
}
8.3 Test Your Work
Test your work. Run the OrderSearchPG, query for orders and navigate to Order Details Page.Select the Order Link which is configured as a link to query the Lines Search Page with the linesdetails for the order chosen.
Note: The LinesSearchPG cannot be used to query other information when it is used as adrilldown. To query different order-lines for various orders Rebuild OrderEntry.jpr and RunLinesSearchPG explicitly.
You are now finished with this exercise.
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-209
Lab 9: Lines: Create
Overview
In this exercise, we will implement a Create page for the Order Lines and add validation to theOrderLines Button in the Orders Create and Update Pages. The end product of the Lines Createexercise would look like Figure 1 shown below.
Warning: This lab assumes that you have completed the Orders Create Exercise and builds onthat work. If you have not completed these exercises, please do so before proceeding.
Figure 1: Create Page Finished Product
1: Create a View Object for the Create Page
Step 1.1 Create a LinesDetailsVO View Object (VO)
Create a detail-level view object including only those attributes that you need for the Lines createpage. This view object is the main view object for your Create page. It should leverage theLinesEO
Select the <yourname>.oracle.apps.demxx.orderentry.server BC4J package in theNavigator, right-click and select New View Object... from the context menu to openthe View Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify LinesDetailsVO as the view object's name and verify thatthe Package is <yourname>.oracle.apps.demxx.orderentry.server.
Select the Next button.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-210 Oracle Applications Framework - Practices and Solutions
In the Entity Objects page, select the LinesEO in the Available list and shuttle it tothe Selected list.
Select the Next button.
In the Attributes page, select the following attributes from the Available list andshuttle them to the Selected list.
From LinesEO:
o OrderId
o OrderLineNum
o ProductId
o GlAccountCcId
o OrderedQuantity
o AttributeCategory
o Attribute1
o Attribute2
o Attribute3
o Attribute4
o Attribute5
o Attribute6
o Attribute7
o Attribute8
o Attribute9
o Attribute10
o RowID
Select the Next button twice.
At this point the query should look like the following in the Query page (without theformatting we've used here to improve readability):
SELECT LinesEO.ORDER_ID,LinesEO.ORDER_LINE_NUM,LinesEO.PRODUCT_ID,LinesEO.GL_ACCOUNT_CC_ID,LinesEO.ORDERED_QUANTITY,
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-211
LinesEO.ATTRIBUTE_CATEGORY,LinesEO.ATTRIBUTE1,LinesEO.ATTRIBUTE2,LinesEO.ATTRIBUTE3,LinesEO.ATTRIBUTE4,LinesEO.ATTRIBUTE5,LinesEO.ATTRIBUTE6,LinesEO.ATTRIBUTE7,LinesEO.ATTRIBUTE8,LinesEO.ATTRIBUTE9,LinesEO.ATTRIBUTE10,LinesEO.ROWID
FROM DEM_ORDER_LINES LinesEO
Select the Expert Mode checkbox. This allows you to edit the generated query.
In the Query Statement text box modify the query so it looks like the following
SELECT LinesEO.ORDER_ID,LinesEO.ORDER_LINE_NUM,LinesEO.PRODUCT_ID,LinesEO.GL_ACCOUNT_CC_ID,LinesEO.ORDERED_QUANTITY,LinesEO.ATTRIBUTE_CATEGORY,LinesEO.ATTRIBUTE1,LinesEO.ATTRIBUTE2,LinesEO.ATTRIBUTE3,LinesEO.ATTRIBUTE4,LinesEO.ATTRIBUTE5,LinesEO.ATTRIBUTE6,LinesEO.ATTRIBUTE7,LinesEO.ATTRIBUTE8,LinesEO.ATTRIBUTE9,LinesEO.ATTRIBUTE10,LinesEO.ROWID,DemProd.DESCRIPTION,DemProd.SUGGESTED_PRICE,DemProd.UNIT_OF_MEASURE,
LinesEO.ORDERED_QUANTITY * DemProd.SUGGESTED_PRICEAS TOTAL_PRICE
FROM DEM_ORDER_LINES LinesEO,DEM_PRODUCTS DemProd
WHERE LinesEO.PRODUCT_ID = DemProd.PRODUCT_ID
When you are finished with your editing, select the Test button to ensure your syntaxis correct.
Select the Next button.
In the Attribute Mappings page, verify that your view object attributes map to the
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-212 Oracle Applications Framework - Practices and Solutions
correct query columns. If you need to make any changes, place your cursor into theincorrect View Attributes field and select the correct value from the poplist.
Select the Next button.
In the Java page,
o Select the Generate Java File for View Object Class: LinesDetailsVOImpl (youdon't need to add any code to this view object).
o Do select the Generate Java File for View Row Class: LinesDetailsVORowImplto comply with OA Framework coding standards.
Select the Finish button to create your VO.
Now verify that your VO attribute settings match the aliases in your SQL query:
Select the LinesDetailsVO in the Navigator, right-click and select EditLinesDetailsVO... from the context menu to open the View Object wizard.
Navigate to the Attributes section for your attributes and verify that any aliases inyour query are shown correctly. Make any necessary changes and select Apply.
Navigate to the Attribute Mappings page and verify that all the mappings are correct.Make any necessary changes and select Apply.
Select the OK button to finish editing your VO.
Note: Do not add your LinesDetailsVO to OrderEntryAM immediately. We will add it a bit later.
1.2 Create a OrderToLinesVL View Link (VL)
Create a new view link in the <yourname>.oracle.apps.demxx.orderentry.server package:
Select the <yourname>.oracle.apps.demxx.orderentry.server BC4J package in theNavigator, right-click and select New View Link... from the context menu to open theView Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify OrderToLinesVL as the view link's name and verify thatthe Package is <yourname>.oracle.apps.demxx.orderentry.server.
Select the Next button.
In the View Objects page,
o Select the OrderDetailsVO as Source view object.
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-213
o Select the LinesDetailsVO as Destination view object.
o Select Next to proceed.
In the Source Attributes page,
o Select the association object OrderToLinesAO and click the button to shuttle thesource attribute to the Selected Attributes list on the right.
o Verify that OrderId appears in the selected attributes list.
o Select Next to proceed.
Figure 2: View Link Wizard showing use of an association to obtain the source view object joinattribute
In the Destination Attributes page,
o Verify that OrderId appears as the Destination attribute in the selected attributelist.
o Select Next to proceed.
In the View Link SQL page,
o Review the WHERE clause that BC4J is going to create for you to ensure that it is
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-214 Oracle Applications Framework - Practices and Solutions
correct.
Figure 3: View Link Wizard showing a generated WHERE clause
In the View Link Properties page,
o Verify that the cardinality is 1 to *
o Select Generate Accesor for both the View Objects
Select Finish to create your view link.
1.3 Add the LinesDetailsVO to OrderEntryAM
Select the LinesDetailsVO via OrderToLinesVL view object on the left.
Select the OrderDetailsVO view object on the right.
Now shuttle LinesDetailsVO via OrderToLinesVL to the right.(as shown in figure4 below)
Change the instance name on the right bottom from LinesDetailsVO1 toLinesDetailsVO.
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-215
Select OK to create the Master-Detail relationship.
Figure 4 : Creating Master-Detail Relationship using View Links
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-216 Oracle Applications Framework - Practices and Solutions
2: Build the Create Page
In this section, you will create an order Create page as shown in Figure 1 above.
2.1 Create the LinesCreatePG Page
Create a new OA Components page in the<yourname>.oracle.apps.demxx.orderentry.webui package calledLinesCreatePG.
2.2 Modify the pageLayout Region
Verify and set (if necessary) the following properties for the pageLayout region ofyour new LinesCreatePG:
Property ValueID PageLayoutRNRegion Style pageLayoutAM Definition <yourname>.oracle.apps.demxx.orderentry.server.OrderEntryAMWindow Title Order Entry Tutorial: Labs <your name>Title Lines: CreateWarn About Changes TrueAutoFooter True
2.3 Add a Product Branding Image
Add the product-branding image, FNDTAPPBRAND.gif, to your page.
2.4 Add Page-Level Apply and Cancel Buttons
Per the BLAF UI guidelines, all page-level buttons render twice on the page: below the pagetitle, and below the ski. However, you only need to add them once using a specialpageButtonBar region.
First, select the PageLayoutRN in the Structure pane, then right-click and selectNew > Region from the context menu.
Set the following properties for this region:
Property ValueID PageButtonsRegion Style pageButtonBar
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-217
Second, add a Cancel button. Right-click PageButtons in the Structure pane, andselect New > Item from the context menu. Set or verify the following properties forthis item:
Property ValueID CancelItem Style submitButtonAttribute Set /oracle/apps/fnd/attributesets/Buttons/Cancel
(Always use the standard OA Framework attribute sets for common buttons.)Disable ServerSideValidation
True(So the user can leave the page by selecting this button without encounteringserver- side validation errors.)
Disable ClientSideValidation
True(So the user can leave the page by selecting this button without encounteringclient- side validation errors.)
Prompt Cancel(Set automatically when you specify the attribute set.)
Warn AboutChanges
False(So the user can leave the page by selecting this button without being warnedabout pending changes.)
Additional Text Select to cancel this transaction.(This is required per the accessibility coding standards).
Third, add an Apply button. Right-click PageButtons in the Structure pane, andselect New > Item from the context menu. Set or verify the following properties forthis item:
Property ValueID ApplyItem Style submitButtonAttribute Set /oracle/apps/fnd/attributesets/Buttons/ApplyPrompt Apply
(Set by the attribute set.)Additional Text Select to save this Line.
2.5 Create the Content Region
To achieve the correct indentation of our display fields, add a advancedTable region to yourPageLayoutRN.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-218 Oracle Applications Framework - Practices and Solutions
Select PageLayoutRN in the Structure pane, right-click and select New > Regionfrom the context menu.
Set the following properties for the new region
Property ValueID AdvTblHdrRNItem Style hideShowHeader
Select AdvTblHdrRN in the Structure pane, right-click and select New > Regionfrom the context menu.
Set the folowing properties for the new region
Property ValueID LinesAdvTblRNItem Style AdvancedTableView Instance LinesDetailsVOText Order Lines TableAdditional Text Lines Entry for OrdersRecords Displayed 10Width 100%
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property to OrdIdCol
Select OrdIdCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property ValueID OrderIdItem Style messageStyledTextData Type NUMBERView Attribute OrderIdPrompt Order NumberCSS Class OraDataText
Select the columnHeader component, right-click and select New > sortableHeader
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-219
Set the ID property to OrdIdHdr
Set the Prompt to Order Number
Set the Required Indicator property to Yes
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column OrdLineCol
Select OrdLineCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property ValueID OrderLineNumItem Style messageTextInputRequired yesData Type NUMBERMaximum Length 15View Attribute OrderLineNumPrompt LineCSS Class OraFieldTextLength 5
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to OrdLineHdr
Set the Prompt to Line
Set the Required Indicator property to Yes
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column ProdCol
Select ProdCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property Value
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-220 Oracle Applications Framework - Practices and Solutions
ID ProductIdItem Style messageTextInputRequired yesData Type NUMBERMaximum Length 15View Attribute ProductIdPrompt NumberCSS Class OraFieldTextLength 8
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to ProdHdr
Set the Prompt to Number
Set the Required Indicator property to Yes
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column DescCol
Select DescCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property ValueID DescriptionItem Style messageTextInputRequired yesData Type VARCHAR2Maximum Length 255View Attribute DescriptionPrompt DescriptionCSS Class OraFieldText
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to DescHdr
Set the Prompt to Description
Set the Required Indicator property to Yes
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-221
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column OrdQuantCol
Select OrdQuantCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property ValueID OrderedQuantityItem Style messageTextInputData Type NUMBERMaximum Length 15View Attribute OrderedQuantityPrompt Quantity OrderedCSS Class OraFieldText
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to OrdQuantHdr
Set the Prompt to Quantity Ordered
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column UomCol
Select UomCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property ValueID UnitOfMeasureItem Style messageTextInputDisabled TrueData Type VARCHAR2Maximum Length 25View Attribute UnitOfMeasurePrompt UOMCSS OraFieldText
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-222 Oracle Applications Framework - Practices and Solutions
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to UomHdr
Set the Prompt to UOM
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column SuggPriceCol
Select SuggPriceCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property ValueID SuggestedPriceItem Style messageTextInputDisabled TrueData Type NUMBERMaximum Length 25View Attribute SuggestedPricePrompt PriceCSS Class OraFieldText
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to SuggPriceHdr
Set the Prompt to Price
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column TotPriceCol
Select TotPriceCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property ValueID TotalPriceItem Style messageTextInput
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-223
Disabled TrueView Attribute TotalPricePrompt Total PriceCSS Class OraDataText
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to TotPriceHdr
Set the Prompt to Total Price
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column DffCol
Select DffCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Property ValueID DescFlexItem Style messageTextInputView Attribute Attribute2Prompt Order NumberCSS Class OraFieldText
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to DffHdr
Set the Prompt to [..]
Select LinesAdvTblRN in the Structure pane, right-click and select New > Columnfrom context menu.
Set the ID property for the new column KeyFlexCol
Select KeyFlexCol in the Structure pane, right-click and select New > Item
Set the following properties for the new item
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-224 Oracle Applications Framework - Practices and Solutions
Property ValueID GlAccountCcIdItem Style messageTextInputView Attribute GlAccountCcIdCSS Class OraFieldText
Select the columnHeader component, right-click and select New > sortableHeader
Set the ID property to AccHdr
Set the Prompt to Account
2.6 Set up Your LOVs
The ProductId and description items have to be configured as LOVs. Use the ProductLovRN youalready created in the Search page to configure them as LOVs
For ProductId Item
Property ValueItem Style MessageLovInputExternal LOV /<yourname>/oracle/apps/demxx/lov/webui/ProductLovRNLOV Mappings You must create LOV mappings for the following:
LOV Map 1 ID: ProdIdMap Lov Region Item: ProdId Return Item: ProductId Criteria Item: ProductIdLOV Map 2 ID: DescMap Lov Region Item: Description Return Item: DescriptionLOV Map 3 ID: UomMap Lov Region Item: Uom Return Item: UnitOfMeasureLOV Map 4 ID: SuggPriceMap Lov Region Item: SugPrice Return Item: SuggestedPrice
For Description Item
Property Value
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-225
Item Style messageLovInputExternal LOV /<yourname>/oracle/apps/demxx/lov/webui/ProductLovRNLOV Mappings You must create LOV mappings for the following:
LOV Map 1 ID: DescMap1 Lov Region Item: Description Return Item: Description Criteria Item: DescriptionLOV Map 2 ID: ProdIdMap1 Lov Region Item: ProdId Return Item: ProductIdLOV Map 3 ID: UomMap1 Lov Region Item: Uom Return Item: UnitOfMeasureLOV Map 4 ID: SuggPriceMap1 Lov Region Item: SugPrice Return Item: SuggestedPrice
2.7 Add a ‘Add Another Row’ Button and a ‘Recalculate Total Price’ Button
The following steps describe how to display an Add Another Row button to the footer of anadvanced table.
Select your LinesAdvTblRN, right-click and select New > footer from the contextmenu.
OA Extension creates an advancedTables Components folder containing a footernamed child, that contains a tablefooter container (labeled tableFooter1). Changethe ID to TableFooter.
Select the TableFooter and choose New > addTableRow from the context menu.
Select addTableRow1 and set/verify the following properties
o ID to AddAnotherRow
o Insert Rows Automatically to True
o Add Rows Label to Add Another Row.
The following steps help us in creating a Recalculate Total Price button to the footer of anadvanced table.
Select the TableFooter and choose New > total from the context menu.
Select totalRow1 and set/verify the following properties
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-226 Oracle Applications Framework - Practices and Solutions
o ID to TotalRow
o Recalculate Totals Label to Recalculate Total Price.
o Additional Text to Click to recalculate net price.
Now, select TotPriceCol in Structure Pane
o Set Total Value to True
2.8 Add a ‘Multiple Selection’ with a ‘Delete’ Button
Select the LinesDetailsVO from the<yourname>.oracle.apps.demxx.orderentry.server package, right-click and selectEdit LinesDetailsVO.
Select the Attributes Tab and click on the New button.
Set the following attributes
o Name : SelectRow
o Type : String
o Updatable : Always
Select the OK button
Go to the Attribute Mappings Tab and verify if the mapping is correct.
Select the OK button to create the transient attribute.
Now add a MultipleSelection Bean and a Delete Button
Select the LinesCreatePG from the navigator pane.
Select advancedTable Components, right-click and select New >multipleSelection from context menu
Set or verify the following properties
o ID to MultipleSelection
o View Attribute to SelectRow
o Text to Select Object:
Select MultipleSelection, right-click and select New > flowLayout from contextmenu
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-227
Set its ID to ButtonLayoutRN
Select the ButtonLayoutRN, right-click and select New > Item from context menu
Set or verify the following properties
o ID to Delete
o Item Style to submitButton
o Attribute Set to /oracle/apps/fnd/attributesets/Buttons/Delete
o Additional Text to Select to delete a row
o Disable Client Side Validation to True
o Disable server Side Validation to True
2.9 Add an "Indicates Required Field" Region
The "Indicates Required Field" region should render on the same line as the page-levelaction/navigation buttons. To achieve this, always add page-level keys like this to a pageStatuscomponent.
Select the PageLayoutRN, right-click and select New > pageStatus.
Select the flowLayout region that JDeveloper creates for you beneath thepageStatus component and set its ID to PageStatusRN.
Select PageStatusRN, right-click and select New > Region.
Set the following properties for this region (whenever you need a BLAF-standard"Indicates Required Field" key in your page, you can simply extend the common OAFramework region shown below).
Property ValueID RequiredKeyExtends /oracle/apps/fnd/framework/webui/OAReqFieldDescRGWidth 100%
2.10 Add an initQuery() to LinesDetailsVO
Add the following code to your LinesDetailsVO to execute the querybased on a Boolean valuecoming in as a parameter.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-228 Oracle Applications Framework - Practices and Solutions
public void initQuery(Boolean executeQuery){
// Check the executeQuery parameter and explicitly execute// the query if needed.
if ((executeQuery != null) && (executeQuery.booleanValue())){executeQuery();
}}
2.11 Add the initTableQuery() to OrderEntryAMImpl
Add the following code to your OrderEntryAMImpl to invoke the initQuery() method in theLinesDetailsVO with a boolean parameter passed.
public void initTableQuery(Boolean executeQuery){
LinesDetailsVOImpl vo = getLinesDetailsVO();vo.initQuery(executeQuery);
}
2.12 Set the Controller for the PageLayoutRN
Select the PageLayoutRN, right-click and select Set New Controller from contextmenu
Set the package to <yourname>.oracle.apps.demxx.orderentry.webui
Set the Name to LinesCreateCO
2.13 Add LinesAdvTblRN Initialization to LinesDetailsCO processRequest()
To account for the Add Another Row button click we add the following logic to ourLinesDetailsCO controller's processRequest() method. This invokes the initTableQuery() methodcoded in the OrderEntryAMImpl.
import oracle.apps.fnd.framework.OAApplicationModule;import java.io.Serializable;import oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean;import oracle.apps.fnd.common.MessageToken;import oracle.apps.fnd.framework.OAException;import oracle.bali.share.util.BooleanUtils;. . .
public void processRequest(OAPageContext pageContext, OAWebBeanwebBean)
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-229
{
super.processRequest(pageContext, webBean);
// The special query handling for the table is required per thecoding
// standards.
OAApplicationModule am = pageContext.getApplicationModule(webBean);
Boolean executeQuery = BooleanUtils.getBoolean(false);Serializable[] parameters = { executeQuery };Class[] paramTypes = { Boolean.class };am.invokeMethod("initTableQuery", parameters, paramTypes);
OAAdvancedTableBean table =(OAAdvancedTableBean)webBean.findChildRecursive("LinesAdvTblRN");
if (table == null){
MessageToken[] tokens = { new MessageToken("OBJECT_NAME","LinesAdvTblRN")
};throw new OAException("DEMXX", "ORDLINES_OBJECT_NOT_FOUND", tokens);
}
// We pass "true" to the queryData() method because we don't want itto
// unconditionally execute the query if the VO has already been// queried.// In an updateable VO, unconditional query execution would cause the// loss of VO state (including user-entered data).
table.queryData(pageContext, true);
} // end processRequest()
2.14 Configure OrderLines Button Click
When the user presses the OrderLines button in the Orders page, you need to navigate to theLines Create page. Append the following code to your processFormRequest() in theOrderCreateCO
importoracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;importoracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;. . .
/************* Handling the OrderLines Button ***************/if (pageContext.getParameter("OrderLinesButton")!=null){
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-230 Oracle Applications Framework - Practices and Solutions
OAViewObject vo =(OAViewObject)am.findViewObject("OrderDetailsVO");
String payType =String)vo.getCurrentRow().getAttribute("PaymentType");
/************ Validation for Credit Card Type*******************/
if (payType.equalsIgnoreCase("CHARGE")){
OAMessageChoiceBean ccType =(OAMessageChoiceBean)webBean.findChildRecursive("CcType");
if (ccType !=null){
String cc = (String)ccType.getValue(pageContext);// valid CcType value and not nullif (cc==null){
throw new OAException("DEM966","ORDLINES_CCTYPE_INVALID");}
}}
/***************** Validation for Cheque Number******************/
else if (payType.equalsIgnoreCase("CHECK")){
OAMessageTextInputBean chkNum =(OAMessageTextInputBean)webBean.findChildRecursive("CheckNumber");
if (chkNum != null){
String chNum = (String)chkNum.getValue(pageContext);if (chNum == null){
throw new OAException("DEM966","ORDLINES_CHECK_NO_BAD");}
}}
/***************** Navigate to Lines Create Page***********************/
// Navigate to the Order Lines Page while retaining the AM.// Note the use of KEEP_MENU_CONTEXT as opposed to
GUESS_MENU_CONTEXT// since we know the current tab should remain highlighted.
pageContext.setForwardURL("OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/LinesCreatePG",
null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,true, // Retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_YES,OAWebBeanConstants.IGNORE_MESSAGES);
}
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-231
2.15 Save and Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
Select the Create Order button. In the Create Order Page fill in appropriate fieldsand click the Order Lines Button and check up if it navigates to our LinesCreatePG.
At this point your Lines Create page would look similar to this.
Fig 5 Lines Create page
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-232 Oracle Applications Framework - Practices and Solutions
3: Implement Browser Back Button Safe Page Initialization and
create/rollback Methods
3.1 Add a createOrderLineEntry( ) Method to Your OrderEntryAMImpl Class
Add the following method to your OrderEntryAMImpl class for creating a new order-line in theLinesDetailsVO view object (the call to vo.createRow() ultimately calls a create( ) method inyour LinesEOImpl entity object that you will be coding a bit later).
...
/********************************************************** Creates a new Order Line********************************************************/
public void createOrderLineEntry(){OAViewObject orderLineEntryVO = (OAViewObject)getLinesDetailsVO();if(orderLineEntryVO != null){OARow orderLineEntryRow =(OARow)orderLineEntryVO.createRow();if(orderLineEntryRow != null){orderLineEntryVO.executeQuery();orderLineEntryVO.insertRow(orderLineEntryRow);
orderLineEntryRow.setNewRowState(orderLineEntryRow.STATUS_INITIALIZED);orderLineEntryVO.setCurrentRow(orderLineEntryRow);
}}
}
3.2 Add a rollbackOrderLine( ) Method to Your OrderEntryAMImpl Class
Add the following method to your OrderEntryAMImpl class for rolling back the database and themiddle tier (you will see how you are going to use this a bit later).
Note that we call getTransaction() here to use an oracle.jbo.Transaction instead of callinggetOADBTransaction() to get an OAF subclassoracle.apps.fnd.framework.server.OADBTransaction because the superclass has the behavior weneed, and as a rule, you should always instantiate the class that includes the behavior you want touse. Avoid instantiating subclasses if the additional behavior is not required.
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-233
...
/************************************************************************ Executes a rollback including the database and the middle tier.**********************************************************************/public void rollbackOrderLine(){Transaction txn = getTransaction();// This small optimization ensures that we don't perform a rollback// if we don't have to.
if (txn.isDirty()){txn.rollback();
}} // end rollbackOrderLine()
3.3 Add Back Button Handling to the OrderCreateCO processRequest( )
To account for various Back button navigation patterns between the Lines Create and the CreateOrder, add the following logic to your OrderCreateCO controller's processRequest() method.This ensures that any unfinished order line objects are cleared from the middle tier cache whenthe user navigates back to the Orders Create page using the browser Back button, and then triesto create a new order line.
...
/*********** Back Navigation from Lines Page **************/OAApplicationModule am = pageContext.getApplicationModule(webBean);
// The following checks to see if the user navigated back to thispage
// without taking an action that cleared an "in transaction"// indicator.// If so, we want to rollback any changes that he abandoned to ensure// they aren't left lingering in the BC4J cache to cause problems
with// subsequent transactions. For example, if the user navigates to the// Create Lines page where you start a "create" transaction unit,// then navigates back to this page using the browser Back button and// selects the OrderLines button again, the OA Framework detects this// Back button navigation and steps through processRequest() so this// code is executed before you try to create another new order line.
if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"ordLineCreateTxn", false))
{am.invokeMethod("rollbackOrderLine");TransactionUnitHelper.endTransactionUnit(pageContext,
"ordLineCreateTxn");
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-234 Oracle Applications Framework - Practices and Solutions
}
3.4 Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml.
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-235
4: Implement Order Business Logic
Part 1: Declarative Validation and Initialization
The following table summarizes the order business rules to be implemented in this lab.
4.1 Lay down your Business Needs
EntityAttribute
Business Rules
OrderId Should be available from the Master Table DEM_ORDERS (that isshould be available from Orders Page)
OrderLineNum Required; cannot be nullProductId Required; cannot be nullDescription Required; cannot be nullOrderedQuantity Decides the Total Price
Must be a valid numeral entered (>0)UnitOfMeasure Value implicitly provided based on product chosenSuggestedPrice Value implicitly provided based on product chosenTotalPrice Total Price should be calculated based on Ordered QuantityAccount Should be modelled a key-flex fieldDescFlex A Descriptive Flexfield should be provided to capture additional data
4.2 Include Create Page Initialization
This page includes logic to ensure that the user does not encounter errors due to navigation usingthe browser Back button. Then, add the following code in bold to your pre-existing code(whichis not in bold) in your processRequest() method of LinesCreateCO to be called when the page isinitialized:
import oracle.apps.fnd.framework.webui.OADialogPage;import oracle.apps.fnd.framework.server.OADBTransaction;import oracle.apps.fnd.framework.webui.TransactionUnitHelper;...public void processRequest(OAPageContext pageContext, OAWebBean
webBean){// Always call this first.super.processRequest(pageContext, webBean);
OAApplicationModule am =(OAApplicationModule)pageContext.getApplicationModule(webBean);
Boolean executeQuery = BooleanUtils.getBoolean(false);
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-236 Oracle Applications Framework - Practices and Solutions
Serializable[] parameters = { executeQuery };Class[] paramTypes = { Boolean.class };am.invokeMethod("initTableQuery", parameters, paramTypes);
OAAdvancedTableBean table =(OAAdvancedTableBean)webBean.findChildRecursive("LinesAdvTblRN");
if (table == null){MessageToken[] tokens = { new MessageToken("OBJECT_NAME",
"LinesAdvTblRN")};throw new OAException("DEMXX", "ORDLINES_OBJECT_NOT_FOUND", tokens);
}
// We pass "true" to the queryData() method because we don't want it// to unconditionally execute the query if the VO has already been// queried.// In an updateable VO, unconditional query execution would cause the// loss of VO state (including user-entered data). See View Objects in// Detail -> Initialization guidelines for additional information.
table.queryData(pageContext, true);
// If isBackNavigationFired = false, we're here after a valid// navigation (the user selected the OrderLines button) and we should// proceed normally and initialize new order-lines.
if (!pageContext.isBackNavigationFired(false)){// We indicate that we are starting the create transaction (this// is used to ensure correct Back button behavior).
TransactionUnitHelper.startTransactionUnit(pageContext,"ordLineCreateTxn");
// This test ensures that we don't try to create a new order line if// we had a JVM fail over, or if a recycled application module// is activated after passivation. If these things happen, BC4J will// be able to find the row that you created so the user can resume// work.
if (!pageContext.isFormSubmission() &&!("update".equals(pageContext.getParameter(EVENT_PARAM))))
{am.invokeMethod("createOrderLineEntry", null);
}}else{
if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"ordLineCreateTxn", true))
{// We got here through some use of the browser "Back" button, so we// want to display a stale data error and disallow access to the
// page.// If this were a real application, we would probably display a
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-237
// more context-specific message telling the user he can't use the// browser "Back" button and the "Create" page. Instead, we want to// illustrate how to display the Applications standard NAVIGATION// ERROR message.
OADialogPage dialogPage = new OADialogPage(NAVIGATION_ERROR);pageContext.redirectToDialogPage(dialogPage);
}}
} // end processRequest
4.3 Add Validation Logic to the setOrderedQuantity( ) Method;
Add the following import statements to your LinesEOImpl class:import oracle.apps.fnd.framework.OAAttrValException;import oracle.apps.fnd.framework.OARowValException;import oracle.apps.fnd.framework.server.OADBTransaction;import oracle.apps.fnd.framework.OAException;import oracle.jbo.RowIterator;import oracle.jbo.server.EntityImpl;
Add a validateOrderedQuantity( ) Method
Add the following validation logic to the setOrderedQuantity() method in the LinesEO02Implclass. In this case, we are delegating to a validateOrderedQuantity() method because weultimately want to perform the order quantity validation again at the entity level, so we want tobe able to exercise that validation independent of the attribute setting.
/******************************************************************* Sets <code>value</code> as the attribute value for DateOrdered*****************************************************************/
public void setOrderedQuantity(Number value){validateOrderedQuantity(value);setAttributeInternal(ORDEREDQUANTITY, value);
} // setOrderedQuantity()
The validateOrderedQuantity() method is protected because the LinesEOImpl class is the onlyexpected caller, but we want to ensure that subclasses can also leverage this.
Tip: Since the entity object classes can be large, it is helpful to co-locate related code./**
****************************************************************************** Verifies that the order's Quantity Ordered is valid.*
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-238 Oracle Applications Framework - Practices and Solutions
* Business Rules:* Quantity Ordered should be greater than zero
*******************************************************************************/
protected void validateOrderedQuantity(Number value){if (value != null){if (value.intValue()< 0){throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,getEntityDef().getFullName(), // EO namegetPrimaryKey(), // EO PK"OrderedQuantity", // Attribute Namevalue, // Attribute value"DEMXX", // Message product short name"ORDLINES_QUANTITY_ORDERED"); // Message name}
}}
4.4 Save and Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Navigate to your LinesCreatePG as usual.
Verify the behavior of setOrderedQuantity().
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-239
5: Implement the Apply, Cancel and Delete Button Handling
When the user presses the Apply button, you need to commit and navigate to the Lines Searchpage where you will display a confirmation message. When the user presses the Cancel button,you need to rollback the transaction and navigate to the Lines Search page.
5.1 Add processFormRequest( ) Logic to Your LinesCreateCO Class
Add the following code to the LinesCreateCO class to handle Apply and Cancel buttonselection.
Note: Remember to enter proper values for <yourname> and demxx while copying the code toyour processFormRequest()at both ‘apply’ and ‘cancel’ button-handling.
import oracle.jbo.domain.Number;import oracle.apps.fnd.common.MessageToken;import oracle.apps.fnd.framework.OAException;import oracle.apps.fnd.framework.OAViewObject;import oracle.apps.fnd.framework.webui.OAWebBeanConstants;import oracle.apps.fnd.framework.webui.TransactionUnitHelper;import oracle.jbo.Row;
...
public void processFormRequest(OAPageContext pageContext, OAWebBeanwebBean){// Always call this first.super.processFormRequest(pageContext, webBean);
OAApplicationModule am =(OAApplicationModule)pageContext.getApplicationModule(webBean);
// Pressing the "Apply" button means the transaction should be// validated and committed.
if (pageContext.getParameter("Apply") != null){// Generally we have illustrated// all BC4J interaction on the server (except for the AMs, of
course).// Here, we are dealing with the VO directly so the comments about
the// reasons why we are obtaining values from the VO and not the
request// make sense in context.
OAViewObject vo = (OAViewObject)am.findViewObject("LinesDetailsVO");
Row row = vo.getCurrentRow();if (row != null)
{
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-240 Oracle Applications Framework - Practices and Solutions
// Note that we have to get this value from the VO because the EOwill
// assemble it during its validation cycle.
// For performance reasons, we do not want to do this// on the client so we are illustrating the interface-appropriate// call. If we implement this code in the AM where it belongs, we
would// use the other approach.// We need to get a String so we can pass it to the MessageToken// array below.// Note that we are getting this value from the VO row because
the item// style is messageStyledText, so the value is not put on the
request// like a messaqeTextInput value is.
Number orderNumber = (Number)row.getAttribute("OrderId");String orderNum = String.valueOf(orderNumber.intValue());
MessageToken[] tokens = { new MessageToken("ORD_NUMBER",orderNum)};
OAException confirmMessage = new OAException("DEM966","ORDLINES_LINES_CREATE_CONFIRM",tokens,OAException.CONFIRMATION, null);
// Per the UI guidelines, we want to add the confirmationmessage at
// the top of the search/results page and we want the old search// criteria and results to display.
pageContext.putDialogMessage(confirmMessage);
}am.invokeMethod("apply");
pageContext.forwardImmediately("OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/LinesSearchPG",
null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,true, // retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_NO);
}
else if (pageContext.getParameter("Cancel") != null){
am.invokeMethod("rollbackOrderLine");
// Indicate that the Create transaction is complete.
TransactionUnitHelper.endTransactionUnit(pageContext,"ordLineCreateTxn");
pageContext.forwardImmediately("OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/LinesSearchPG",
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-241
null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,true, // retain AM
OAWebBeanConstants.ADD_BREAD_CRUMB_NO);}
}//end processFormRequest()
5.2 Programmatically Set the Page Title Text
Per the BLAF UI Guidelines on Header Components, you need to display the current selectedcustomer’s name in the Order Lines page title. To do this, add the following code to yourcontroller's processRequest() method.
Note that this assumes a message (ORDLINES_LINESHDR_TEXT) has already been created inthe database with the following content: Order Lines &CUST_NAME, &ORD_NUM.
import oracle.apps.fnd.common.MessageToken;import oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean;import oracle.apps.fnd.framework.webui.beans.OAMessageStyledTextBean;...public void processRequest(OAPageContext pageContext, OAWebBeanwebBean){
// Already existing code
/*********** Setting the page title text ********************/String custName = pageContext.getParameter("CustomerName");
OAMessageStyledTextBean orderId =(OAMessageStyledTextBean)webBean.findChildRecursive("OrderId");
String ordNum = (String) orderId.getValue(pageContext);
// Always use a translated value from Message Dictionary when// setting strings in your controllers.
MessageToken[] Tokens = { new MessageToken("CUST_NAME", custName),new MessageToken("ORD_NUM", ordNum) };
// Now, get the translated message text including the token value.String pageHeaderText =
pageContext.getMessage("DEMXX","ORDLINES_LINESHDR_TITLE", Tokens);
// Set the order-specific page title. Note that we know this// controller is associated wit the pageLayout region, which is why// we cast the webBean to an OAPageLayoutBean before calling
setTitle.
((OAPageLayoutBean)webBean).setTitle(pageHeaderText);
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-242 Oracle Applications Framework - Practices and Solutions
} // end processRequest
5.3 Handle Line Number Uniqueness
As the Order Line Number and Order Number combination has to be unique, we need to ensurethat the various Order Line Numbers are unique for each Order under consideration. We canimplement this uniqueness check by adding the following code in the processFormRequest()method of the LinesCreateCO. Note that this portion of the code has to be added with the ApplyButton handling code, before we call the apply method wich commits to the database.
...
/********************* Eliminating Line Number Duplication*************/// Append code after you get the handle to the LinesDetailsVO that is,// after OAViewObject vo = (OAViewObject)// am.findViewObject("LinesDetailsVO");
int i=0;
for (i=0; i < vo.getFetchedRowCount();i++){
Row row = vo.getRowAtRangeIndex(i);Row[] rows =
vo.getFilteredRows("OrderLineNum",row.getAttribute("OrderLineNum"));if(rows.length > 1){
throw new OAException("DEM966","ORDLINES_LINE_ID_UNIQUE");}
}
Figure 6: Programatically Setting Page Title
5.4 Handle Delete Button
In order to delete Order-Lines, we need to add functionality to the Delete button. Add thefollowing code to the processFormRequest() method of the LinesCreateCO.
import oracle.jbo.Row;
Lab 9: Lines: Create………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-243
...
/*********************** Handling Delete Button*********************/
if (pageContext.getParameter("Delete") != null){
OAViewObject dbVo=(OAViewObject)am.findViewObject("LinesDetailsVO");
Row row = null;dbVO.reset();while ((row = dbVO.next()) != null){
String rowSelect = (String) row.getAttribute("SelectRow");if (rowSelect != null && rowSelect.equals("Y")){
dbVO.removeCurrentRow();}OAApplicationModule am =(OAApplicationModule)pageContext.getApplicationModule(webBean);
am.invokeMethod("apply");}
}
Now add the handleSelectionRemove() method which implements the delete
5.5 Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml
Select the Create Order button. In the OrderCreatePG fill in the details andnavigate to the LinesCreatePG.
Enter an order line, and select the Apply button. The confirmation message shoulddisplay in the LinesSearchPG as shown in Figure 8.
Also try navigating to the LinesCreatePG and selecting the Cancel button.
Test the functionality of Delete button by selecting a few rows and deleting.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-244 Oracle Applications Framework - Practices and Solutions
Figure 8: Lines Search Page with Create Confirmation Message
You are now finished with this exercise.
Lab 10: Lines: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-245
Lab 10: Lines: Partial Page Rendering (PPR)
Overview
In this exercise, we will modify the Create Lines page to implement a dynamic user interfaceusing partial page rendering (PPR) for the changes in Ordered Quantity.
When the user enters a value for the Quantity Ordered we need change the value of Total Pricecolumn as a product of Suggested Price (which is predetermined based on the product chosen)and the Ordered Quantity which is entered on run-time based on customer’s need.
Warning: This lab assumes that you have completed the Create Lines Lab, and builds on thatwork. If you have not completed this exercise, please do so before proceeding.
Figure 1: Create Page Finished Product initially renders as follows
Figure 2: A Closer look at the PPR Items and Quantity Ordered field before firing PPR
Figure 3: Note the difference in the PPR items after firing PPR event on Quantity Ordered field
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-246 Oracle Applications Framework - Practices and Solutions
1: Create OrderEntryPVO View Object Attributes
To enable PPR in this page, you must create an OA Framework standard applications propertiesview object (PVO) including a transient attribute for tracking the state of the Read Only propertyfor the PPR fields. This view object will ultimately include a single row which you will initializeand update as the user interacts with the page (you will see a bit later how the PPR field binds tothis view object attribute to determine whether it should be read only or not, and you willconfigure the OrderedQuantity field to fire PPR events when its value changes).
1.1 Create the Transient Attributes in OrderEntryPVO View Object
In the <yourname>.oracle.apps.demxx.orderentry.server package, select yourOrderEntryPVO view object, right-click and select Edit OrderEntryPVO…. In theAttributes page, select the New... button and create a transient attribute with thefollowing properties:
o Name: totalPrice
o Type: Boolean
o Updateable: Always
In the Attributes page, select the New... button and create a transient attribute withthe following properties:
o Name: suggestedPrice
o Type: Boolean
o Updateable: Always
In the Attributes page, select the New... button and create a transient attribute withthe following properties:
o Name: uom
o Type: Boolean
o Updateable: Always
You need not generate any Java files for this PVO.
2: Configure OrderedQuantity to Fire a PPR Event
Configure the OrdereQuantity item to fire a PPR action. They are configured in the followingway:
2.1 Set the PPR Properties for Quantity Ordered field
Lab 10: Lines: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-247
Set the following properties for the OrdereQuantity item in your Create page:
Property ValueDisable Server Side Validation TrueDisable Client Side Validation TrueAction Type FirePartialActionEvent priceEventSubmit True
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-248 Oracle Applications Framework - Practices and Solutions
3: Configure Items to React to PPR Events
Set the value of the Disabled property to the following SPEL ("Simplest Possible ExpressionLanguage") syntax indicating that the property value should be obtained from theOrderEntryPVO instance's transient attributes.
Note that you must use the Enter key to get the new value to "stick" in the property. If you usethe mouse to click directly out of the property after typing the SPEL value, the property resets toTrue. At runtime, this item will render according to the value of the transient attributes in theOrderEntryPVO application view object.
For TotalPrice Item
Property ValueDisabled ${oa.OrderEntryPVO.totalPrice}
For SuggestedPrice Item
Property ValueDisabled ${oa.OrderEntryPVO.suggestedPrice}
For UnitOfMeasure Item
Property ValueDisabled ${oa.OrderEntryPVO.uom}
Lab 10: Lines: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-249
4: Implement PPR Event Handling
4.1 Add PPR Logic to the Handle the PPR Action in OrderEntryAM
Now, we need to add the code to handle the PPR change events and initialize theOrderEntryPVO. Your controller code will invoke the following method whenever a field's PPRevent is fired.
Add the following code to your OrderEntryAMImpl class.
Note: In this case, a transient property set to Boolean.FALSE indicates that the SPEL associatedfield is enabled and vice versa.
import oracle.jbo.Row;…..
public void changeTotalPrice(String selectedRowRef){
OAViewObject dbVO = (OAViewObject)findViewObject("LinesDetailsVO");OARow dbRow = (OARow)dbVO.getCurrentRow(); // handle to CurrentRow
enableTotalPrice();
Row row = (Row)findRowByRef(selectedRowRef);if(row != null){
Number num1 = (Number)row.getAttribute("OrderedQuantity");Number num2 = (Number) row.getAttribute("SuggestedPrice");
/******************* Multiply the 2 nos. ******************/if ((num1 != null) && (num2 != null)){
Number num3 = num2.multiply(num1);if(dbRow!=null){row.setAttribute("TotalPrice", num3);
}}disableTotalPrice();
}}
/******************************************************************** PPR for TotalPrice, Suggested Price and Unit of Measure Enable******************************************************************/
public void enableTotalPrice(){
OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-250 Oracle Applications Framework - Practices and Solutions
if (vo != null){if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}OARow row = (OARow)vo.first();if(row!=null){row.setAttribute("totalPrice", Boolean.FALSE);row.setAttribute("suggestedPrice", Boolean.FALSE);row.setAttribute("uom", Boolean.FALSE);}
}}
/********************************************************************** PPR for TotalPrice, Suggested Price and Unit of Measure Disable********************************************************************/
public void disableTotalPrice(){OAViewObject vo = (OAViewObject)findViewObject("OrderEntryPVO");if (vo != null){
if (vo.getFetchedRowCount() == 0){vo.executeQuery();
}OARow row = (OARow)vo.first();if(row!=null){row.setAttribute("totalPrice", Boolean.TRUE);row.setAttribute("suggestedPrice", Boolean.TRUE);row.setAttribute("uom", Boolean.TRUE);
}}
}
4.2 Modify init( ) Method in the OrderEntryAM
Add the following code in bold to your init() in the OrderEntryAMImpl ensures that yourOrderEntryPVO which includes a single row and initializes the application properties VO-defines the default values of totalPrice transient attribute when the page renders.
/*********************************************************************** Initializes the transient application properties VO.*********************************************************************/
public void init()
Lab 10: Lines: Partial Page Rendering (PPR)………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-251
{
OAViewObject appPropsVO =(OAViewObject)findViewObject("OrderEntryPVO");
if (appPropsVO != null){// Do not reinitialize the VO unless needed. Note that this method// call does not try to query the database for VOs with no SELECT// statement and only transient attributes.
if (appPropsVO.getFetchedRowCount() == 0){// Setting the max fetch size to 0 for an in-memory VO// prevents it from trying to query rows. Calling// executeQuery() ensures that rows are not lost after// a commit in the transaction (BC4J known issue workaround).
appPropsVO.setMaxFetchSize(0);appPropsVO.executeQuery();
// You must create and insert a row in the VO before you can start// setting properties.appPropsVO.insertRow(appPropsVO.createRow());
// Initialize the application properties VO (and the UI) based on// the default order payment value set on the underlying object.
OARow row = (OARow)appPropsVO.first();row.setAttribute("checkNumber", Boolean.TRUE);row.setAttribute("creditCardType", Boolean.TRUE);row.setAttribute("creditCardNumber", Boolean.TRUE);row.setAttribute("creditCardExpirationDate", Boolean.TRUE);row.setAttribute("approvalCode", Boolean.TRUE);
// For Order Linesrow.setAttribute("totalPrice", Boolean.FALSE);row.setAttribute("suggestedPrice", Boolean.FALSE);row.setAttribute("uom", Boolean.FALSE);
}}
} // end init()
4.3 Call the init( ) Method from processRequest( )
Add the following code to your LinesCreateCO processRequest() method after the call toam.invokeMethod("createOrderLineEntry"). This ensures that your application properties VO isproperly initialized when the page renders.
// Add the following code after am.invokeMethod("createOrderLineEntry")// Initialize the application properties VO for PPR.am.invokeMethod("init");
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-252 Oracle Applications Framework - Practices and Solutions
4.4 Handle PPR Event
Add the following code to your existing LinesCreateCO processFormRequest()to route a call toyour PPR handler coded in the AM if their PPR event has been fired.
/*********** PPR Event Handling for Total Price************/
String event = pageContext.getParameter(EVENT_PARAM);
if(event.equalsIgnoreCase("priceEvent")){String eventSrcParam =
pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);Serializable[] rowParam = {eventSrcParam};am.invokeMethod("changeTotalPrice",rowParam);}
4.5 Test Your Work
Select OrderEntry.jpr, right-click and select Rebuild OrderEntry.jpr.
Select the OrderSearchPG, right-click and select Run OrderSearchPG.xml
Select the Create Order button. Navigate to LinesCreatePG as usual and check thePPR’s behavior by entering different values for Ordered Quantity field.
You are now finished with this exercise.
Lab 11: Lines: Layout………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-253
Lab 11: Lines: Layout
Overview
In this exercise, you will be implementing sub-tabs for the Order Lines Page.
Warning: This lab assumes that you have completed the Create Lines Exercise and builds onthis work. If you have not completed this exercise, please do so before proceeding.
1: Modify your Lines Create Page Layout
1.1 Create the Sub-Tab Layout Region
Select LinesCreatePG in the System Navigator pane.
Select PageLayoutRN in the Structure pane, right-click and select New > Regionfrom context menu.
Set the ID for the new region to SubTabLayoutRN
Select Region Style to subTabLayout.
Select SubTabLayoutRN in the Structure pane, right-click and select New >Region
Set the ID for the new region to TabOneRN
Select SubTabLayoutRN in the Structure pane, right-click and select New >Region
Set the ID for the new region to TabTwoRN.
Select the AdvTblHdrRN hideShowHeader region and drag-and-drop it toTabOneRN as child.
Select the AdvTblHdrRN in the Structure pane, right-click and select Copy.
Select the TabTwoRN in the Structure pane, right-click and select Paste.
Select the AdvTblHdrRN in TabOneRN, expand the LinesAdvTblRN
Select the KeyFlexCol column, right click and select Delete.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-254 Oracle Applications Framework - Practices and Solutions
Select the AdvTblHdrRN1 in TabTwoRN, expand the LinesAdvTblRN1
Select the OrdQuantCol1 column, right click and select Delete.
Select the UomCol1 column in the System, right click and select Delete.
Select the SuggPriceCol1 column, right click and select Delete.
Select the TotPriceCol1 column, right click and select Delete.
Select LinesAdvTblRN1 in TabTwoRN, right-click and select New > formValue
Set the following properties for this formValue item
Property ValueID SuggPriceFVDataType NUMBERView Attribute SuggestedPricePrompt Suggested Price
We repeat the same to create another formValue item.
Select LinesAdvTblRN1 in TabTwoRN, right-click and select New > formValue
Set the following properties for this formValue item
Property ValueID UomFVView Attribute UnitOfMeasurePrompt UOM
Select the AdvTblHdrRN1 in TabTwoRN, expand the LinesAdvTblRN1
Expand the ProdCol1 column and select the ProductId1.
Select the ProdIdMap2 in the lovMappings.
Set the Return Item property to ProductId1
Lab 11: Lines: Layout………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-255
Set the Criteria Item property to ProductId1
Select the DescMap2 in the lovMappings.
Set the Return Item property to Description1
Select the UomMap2 in the lovMappings.
Set the Return Item property to UomFV
Select the SuggPriceMap1 in the lovMappings.
Set the Return Item property to SuggPriceFV
Expand the DescCol1 column and select the Description1.
Select the DescMap11 in the lovMappings.
Set the Return Item property to Description1
Set the Criteria Item property to Description1
Select the ProdIdMap11 in the lovMappings.
Set the Return Item property to ProductId1
Select the UomMap11 in the lovMappings.
Set the Return Item property to UomFV
Select the SuggPriceMap11 in the lovMappings.
Set the Return Item property to SuggPriceFV
Select the KeyFlexCol1 column in the LinesAdvTblRN1, right click and selectNew > tableLayout
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-256 Oracle Applications Framework - Practices and Solutions
Set the ID for the new region to TableLayoutRN
Select TableLayoutRN in the Structure pane, right-click and select New >rowLayout
Set the ID for the new region to RowFlexRN.
Select RowFlexRN in the Structure pane, right-click and select New > cellFormat
Set the ID for the new region to FlexCell
Drag and drop the Account1 item into FlexCell as child.
Set the Column Span property of FlexCell to 4.
Select the SubTabRN, right click and select New > subTabs
Select the subTabBar1 which appears, right click and select New > link
Set the following properties for item1.
Property ValueID QuantityLinkItem Style linkText Quantity
Select the subTabBar1 which appears, right click and select New > link
Set the following properties for item1.
Property ValueID AccountsLinkItem Style linkText Account
1.2 Modify the LinesCreateCO Controller
Now you need to change the logic in the LinesCreateCO controller to properly initialize both theadvanced tables in both subtabs. Append the following logic to your processRequest()below yourcall to the initTableQuery() method in the AM.
...
Lab 11: Lines: Layout………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-257
OAAdvancedTableBean tableOne =(OAAdvancedTableBean)webBean.findChildRecursive("LinesAdvTblRN1");
if (tableOne == null){MessageToken[] tokens = { new MessageToken("OBJECT_NAME",
"LinesAdvTblRN1")};throw new OAException("DEMXX", "ORDLINES_OBJECT_NOT_FOUND", tokens);
}tableOne.queryData(pageContext, true);
...
1.3 Delete Button Handling
Now you need to slightly alter the logic in the LinesCreateCO controller to handle the Deletebuttons in both the advanced tables (in two subtabs). Make this change in theprocessFormRequest() of your LinesCreateCO. Note that the change that needs to be done isgiven in bold.
.../***************** Handle Delete Button ***********************/if ((pageContext.getParameter("Delete") != null)|| (pageContext.getParameter("Delete1") != null))
1.4 Rebuild and Test Your Work
Rebuild your project and run the OrderSearchPG.
Navigate to your Lines Create Page.
At this point, your Lines Create Page should contain two subtabs as illustrated in thefigure below.
Make an entry and try to save it to the database and verify if it is saved.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-258 Oracle Applications Framework - Practices and Solutions
Fig 1 : Revised Lines Create Page showing Quantity subtab
Fig 2 : Revised Lines Create Page showing Accounts subtab
You are now finished with this exercise.
Lab 12: Lines: Update………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-259
Lab 12: Lines: Update
Overview
In this exercise, you will be implementing an order lines update transaction.
Warning: This lab assumes that you have completed the Create Lines Exercise and builds onthis work. If you have not completed this exercise, please do so before proceeding.
1: Make a Copy of Your LinesCreatePG
For the most part, a single page update and insert page are identical. Since you already created aninsert page, the quickest way to implement a new corresponding update page with the same itemsand underlying view object is to simply copy the page definition and then make any necessarymodifications.
1.1 Copy LinesCreatePG on the File System
Since the JDeveloper OA Extension does not yet support the ability to "save as" or copy/paste apage document, you need to use the file system for the following task.
Save all your work and close JDeveloper.
Select your LinesCreatePG.xml document in Windows Explorer, right-click andselect Copy.
Select the webui directory node, right-click and select Paste. Your new file will benamed Copy of LinesCreatePG.
Select the new file in Explorer, right-click and select Rename to LinesUpdatePG.
Start JDeveloper, expand the OA Components category in your project, and selectthe Add File toolbar icon to open the Add Files or Directories to <your projectname> dialog. Locate your LinesUpdatePG and select OK to add this file to yourproject.
1.2 Copy and Change the Create Page Controller
We need to change the controller associated with your new update page.
Open your LinesCreateCO controller in JDeveloper and select File > Save As fromthe main menu. Name your new file LinesUpdateCO.
Change the class name in your new LinesCreateCO file to LinesUpdateCO.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-260 Oracle Applications Framework - Practices and Solutions
Select the LinesUpdatePG page's PageLayoutRN region in the JDeveloperstructure pane to open the property inspector.
Change its Controller Class property value from<yourname>.oracle.apps.demxx.orderentry.webui.LinesCreateCOto <yourname>.oracle.apps.demxx.orderentry.webui.LinesUpdateCO.
Change its Title property value to Update Order Lines.
1.3 Compile and Save Your Work
Rebuild your project and save your work.
Lab 12: Lines: Update………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-261
2: Modify Search and Update Page Controllers
2.1 Modify the OrderUpdateCO Controller
First, add processRequest() logic to handle Back button navigation. Add the else if logic shownin bold to the if statement that you already added in the Create lab.
if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"ordLineCreateTxn", false))
{am.invokeMethod("rollbackOrderLines");TransactionUnitHelper.endTransactionUnit(pageContext,
"ordLineCreateTxn");}
else if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"ordLineUpdateTxn", false))
{am.invokeMethod("rollbackOrderLines");TransactionUnitHelper.endTransactionUnit(pageContext,
"ordLineUpdateTxn");}
2.2 Modify the LinesUpdateCO Controller
Now you need to change the logic in the LinesUpdateCO controller to properly support theupdate action and page flow. Create logic needs to be removed.
Delete the logic in your processRequest() method and add the following instead:
import oracle.apps.fnd.framework.webui.TransactionUnitHelper;import java.io.serializable;import oracle.apps.fnd.common.MessageToken;import oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean;import oracle.apps.fnd.framework.webui.beans.OAMessageStyledTextBean;...
public void processRequest(OAPageContext pageContext, OAWebBeanwebBean){// Always call this first.super.processRequest(pageContext, webBean);
OAApplicationModule am =(OAApplicationModule)pageContext.getApplicationModule(webBean);
Boolean executeQuery = BooleanUtils.getBoolean(false);Serializable[] parameters = { executeQuery };Class[] paramTypes = { Boolean.class };am.invokeMethod("initTableQuery", parameters, paramTypes);
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-262 Oracle Applications Framework - Practices and Solutions
OAAdvancedTableBean table =(OAAdvancedTableBean)webBean.findChildRecursive("LinesAdvTblRN");
if (table == null){MessageToken[] tokens = { new MessageToken("OBJECT_NAME",
"LinesAdvTblRN")};throw new OAException("DEMXX", "ORDLINES_OBJECT_NOT_FOUND", tokens);
}
// We pass "true" to the queryData() method because we don't want it// to unconditionally execute the query if the VO has already been// queried. In an updateable VO, unconditional query execution would// cause the loss of VO state (including user-entered data).
table.queryData(pageContext, true);
TransactionUnitHelper.startTransactionUnit(pageContext,"ordLineUpdateTxn");
/************ Setting the dynamic page title text ******************/String custName = pageContext.getParameter("CustomerName");
OAMessageStyledTextBean orderId =(OAMessageStyledTextBean)webBean.findChildRecursive("OrderId");String ordNum = (String) orderId.getValue(pageContext);
// Always use a translated value from Message Dictionary when// setting strings in your controllers.// Instantiate an array of message tokens and set the value for the// CUST_NAME token and ORD_NUM token.
MessageToken[] Tokens = { new MessageToken("CUST_NAME", custName), newMessageToken("ORD_NUM", ordNum) };
// Now, get the translated message text including the token value.String pageHeaderText =
pageContext.getMessage("DEMXX","ORDLINES_LINESHDR_TITLE", Tokens);
// Set the order-specific page title (which also appears in// the breadcrumbs). Note that we know this controller is// associated wit the pageLayout region, which is why we cast the// webBean to an OAPageLayoutBean before calling setTitle.
((OAPageLayoutBean)webBean).setTitle(pageHeaderText);
am.invokeMethod("init");
} // end processRequest
Change the name of the "in transaction indicator" in the processFormRequest() method fromordLineCreateTxn to ordLineUpdateTxn, and change the confirmation message name fromORDLINES_LINES_CREATE_CONFIRMto ORDLINES_LINES_UPDATE_CONFIRM.
Lab 12: Lines: Update………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-263
2.3 Configure OrderLines Button Click
When the user presses the OrderLines button in the Orders Update page, you need to navigate tothe Lines Update page. Append the following code to your processFormRequest() in theOrderUpdateCO
importoracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;importoracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;. . .
/*********** Handling the OrderLines Button in UpdatePG *******/
// Navigate from Order Update to Order Lines Update Page// while retaining the AM.
if (pageContext.getParameter("OrderLinesButton")!=null){
OAViewObject vo =(OAViewObject)am.findViewObject("OrderDetailsVO");
String payType =String)vo.getCurrentRow().getAttribute("PaymentType");
/************ Validation for Credit Card Type*******************/
if (payType.equalsIgnoreCase("CHARGE")){
OAMessageChoiceBean ccType =(OAMessageChoiceBean)webBean.findChildRecursive("CcType");
if (ccType !=null){
String cc = (String)ccType.getValue(pageContext);// valid CcType value and not nullif (cc==null){
throw new OAException("DEM966","ORDLINES_CCTYPE_INVALID");}
}}
/***************** Validation for Cheque Number******************/
else if (payType.equalsIgnoreCase("CHECK")){
OAMessageTextInputBean chkNum =(OAMessageTextInputBean)webBean.findChildRecursive("CheckNumber");
if (chkNum != null){
String chNum = (String)chkNum.getValue(pageContext);if (chNum == null){
throw new OAException("DEM966","ORDLINES_CHECK_NO_BAD");}
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-264 Oracle Applications Framework - Practices and Solutions
}}
/***************** Navigate to Lines Create Page***********************/pageContext.setForwardURL("OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/LinesUpdatePG",
null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,true, // Retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_YES,OAWebBeanConstants.IGNORE_MESSAGES);
}
2.4 Rebuild and Test Your Work
Rebuild your project and run the LinesSearchPG
At this point, your Update column should appear in your results table. Select it toopen and test your new update page.
You are now finished with this exercise.
Lab 13: Flexfields………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-265
Lab 13: Flexfields
Overview
In this exercise, you will be implementing Descriptive Flexfields(DFFs) in your Orders andLines pages.
Warning: This lab assumes that you have completed the Create Orders and Create LinesExercises and builds on this work. If you have not completed this exercise, please do so beforeproceeding.
Fig: Orders DFF Field Customer Contact Name included
Fig: Lines DFF Field Additional Preference included
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-266 Oracle Applications Framework - Practices and Solutions
1: Implement your Orders DFF
Before we implement the Flexfield, we need to ensure that the flexfields have already beenregistered in Oracle Apps.
Logon to Oracle Apps and choose Application Developer responsibility.
Select Flexfield : Descriptive > Register
Query for DEM_ORDERS in the name and make sure it exists.
If it does not exist, register your own DEM_ORDERS descriptive flexfield (DFF)with your custom application DEMxx. (You may refer Appendix A for further help)
Similarly ensure DEM_ORDER_LINES is present. If not present, you may have toregister it to your custom application DEMxx before you proceed.
1.1 Setup your Orders Flexfield in Orders Create and Update Pages
Select your OrderCreatePG in the System Navigator pane.
Select FooterRN in the Structure Pane, right-click and select New >messageLayout
Set the ID for messageLayout1 to DescFlexLayout
Select DescFlexLayout in the Structure Pane, right-click and select New > Item
Set the following properties for the new item.
Property ValueID DescFlexItem Style FlexView Instance OrderDetailsVOPrompt Descriptive FlexfieldCSS Class OraFieldTextAppl Short Name DEM (or whichever application DFF is registered to)Name DEM_ORDERSType DescriptiveDisplay Context Field False
Now, drag and drop the DescFlexLayout between OrderNoteLayout andButtonLayout.
Select your DescFlexLayout document in Structure pane, right-click and selectCopy.
Lab 13: Flexfields………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-267
Choose the OrderUpdatePG in System Navigator, select the FooterRN in theStructure pane; right-click and select Paste.
Drag-drop the DescFlexLayout to position it between OrderNoteLayout andButtonLayout.
1.2 Compile and Test Your Work
Rebuild your project and save your work.
Navigate to your Orders Create page and verify that the DFF renders.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-268 Oracle Applications Framework - Practices and Solutions
2: Implement your Lines DFF
In a similar way, we can implement the DFF for Order Lines in the Create and Update pages.
2.1 Setup your Order Lines Flexfield in Lines Create and Update Pages
Select your LinesCreatePG in the System Navigator pane.
Select DescFlex (under DescFlexCol in TabOneRN) in Structure Pane.
Set the following properties for this item.
Property ValueID DescFlexItem Style FlexPrompt Descriptive FlexfieldCSS Class OraFieldTextAppl Short Name DEM (or whichever application DFF is registered to)Name DEM_ORDER_LINESType DescriptiveDisplay Context Field False
Now, select DescFlex in Structure pane, right-click and select Copy.
Select the DescFlexCol1 (present in the TabTwoRN) in Structure pane.
Delete the item (DescFlex1) present in this column.
Select DescFlexCol1, right-click and select Paste
Choose the LinesUpdatePG in System Navigator, select the DescFlexCol in theStructure pane;
Delete the item (DescFlex) present in this column.
Select DescFlexCol, right-click and select Paste.
Similarly, select the DescFlexCol1 (present in the TabTwoRN) in LinesUpdatePG.
Delete the item (DescFlex1) present in this column.
Select DescFlexCol1, right-click and select Paste.
Lab 13: Flexfields………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-269
2.2 Compile and Test Your Work
Rebuild your project and save your work.
Navigate to your Lines Create page and verify that the DFF renders.
You are now finished with this exercise.
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-270 Oracle Applications Framework - Practices and Solutions
Lab 14: Deploying the project in Oracle Applications
Zip your class files present under <yourname> folder in<JDEV_USER_HOME>/myclasses.
Transfer the <yourname>.zip file in binary mode to the UNIX server to any temporarylocation. Eg: /d01/cust_top
Now add the classpath entry in jserv.properties as follows
o cd $IAS_ORACLE_HOME/Apache/Jserv/etc
o Open the file jserv.properties
o Navigate to wrapper.classpath and add the absolute path of the zip file in thetemporary folder.
Eg: wrapper.classpath=/d01/cust_top/<yourname>.zip
Do not alter anything else. Save and exit.
Bounce the Apache.
o cd $OAD_TOP/admin/scripts/*/
o adapcctl.sh stop
o adapcctl.sh start
In Oracle Apps, create your Function to call the OA Page.
o Type : SSWA JSP
o HTML Call:OA.jsp?page=/<yourname>/oracle/apps/demxx/orderentry/webui/OrderSearchPG
Add the function to a menu.
Add this Menu to a responsibility (which has Self Service Web Applications Radio-buttonenabled)
Add the responsibility to your user.
Lab 14: Deploying the project in Oracle Applications………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-271
Import all your pages and regions (*PG.xml, *RN.xml) to the Metadata repository, whichyou want to deploy. For eg: OrderSearchPG
o Run the following statement from command prompt at <JDEV_USER_HOME>\bin
o import<JDEV_USER_HOME>\myprojects\<yourname>\oracle\apps\<demxx>\orderentry\webui\LinesCreatePG.xml -rootdir <JDEV_USER_HOME>\myprojects -username<apps_user> -password <passwd> -dbconnection "(description = (address_list =(address = (community = tcp.world)(protocol = tcp)(host = <hostname>)(port =<port number>)))(connect_data = (sid = <sid>)))"
o example:importD:\Jdev11510RUP4\jdev\myprojects\apvv\oracle\apps\dem04\orderentry\webui\LinesCreatePG.xml -rootdir D:\Jdev11510RUP4\jdev\myprojects -username apps -password apps -dbconnection "(description = (address_list = (address = (community= tcp.world)(protocol = tcp)(host = 152.69.170.147)(port = 1550)))(connect_data =(sid = CRM9729)))"
o Similarly, import the other pages like Order Details/Create/Update and LinesSearch/Lines/Create/Update and regions for the LOVs.
Now you can launch the OA Page from Oracle Applications, and test the Order Entryfunctionality
o Login to Oracle Applications
o Switch to your responsibility and launch the Search Page from the respective menuentry.
Note:
If Oracle Applications version R11i is used for deployment we may get an error while trying tosave order lines to the database due to the following reason:
In the Lines EO, for the ROWID database column the SQLType attribute is set to RowID. ButSQLType=ROWID is acceptable for BC4J version 10.1.3 only (R12). This change is notbackwards compatible with BC4J 9.0.3 used in 11i codeline.
As a workaround, the following can be done on similar lines to the solution in Metalink note397512.1:
EO Level Changes
Right Click on your LinesEO and select Edit LinesEO
Appendix C: Practices and Solutions………………………………………………………………………………………………………
………………………………………………………………………………………………………C-272 Oracle Applications Framework - Practices and Solutions
Expand the Attributes section and select RowID
Change the attribute Type from RowID to String.
Change the Type in the Database column section from RowID to VARCHAR2(20)
Click on Apply and OK
o Make sure this change is reflected in the LinesEO.xml by verifying that theSQLType of Rowid Column has changed to VARCHAR.(If not, edit thisxml file manually to make this change)
VO Level Changes
Make the following changes to the LinesDetailsVORowImpl andLinesSearchVORowImpl class:
Change the return type and typecast in method getRowID() from RowID to String:public String getRowID(){
return (String)getAttributeInternal(ROWID);}
Lab 15: Testing and Reviewing Your Pages………………………………………………………………………………………………………
.
………………………………………………………………………………………………………Oracle Applications Framework - Practices and Solutions C-273
Lab 15: Testing and Reviewing Your Pages
1. Test your form for about fifteen minutes to make sure that your form is built to specificationsand that your form features all work correctly. Test for (at least):
Querying master and details works correctly.
Inserts work correctly
Updates work correctly (update only your own inserted records)
Deletes of master and/or details work correctly (update only your own inserted
records)
LOVs all work and appear correctly
Order ID populates on insert
Tabbed regions work correctly
Opening and closing of windows works correctly
Flexfields work correctly
Messages, validation logic on date fields work correctly
Find window on Orders works correctly
Function security works correctly
2. Do a fifteen-minute user interface review of the form belonging to the team with the nextlower team number (Team 01 review the highest-numbered team). Use your manuals andyour class notes to help you. List some things the team can do to improve the user interface(especially cosmetics) of their form. Discuss your findings with that team when you finish.
a ________________________________________________
b ________________________________________________
c ________________________________________________
d ________________________________________________