beginners guide
DESCRIPTION
OAFTRANSCRIPT
OA Framework Beginner's Guide
OA Framework Beginners Guide
Version : Beta 1.0.2 Sudhakar Mani and Aarthi Sudhakar
ii
OA Framework Beginner's Guide
Copyright © 2009 by The Chola Press Companies, All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher.
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.
Chola Press eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at [email protected].
Information has been obtained by Publisher from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, Publisher, or others, Publisher does not guarantee to the accuracy, adequacy, or completeness of any information included in this work and is not responsible for any errors or omissions or the results obtained from the use of such information.
This books is not related to Oracle Corporation.
TERMS OF USE
This is a copyrighted work and The Chola Press, (“Chola-Press”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without Chola Press's prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED “AS IS.” Chola Press AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Chola Press and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither Chola Press nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. Chola Press has no responsibility for the content of any information accessed through the work. Under no circumstances shall Chola Press and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.
iii
OA Framework Beginner's Guide
Table of ContentsChapter I - Java Basics................................................................................................. 4
Why should I know Java for learning OA Framework?.....................................5Encapsulation...................................................................................................... 5Object Oriented Programming............................................................................ 5OOPS Concepts...................................................................................................6Encapsulation...................................................................................................... 6Abstraction.......................................................................................................... 6Inheritance...........................................................................................................6Polymorphism..................................................................................................... 6What is a class?................................................................................................... 7What is an object?............................................................................................... 7What is a method?...............................................................................................7What is an Interface?...........................................................................................7What is a Java Bean?.......................................................................................... 7What is a constructor?.........................................................................................8What is an array?.................................................................................................8Primitive Data Types in Java...............................................................................8Different Types of Variables............................................................................... 9Type Casting..................................................................................................... 10Exception Handling in Java.............................................................................. 10
Chapter II – Basics Of OA Framework...................................................................... 14What is OA Framework?...................................................................................15
iv
OA Framework Beginner's Guide
Parts of OA Framework.................................................................................... 16Encapsulation.................................................................................................... 17Model View Controller (MVC) Architecture....................................................18Model:............................................................................................................... 18
Application Module:................................................................................20Entity Object:...........................................................................................20View Object:............................................................................................ 20Association Object :.................................................................................20View Link:............................................................................................... 20
View:................................................................................................................. 21Types of Regions in a Page......................................................................22Types of Items in a Page..........................................................................35
Controller:......................................................................................................... 41processRequest:....................................................................................... 41processFormData:....................................................................................41processFormRequest:...............................................................................41
OA Framework Architecture.............................................................................43Chapter III – Jdeveloper Environment Setup............................................................. 46
Setting up the Jdeveloper Environment............................................................ 47Hello World Page Lab....................................................................................... 57
Chapter IV – Search Page ..........................................................................................73Auto Customization Criteria Search................................................................. 74Adding Attachments to the Results Table ......................................................111
Chapter V – Advanced Table ................................................................................... 117Convert Results Table into Advanced Table...................................................118Create Functionality .......................................................................................122Adding Poplist and LOV to the Advanced Table............................................129Add Single Select Delete functionality...........................................................137Convert Single Select Delete to Multi Select Delete .....................................142
Chapter VI – Dependent LOV and Poplist...............................................................147Dependent Poplist........................................................................................... 148Dependent LOV.............................................................................................. 154Google Style Auto Suggest LOV.................................................................... 161
Chapter VII – Master Detail Page............................................................................ 171Form Style Master Detail Page....................................................................... 172Search Department and Drill Down to Details Page ......................................185
Chapter VIII – Deployment......................................................................................198
v
OA Framework Beginner's Guide
Deployment.....................................................................................................199Home Page with Tabs......................................................................................201
Chapter IX - Extension............................................................................................. 211Extension.........................................................................................................213
VO Extension:....................................................................................... 213CO Extension.........................................................................................233EO Extension.........................................................................................237
Deploying the VO Substitution.......................................................................242Personalization................................................................................................ 248
Debugging OA Framework Page..............................................................................257Appendix A – Database Scripts.......................................................................259Appendix B..................................................................................................... 261
Creating Attribute Sets:......................................................................... 261Creating Look Ups:............................................................................... 265
Interview Questions..................................................................................................271Glossary.......................................................................................................... 288
vi
Acknowledgments
hen acknowledging all the people involved in getting a book from concept to print, the list can be pretty big. But there are always a few who stand out in the task, both directly and indirectly. The major push came
from the people who bought our ebooks which focused on niche topics. Without them we wouldn't have ventured into writing this full fledged book.
WWriting is not our special skill but writing a technical book was much easier compared to any other book. A special thanks to be rendered for our friends and colleagues who had supported this book with their special review and inputs.
We are interested more in communicating the knowledge we acquired over the years rather than providing a novel book. Thanks for everyone who stood by this book and made it possible at the end.
Page 1
Introductionrom being a business super user to an implementer, I am a firm believer in utilizing enterprise business systems to achieve the wealth of information required and standardization to run businesses effectively today. The
technology we used for creating user interface for Oracle EBS is very ancient and today's modern world application support web interface for better user experience. Whenever we tried to access the Oracle EBS through internet,most often than not you will have some issues with jinitiator in case of 11i and ojvm incase of Oracle R12.OA Framework offers a convenient way to develop some stunning web application with lesser effort. In our earlier cycle of learning OA Framework,it was ns not smooth and we had done the tutorials came with oracle again and again blindly without understanding what we are performing. Since none of us had the java background,it was really an uphill task. It took 6 long years to reach the current level of knowledge on OA Framework. Having trained more than 300 people on OA Framework now,we had learned a lot from the perspective of the learners. When we introduced the OA Framework online training for the first time,none of the learners were comfortable till we cracked the remote desktop approach for the learning methodology.
F
This book, while designed to be read from cover to cover, is also self-inclusive for each section, allowing the reader to go directly to a particular section and not be referenced back to other areas for more information. For Oracle or industry-specific terms, a glossary at the back is included for rapid access. Besides being a step-by-step and field-by-field how-to guide, this book includes many business considerations to think about during an development cycle and beyond.
Note : This book is not a replacement for Oracle's Developer Guide.Oracle OAF developer guide is very extensive and should be used as a primary reference and this book can be used by the beginners to understand the concepts and get accustomed to OAF development and extension.
Page 2
CHAPTER
1Java Basics
Page 3
Chapter I - Java Basics
Chapter I - Java Basics
In Chapter I, we will be covering the below topics:
• Why should I know Java for learning OA Framework?• Object Oriented Programming• OOPS Concepts• Encapsulation• Inheritance• Polymorphism• What is a Class?• What is an Object?• What is a Method?• What is an Interface?• What is a Java Bean?• What is a Constructor?• What is an Array?• Data Types in Java• Different Types of Variables
Page 4
Chapter I - Java Basics
Why should I know Java for learning OA Framework?
hough you can develop simple applications with OA Framework without knowing basics of Java, it is highly recommended that you learn at least the basics of Java before proceeding to learn OA Framework. OA Framework is a
framework based on J2EE. Oracle has tried its level best to keep the framework simple and achieve the functionality with less coding and to be more declarative. Then the next question arises “How much Java one should know?”
TEncapsulation
ncapsulation is hiding information from unwanted outside access and attaching that information to only mJava is a ocean and you need not know everything in it. This book will guide you with the Java topics relevant to an
OA Framework developer.EObject Oriented Programming
Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.The concepts and rules used in object-oriented programming provide these important benefits:
• The concept of a data class makes it possible to define subclasses of data objects that share some or all of the main class characteristics. Called inheritance, this property of OOP forces a more thorough data analysis, reduces development time, and ensures more accurate coding.
• Since a class defines only the data it needs to be concerned with, when an instance of that class (an object) is run, the code will not be able to accidentally access other program data. This characteristic of data hiding provides greater system security and avoids unintended data corruption.
• The definition of a class is re-useable not only by the program for which it is initially created but also by other object-oriented programs (and, for this reason, can be more easily distributed for use in networks).
• The concept of data classes allows a programmer to create any new data type that is not already defined in the language itself.
Page 5
Chapter I - Java Basics
OOPS Concepts
The main OOPS concepts include Classes, Objects and Methods. However, there are a few more concepts that you will want to become familiar with. These are Inheritance, Abstraction, Polymorphism, Event, and Encapsulation.
Encapsulation
Encapsulation is hiding information from unwanted outside access and attaching that information to only methods that need access to it. This binds data and operations tightly together and separates them from external access that may corrupt them intentionally or unintentionally.Encapsulation is achieved by declaring variables as Private in a class. This gives access to data to only member functions of the class. A next level of accessibility is provided by the Protected keyword which gives the derived classes the access to the member variables of the base class. A variable declared as Protected can at most be accessed by the derived classes of the class
Abstraction
Abstraction can be defined as the process in which an application will ignore the characteristics of a sub-group and work on a general level when it is needed.
Inheritance
As the name inheritance suggests an object is able to inherit characteristics from another object. In more concrete terms, an object is able to pass on its state and behaviors to its children. For inheritance to work the objects need to have characteristics in common with each other.
Polymorphism
Polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes. For example, given a base class shape, polymorphism enables the programmer to define different area methods for any number of derived classes, such as circles, rectangles and triangles. No matter what shape an object is, applying the area method to it will return the correct results. Polymorphism is considered to be a requirement of any true object-oriented programming language (OOPL).
Page 6
Chapter I - Java Basics
What is a class?
A class is simply a representation of a type of object; think of it as a blueprint that describes the object. Just as a single blueprint can be used to build multiple buildings, a class can be used to create multiple copies of an object. It defines the attributes and behaviors of objects. It is the blueprint that defines an object
What is an object?
An object is a component of a program that knows how to perform certain actions and to interact with other pieces of the program. Objects can be thought of as "smart" black boxes. That is, objects can know how to do more than one specific task, and they can store their own set of data. Designing a program with objects allows a programmer to model the program after the real world. A program can be broken down into specific parts, and each of these parts can perform fairly simple tasks. When all of these simple pieces are meshed together into a program, it can produce a very complicated and useful application.
What is a method?
A method is a programmed procedure that is defined as part of a class and included in any object of that class. A class (and thus an object) can have more than one method. A method in an object can only have access to the data known to that object, which ensures data integrity among the set of objects in an application. A method can be re-used in multiple objects.
What is an Interface?
An interface is a reference type, similar to a class, that can contain only constants, method signatures, and nested types. There are no method bodies. Interfaces cannot be instantiated. They can only be implemented by classes or extended by other interfaces.
What is a Java Bean?
A Java Bean is a reusable software component that can be visually manipulated in builder tools.
Page 7
Chapter I - Java Basics
What is a constructor?
A constructor is called automatically when an object is created. It is usually declared public. It has the same name as the class. It must not specify a return type. The compiler supplies a no-arg constructor if and only if a constructor is not explicitly provided. If any constructor is explicitly provided, then the compiler does not generate the no-arg constructor.
What is an array?
An array is a wrapper class. An array is an object and it gets room in heap. Array can store a collection of data's of same data type. It can be used to store integers,strings even objects..its collections of data's. Whether the array stores primitive data's or objects in it, an array is always an object.
int numbers[] = new int[10]; this array is of size 10 which can hold 10 int values. This array numbers stores primitive data type but the array number is an object
Primitive Data Types in Java
A primitive type is predefined by the language and is named by a reserved keyword. Primitive values do not share state with other primitive values. The eight primitive data types supported by the Java programming language are:
• byte: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters.
• short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767
• int: The int data type is a 32-bit signed two's complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647
• long: The long data type is a 64-bit signed two's complement integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807
• float: The float data type is a single-precision 32-bit IEEE 754
Page 8
Chapter I - Java Basics
floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification.
• double: The double data type is a double-precision 64-bit IEEE 754 floating point.
• boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions.
• char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).
Different Types of Variables
The Java contains the following types of variables:• Instance Variables (Non-static fields): In object oriented
programming, objects store their individual states in the "non-static fields" that is declared without the static keyword. Each object of the class has its own set of values for these non-static variables so we can say that these are related to objects. Hence these variables are also known as instance variables. These variables take default values if not initialized.
• Class Variables (Static fields): These are collectively related to a class and none of the object can claim them its sole-proprietor . The variables defined with static keyword are shared by all objects. Here Objects do not store an individual value but they are forced to share it among themselves. These variables are declared as "static fields" using the static keyword. Always the same set of values is shared among different objects of the same class. So these variables are like global variables which are same for all objects of the class. These variables take default values if not initialized.
• Local Variables: The variables defined in a method or block of code is called local variables. These variables can be accessed within a method or block of code only. These variables don't take default values if not initialized. These values are required to be initialized before using them.
• Parameters: Parameters or arguments are variables used in method declarations.
Page 9
Chapter I - Java Basics
Type Casting
This is one of the common tasks when you work with OA Framework. Often you need to do type casting in OA Framework code. Type casting means treating a variable of one type as though it is of another type. There are 2 types of casting:Up Casting ( Implicit Casting)
◦ Example : int i = 10; long j = i;
• Down Casting ( Explicit Casting)
◦ Example : int i =12 ;
byte b2 = (byte) i ;
Exception Handling in Java
An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. When an error occurs within a method, the method creates an object and hands it off to the run time system. The object, called an exception object, contains information about the error, including its type and the state of the program when the error occurred. Creating an exception object and handing it to the run time system is called throwing an exception.
Checked exceptions are subject to the Catch or Specific Requirement. All exceptions are checked exceptions, except for those indicated by Error, Run time Exception, and their subclasses.
The second kind of exception is the error. These are exceptional conditions that are external to the application, and that the application usually cannot anticipate or recover from.
The third kind of exception is the run time exception. These are exceptional conditions that are internal to the application, and that the application usually cannot anticipate or recover from. These usually indicate programming bugs, such as logic errors or improper use of an API.
The first step in constructing an exception handler is to enclose the code that might throw an exception within a try block. In general, a try block looks like the following.
Page 10
Chapter I - Java Basics
try { code}catch and finally blocks . . .You associate exception handlers with a try block by providing one or more catch blocks directly after the try block. No code can be between the end of the try block and the beginning of the first catch block.try { } catch (ExceptionType name) { } catch (ExceptionType name) { } The finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. But finally is useful for more than just exception handling — it allows the programmer to avoid having cleanup code accidentally bypassed by a return, continue, or break.
Page 11
Chapter I - Java Basics
Page 12
Chapter I - Java Basics
CHAPTER
2Basics Of OA Framework
Page 13
Chapter II – Basics Of OA Framework
In Chapter II, we will be covering the below topics:
• What is OA Framework?• Parts of OA Framework• Model View Controller (MVC) Architecture• Model• View• Controller• OA Framework Architecture
Page 14
Chapter II – Basics Of OA Framework
What is OA Framework?
OA Framework is a J2EE framework developed by Oracle for extending the E-Business Suite. OA Framework follows the MVC Architecture which is a widely accepted framework for web based applications. In short a Framework is nothing but a partially built application which can be extended to suite the business needs. For example when you build a new application you have to take care of at least below things:
• Authentication System(Login and User Management)
• Security
• Accessibility
• User Personalization and Extensible Layer
OA Framework has all the above features and other important EBS features built in. This allows the Developer to concentrate on business logic and let the framework handle the technology.
By using OA Framework a developer can:
• Build new Self Service Pages for EBS• Personalize the Self Service pages• Extend the Self Service (seeded) pages
Page 15
Chapter II – Basics Of OA Framework
Parts of OA Framework
The three parts of OA Framework are:
• BC4J
• UIX
• OA Extension
BC4J:
BC4J stands for Business Components for Java. The business components represents the business logic. The different BC4J objects are Application Module, View Object, Entity Object ,Association Object , View Link and Validation View Object, Validation Application Module.
UIX:
UIX stands for User Interface XML which represents the java components for representing the UI. UIX represents the OA Page in OA Framework.
OA Extension:
OA Extension represents the declarative data for UIX extension. It resides in the MDS(Meta Data Repository).
Page 16
Chapter II – Basics Of OA Framework
Encapsulation
OA Framework applications can be associated like a layer of concentric layers. The core Layer is the Database and the outer most layer is the View Layer which is the OA Page. In between the Page and the database we have the Entity Object, View Object and the Application Module. Each layer knows about only the layer below it. Application Module knows what all VO's associated with it but not the EO's.
The OA Controller delegates the operations to the Application Module. OA Controller does not contain any business logic. In turn the AM calls a method in the VO where the data is queried from the Database.
There are 2 operations, that is Data Pull(Data Up Stack) and Data Push(Data Down Stack). In the Data Pull controller calls a method in AM, in turn the AM calls a method in VO and VO gets data from Database.
Page 17
Chapter II – Basics Of OA Framework
Fig 2 - 1: Encapsulation
Model View Controller (MVC) Architecture
MVC Architecture stands for Model View Controller.
Model:
The Model layer encapsulates the under lying data and business logic of the application. The Model layer represents the BC4J components which consists of the
• Application Module
• Entity Object
• View Object.
Page 18
Chapter II – Basics Of OA Framework
• Association Object
• View Link
Page 19
Chapter II – Basics Of OA Framework
Application Module:
The Application Module defines the logical data and business methods. The Application Module handles the transaction and interacts with clients. It serves as containers for related BC4J objects. AM is responsible for establishing database connections and transaction context. AM's can be nested to provide more complex application modules. Every OA Page should have at least one Application Module associated with it.
Entity Object:
Entity object encapsulates the business rules and logic. Entity object is used when there is a insert, Update or deletion of data. All data validations across the application is provided by the EO. EO's can be linked with each other to create an Association object.
View Object:
View Object encapsulate a database query. It iterates over the result set. View Object may be based on a simple select query or be based on an single or multiple EO's. VO acts as a single point of contact for getting and setting entity object values. View objects can be linked to form View Links. All VO's should be associated with an AM before usage.
Association Object :
Association Object is used to join two or more Entity Objects together.
View Link:
A view link is an active link between view links. A view link can be created by providing the source and destination views and source and destination attributes. There are two modes of View link operation that can be performed. A document and Master/Detail operation.
Page 20
Chapter II – Basics Of OA Framework
View:
The View Layer of the MVC architecture consists of page which in turn contains Regions and Items. Never confuse View with View Object. View Object is part of BC4J Layer( Model ).
Page 21
Chapter II – Basics Of OA Framework
Types of Regions in a Page
Regions are containers for for different items in a page. In a page there can be multiple regions inside a region and multiple items inside that region. Every region is a java bean acting as a container for regions under it or items.
Regions inside another region is called Child Region and that is present in the same level as another region it is a Sibling.
Region properties can be set like Style,ID,Rendered etc. There are small restrictions while creating the region which will affect the way the regions and items will be displayed in the page.
Few commonly used regions styles:
pageLayout Region:
PageLayout region is the highest level layout. By default this the top most region for every page. Any number regions can be created under the pagelayout region. The java bean associated with this region is OAPageLayoutBean.
Fig 2-3: pageLayout Region
Page 22
Chapter II – Basics Of OA Framework
messageComponentLayout Region:
MessageComponentLayout is a very common region style used which contains all the items starting with message. For example messageTextInput,messageStyledText etc. This region can have only message style of items. Non-message items has to be placed inside messageLayout under the messageComponentLayout Region.The items can be displayed in multiple columns and rows. The java bean associated with this region is OAMessageComponentLayoutBean.
Fig 2 - 4: MessageComponentLayout Region
Page 23
Chapter II – Basics Of OA Framework
Fig 2 - 5: MessageComponentLayout Region
Page 24
Chapter II – Basics Of OA Framework
queryBean:
Query bean as the name suggests, it is used when you have to perform any search on the page. It has different panels like simple search panel ,advanced search panel and Views Panel. You can optionally enable or disable the panels using the property inspector. The results are mostly rendered using a table or a hgrid. The different construction modes available with the query bean are Results based search and auto customization criteria and None. The java bean associated with this region is OAQueryBean.
Fig 2 - 6: Query Region
Page 25
Chapter II – Basics Of OA Framework
Fig 2 - 7: Query Region
Page 26
Chapter II – Basics Of OA Framework
hideShow Region:
In a page if you want to hide and show the items or regions, you can set the top region's style to hideShow. By using this you can hide or show a part of the information or the entire section. The java bean associated with this region is OADefaultHideShowBean.
Fig 2 - 8: HideShow Region
switcher Region:The switcher region is used at runtime to decide which item needs to be rendered. It is always bound to an attribute in VO. A view instance and view attribute is specified with switcher. The java bean associated with this region is OASwitcherBean.
Page 27
Chapter II – Basics Of OA Framework
Fig 2 - 9: Switcher Region
Page 28
Chapter II – Basics Of OA Framework
defaultSingleColumn Region:
The defaultSingleColumn as the name suggest is used for holding the items in a single column. This region is deprecated and you should not use it in your page. Whenever there is need for showing a single column region, use the messageComponentLayout region. Sometimes you may have to select this region to use the Region using wizard functionality, but change the region style to messageComponentLayout immediately after using the wizard. The java bean associated with this region is OADefaultSingleColumnBean.
defaultDoubleColumn Region:
The defaultSingleColumn as the name suggest is used for holding the items in double column. This region is deprecated and you should not use it in your page. Whenever there is need for showing a double column region, use the messageComponentLayout region. Sometimes you may have to select this region to use the Region using wizard functionality, but change the region style to messageComponentLayout immediately after using the wizard.The java bean associated with this region is OADefaultDoubleColumnBean.
pageButtonBar Region:
When ever any item is to be created at a page layout level we use the pageButtonBar region. It is the child of pageLayout level. The items create under this region will be displayed at the bottom(below footer) and top of the page(below page title). The java bean associated with this region is OAPageButtonBarBean.
Fig 2 - 10: Page Button Bar Region
Page 29
Chapter II – Basics Of OA Framework
Fig 2 - 11: Page Button Bar Region
tableLayout Region:
The tableLayout region is a wrapper containing rowLayout and cellFormat regions. This can be easily mapped to your HTML table. TableLayout is used when you need more control on placing the items in a Page. The java bean associated with this region is OATableLayoutBean.
rowLayout Region:
The rowLayout region is used when you want to hold a cell format inside as a child to it. It can be an independent region or a child or a tablelayout or advancedTable. The java bean associated with this region is OARowLayoutBean.
cellFormat Region:
CellFormat region is a container of regions or items. The java bean associated with this region is OACellFormatBean.
Page 30
Chapter II – Basics Of OA Framework
advancedTable Region:
Advanced Table is used when there is a need to perform create, update and delete functionality on the same page without navigating to another page. This will provide a Oracle Forms like functionality to the OA Page. The java bean associated with this region is OAAdvancedTableBean.
Fig 2 - 12: Advanced Table Region
table Region:
As the name suggest table is used for displaying data in a tabular format. It supports single and multiple selection. The java bean associated with this region is
Page 31
Chapter II – Basics Of OA Framework
OATableBean.
Page 32
Chapter II – Basics Of OA Framework
Fig 2 - 13: Table Region
flowLayout Region:
When you want to display table actions for a table or advancedTable you can create a flowLayout. Mainly it is for buttons we use this layout. The java bean associated with this region is OAFlowLayoutBean.
hGrid Region:
When the data needs to be displayed in a hierarchial structure the hGrid region is used. Detailed information for each row or node can also be given. The java bean associated with this region is OAHGridBean.
Fig 2 - 14: Hgrid Region
Page 33
Chapter II – Basics Of OA Framework
train Region:
When you have multiple pages then we use the train to show the progress. A highlighted mark shows the current page which you are in. The java bean associated with this region is OATrainBean.
Fig 2 - 15: Train Region
Page 34
Chapter II – Basics Of OA Framework
Types of Items in a Page
Regions act like a container for multiple items. There are a variety of items that can be created in a page. For example if a user wants to enter some data in the page then we make use of the messageTextInput item type. Similarly for various actions we have items. Let us see the item types now.
messageStyledText - When you want to display only the text and the user should not be able to edit the text then we use the messageStyledText.
Fig 2 - 16: MessageStyledText Item
Page 35
Chapter II – Basics Of OA Framework
messageRadioGroup- This helps to create radio buttons in your page.
Fig 2 - 17: MessageRadioGroup Item
messageCheckBox - This helps to create check box in your page.
Fig 2 - 18: MessageCheckBox Item
Page 36
Chapter II – Basics Of OA Framework
messageTextInput - As the name implies it helps the users to enter data into this box.
Fig 2 - 19: MessageTextInput Item
messageLovInput - when you want the uses to select from a list of values and quick select from the values then we use the messageLovInput. This will open a pop up and you can search for values and select from the results.
Fig 2 - 20: MessageLovInputt Item
Page 37
Chapter II – Basics Of OA Framework
messageChoice - When you want to display a list of values in a drop down fashion then you use the messageChoice.
Fig 2 - 21: MessageChoice Item
messageDownload - Used when the user needs to download a file or attachment.
Fig 2 - 22: MessageDownloadItem
Page 38
Chapter II – Basics Of OA Framework
messageFileUpload - Used for displaying a button with a messageTextInput .User can browse from the local machine and upload a file using this.
Fig 2 - 23: MessageFileUpload Item
button - It is a general button which has an action associated with it. You can set the fire action property which will in turn call a method which will perform that action.
Fig 2 - 24: Button Item
submitButton - This is the button used when you want to submit data to a OAF page.
Page 39
Chapter II – Basics Of OA Framework
Fig 2 - 25: SubmitButton Item
Link - Used for creating links. There are many types of links that can be created.
formValue - This is used to send value to an OAF page but without being displayed in the page.
spacer - This is used when you want to add space between your items placed in the page.
seperator - This creates a horizontal line in an oaf page.
Flex- This is a flexfield. There are 2 types of flex fields. Key and Descriptive flex fields.
urlInclude - This helps to include HTML content.
tip - Helps to give hint to the user
Page 40
Chapter II – Basics Of OA Framework
Controller:
Controller handles the user actions. OA Framework Controller has three methods. Below are the list of methods:
1. processRequest - Fires when page is rendered.2. processFormData - Fires when page submit happens.3. processFormRequest - Fires when Fire Action/Fire Partial Action and Page submit happens.
For those of you who worked in forms you can relate these methods like triggers in forms.WHEN-NEW-FORM-INSTANCE can be mapped to processRequest and WHEN-BUTTON-PRESSED can be mapped to processFormRequest.
processRequest:
Whenever you need some logic to get executed when a page is rendered,write that set of code in the processRequest. Take for example you programatically need to set the Page title to "Welcome !! " . This property needs to be set whenever you navigate to this page. So we write this set of code in the processRequest of the controller.
processFormData:
We don't write any code in this method because it is used by the framework to bind the data from the page to BC4J component(VO).
processFormRequest:
Whenever there is a post request in the page the method that is called is the processFormRequest. So all the code for any form action is written in this method. For example after entering all the values and you want to submit the data then the logic for submitting the data is written in the processFormRequest of the controller by capturing the form event or action.
The whole logic of the application should not be written in the controller. The Controller should delegate it to AM by invoking methods in the Application Module to perform those logic.
Page 41
Chapter II – Basics Of OA Framework
Page 42
Chapter II – Basics Of OA Framework
OA Framework Architecture
OAF works on the MVC architecture which is Model View Controller architecture. An easy explanation of the architecture which will make a clear understanding of the process is given below.
The client sends a request for an oaf page. In case of oracle apps it is the browser. The request is received by the http listener as it is a HTTP request. The Http listener forwards the request to the servelet engine(On the oracle apps we have the OC4J server which in turn has the servelet engine).From the servelet engine request is received by the controller which controls the complete flow. The request is then received by OA.jsp in the controller which is the central controller. OA.jsp identifies the page request and forwards it to the database. In the database we have MDS which is MetaData Service which is a repository for storing all the page definition. The page definitions are retrieved into middle tier from the MDS. Then the application data is retrieved into middle tier ie,UI Definition which is the business logic. The business logic needs to be applied on the data which is done by the BC4J. It is the forwarded to the UIX. The UIX renders or converts the page into xml. The xml is then sent to oa controller and is converted into html and returned back to the client.
The aol/j does authentication and authorization of the request to see if the user is valid before it goes to controller.
Page 43
Chapter II – Basics Of OA Framework
Fig 2- 26: OA Framework Architecture
Page 44
Chapter II – Basics Of OA Framework
CHAPTER
3Jdeveloper Environment
Setup
Page 45
Chapter III – Jdeveloper Environment Setup
In Chapter III, we will be covering the below topics :
• Setting up the Jdeveloper Environment
• Hello World Page
Page 46
Chapter III – Jdeveloper Environment Setup
Setting up the Jdeveloper Environment
etting up your working environment is one of the key tasks. Without the environment set up nothing can be done. Setting up the R12 Jdeveloper working environment is a little tricky . So lets see the various steps involved
in it.S
1. Open the Application and login as sysadmin/sysadmin.
2. Click on About this Page at the bottom most right hand corner.
3. In Technology Components tab the OA Framework version will be mentioned.
Page 47
Chapter III – Jdeveloper Environment Setup
Fig 3 - 1: OA Framework Version
4. In http://metalink.oracle.com search with the keyword “ Jdev with OA Extension”.
5. Click on the article “ How to find the correct version of Jdeveloper to use with E business Suite11i or Release 12”.
Fig 3 - 2: Correct Version Of Jdev
6. Download the patch that is next to your OA Framework version.
Page 48
Chapter III – Jdeveloper Environment Setup
Fig 3 - 3: Correct Version Of Jdev7. Unzip the files into a folder “CholaJdev”.
8. You should see 3 folders inside CholaJdev folder. One is jdevhome, jdevdoc and jdevbin.
9. A environment variable needs to be set before opening the Jdeveloper. Right click on My Computer. Go to Advanced System Settings. In the Advanced Tab click on Environment Variables.
10. In the User Variables click on New.
11. Set the below values:
Environment Variable:
Variable Name – JDEV_USER_HOME Variable Value – C:\CholaJdev\jdevhome\jdev
Page 49
Chapter III – Jdeveloper Environment Setup
Fig 3 - 4: Environment Variables12. Click Ok.
13. Download the dbc file from server and put it under <JDEV_USER_HOME>/dbc_files/secure folder.
14. Go to C:\CholaJdev\jdevbin\jdev\bin and right click jDevW.exe and click Send to Desktop Shortcut.
Page 50
Chapter III – Jdeveloper Environment Setup
15. Open the shortcut on the desktop.
16. The Application Navigator should look like below:
Fig 3 - 5: Jdeveloper17. Click on the + icon to add a workspace to the jdev.Go to myprojects and
select toolbox.jws.
Page 51
Chapter III – Jdeveloper Environment Setup
Fig 3 - 6: Open Workspace
18. Open the workspace and right click on right click on Tutorial.jpr.
19. Go to Oracle Applications → Database Connection.
20. Click New to create a new DB connection.
Page 52
Chapter III – Jdeveloper Environment Setup
21. Set the below properties:
DB Properties:
Connection Name – CholaDBUsername – appsPassword – appsHost Name – chola01.apps Port – 1523SID – VIS
Fig 3 - 7: Database Connection22. Go to Run Time Connection and set the below properties
Run Time Connection:
DBC File Name - <JDEV_USER_HOME>\dbc_files\secure\VIS.dbcUserName – sysadmin
Page 53
Chapter III – Jdeveloper Environment Setup
Password – sysadminApplication Short Name – FNDResponsibility Key - APPLICATION_DEVELOPER
Fig 3 - 8: Run time Connection
23. Click Ok. Right click on Tutorial.jpr and click Rebuild.
Page 54
Chapter III – Jdeveloper Environment Setup
24. Right click on HelloWorldPG and click Run.
Fig 3 - 9: Run Page
Page 55
Chapter III – Jdeveloper Environment Setup
25. The below screen shott shows that the jdev setup is fine and you can see the HelloWorld page displayed.
Fig 3 - 10: Hello World Page Output
Page 56
Chapter III – Jdeveloper Environment Setup
Hello World Page Lab
Hello World is a very simple tutorial for beginners where we will get an input from the user and display the information after concatenating with the word Hello before the user input. For eg if the user enters the value “Chola” then the output will be “Hello Chola !!”.
The Final output should look like below:
Fig 3 - 11: Hello World Page Output
1. Every project should be under a OA Workspace. Right click on Applications and select New OA Workspace.
Page 57
Chapter III – Jdeveloper Environment Setup
Fig 3 - 12: New Workspace
2. Set the below properties for the workspace:
Workspace Properties
Name – CholaTutorialsAdd New OA Project – Check it
Fig 3 - 13: New Project
Page 58
Chapter III – Jdeveloper Environment Setup
3. Set the following properties for the project and Click Next.
Project Properties:
Name – CholaTutorialsDefault Package – xxcholas.oracle.apps.fnd.hello
In the Default package xxcholas is the third party identifier. fnd is the application short name and hello is the component name.
Fig 3 - 14: Project Properties
4. For the hello world tutorial there is no database connection required. Click Next.
Page 59
Chapter III – Jdeveloper Environment Setup
5. Set the below connection details and Click Next and Finish.
Run Time Connection Details:
DBC File Name - <JDEV_USER_HOME>\dbc_files\secure\VIS.dbcUser Name – sysadminPassword – sysadminApplication Short Name – FNDResponsibility Key - APPLICATION_DEVELOPER
Fig 3 - 15: Hello World Page Output
6. Right click on CholaTutorials and select New.
7. Select the Web Tier → OA Components → Page.
Page 60
Chapter III – Jdeveloper Environment Setup
Fig 3 - 16: New Page8. Set the following properties for the page and click OK.
New Page:
Name - CholaHelloWorldPGPackage - xxcholas.oracle.apps.fnd.hello.webui
9. Click on CholaHelloWorldPG and in the structure pane and click on region1 and set the following properties for the region:
Region Properties:
Id – PageLayoutRNAM Definition – oracle.apps.fnd.framework.server.OAApplicationModuleWindow Title - Chola's Hello WorldPage Title – Hello World
Page 61
Chapter III – Jdeveloper Environment Setup
10. Right click on PageLayoutRN and select new → Region.
11. Set the following properties for the region. All the message type items should be created under messageComponentLayout region style.
Region Properties:
Id – MainRNRegion Style – messageComponentLayout
12. Right click ok MainRN and select new → messageTextInput
Fig 3 - 17: New MessageTextInput13. Set the following properties for the messageTextInput:
MessageTextInput Properties:
Id – HelloNamePrompt – NameMaximum Length – 40Length – 20
14. For creating a Button which will post the value got from the user we need a
Page 62
Chapter III – Jdeveloper Environment Setup
submit button. Buttons cannot be created under messageComponentLayout region. So we will create a messageLayout region and create a new submit Button under it.
15. Right click on MainRN and select new → messageLayout.
Fig 3 - 18: New MessageLayout16. Set the following properties:
MessageLayout Properties:
Id - ButtonLayout
17. Right click on ButtonLayout and select new → Item.
Page 63
Chapter III – Jdeveloper Environment Setup
Fig 3 - 19: New Item
18. Set the following properties:
Item Properties:
Id – GoItem Style – submitButtonPrompt – Go
19. The structure pane for the CholaHelloWorldPG should look like below:
Page 64
Chapter III – Jdeveloper Environment Setup
Fig 3 - 20: Hello World Page Structure20. The page design is over now and lets create a controller which will handle
the code.
Page 65
Chapter III – Jdeveloper Environment Setup
21. Right click on PageLayoutRN and click Set new Controller.
Fig 3 - 21: New Controller22. Set the following properties for the controller. Click Ok.
Controller Properties:
Package – xxcholas.oracle.apps.fnd.hello.webuiName – CholaHelloWorldCO
Fig 3 - 22: Controller Properties
Page 66
Chapter III – Jdeveloper Environment Setup
23. Click on CholaHelloWorldCO.java. The java file contains processFormRequest and processRequest method. For handling the button click request code needs to be written under the processFormRequest method.
ProcessFormRequest Code:
//Checks if the Go button is pressed. If yes then the code will be executed if (pageContext.getParameter("Go")!=null) { //Assigns the value of input from the inputText to the string inputName
String inputName=pageContext.getParameter("HelloName");
//Concats Hello with the input and then !
String outmsg="Hello "+"" + inputName + "!!";
//Throws the concatenated message as an exception information on the browser throw new OAException(outmsg,OAException.INFORMATION); }
Code Listing 3 - 1: Process Form Request Code24. Save your work and right click on CholaTutorials project and click Add to
Project Content.
Page 67
Chapter III – Jdeveloper Environment Setup
Fig 3 - 23: Add to Project Content
Page 68
Chapter III – Jdeveloper Environment Setup
25. Click on Add. Select xxcholas and click Ok. Again Click Ok. Now you should see only the package xxcholas.oracle.apps.fnd.hello.webui in your project.
Fig 3 - 24: Select Package
Page 69
Chapter III – Jdeveloper Environment Setup
26. Right click on CholaHelloWorldPG and click Run. The completed page will look like below:
Fig 3 - 25: Hello World Page Output
The final output should look like below:
Fig 3 - 26: Hello World Page Output
Page 70
Chapter III – Jdeveloper Environment Setup
Summary:
At the end of Chapter III, you should have learned the following:
• Setting up the Jdeveloper working environment.
• Hello World Page Lab.
Page 71
Chapter III – Jdeveloper Environment Setup
CHAPTER
4Search Page
Page 72
Chapter IV – Search Page
In Chapter IV, we will be covering the below topics:
• Auto Customization Criteria Search.
• Adding Attachments to the Results Table.
Page 73
Chapter IV – Search Page
Auto Customization Criteria Search
Auto Customization Criteria Search is used when you want full control on the search criteria and the item styles of the search items. In Results Based Search we don't create the search items, but in Auto Customization Criteria Search we can create search items with any item style like messageLovInput, messageChoice etc.
1. Right click on Applications and select New OA Workspace.
Fig 4 - 1: New Workspace
2. Set the below values for the Workspace.
Workspace Properties:
Name – CholaAdvBookNew OA Project - Checked
Page 74
Chapter IV – Search Page
Fig 4 - 2: Workspace Properties
3. The workspace is created under the default location which is <JDEV_USER_HOME>/myprojects.
4. A new OA Project is created automatically. Set the below values:
Project Properties:
Name – CholaAdvBookProjectDefault Package – chola.oracle.apps.fnd.adv
Page 75
Chapter IV – Search Page
Fig 4 - 3: Workspace Properties5. Click Next.
Page 76
Chapter IV – Search Page
6. Check the Use repository for Design Time and Click New.
Fig 4 - 4: Database Connection
Page 77
Chapter IV – Search Page
7. Set the connection name as CholaConnection. Click Next.
Fig 4 - 5: Database Connection8. Set the below values for the connection:
User Credentials:
User Name – appsPassword – apps
Page 78
Chapter IV – Search Page
Fig 4 - 6: Database Connection9. Set the below values:
Connection Details:
Host Name – chola01.apps Port – 1523 SID – VIS
Page 79
Chapter IV – Search Page
Fig 4 - 7: Database Connection
Page 80
Chapter IV – Search Page
10. Click Next and Test Connection. The status will be success. Click Finish.
Fig 4 - 8: Database Connection11. Click Next and then set the below properties for the Run time connection.
Run Time Connection Details:
DBC File Name - <JDEV_USER_HOME>\dbc_files\secure\VIS.dbcUserName – sysadminPassword – sysadminApplication Short Name – FNDResponsibility Key - APPLICATION_DEVELOPER
Page 81
Chapter IV – Search Page
Fig 4 – 9: Run Time Connection12. Click Finish. Save your work and in the Application Navigator you will be
seeing a workspace and a project inside that.
Page 82
Chapter IV – Search Page
13. The structure should look like below:
Fig 4 – 10: Project and Workspace14. Right click on the project and select New.
Page 83
Chapter IV – Search Page
15. Select Business Tier → ADF Business Components → Application Module.
Fig 4 – 11: New Application Module
16. Set the below values for the AM:
AM Properties:
Name – CholaAdvAMPackage – chola.oracle.apps.fnd.adv.server
Page 84
Chapter IV – Search Page
Fig 4 – 12: New Application Module17. Click Next and Finish.
18. Save your work and right click on Project and select → Add to Project Content.
19. Click Add and select only the chola folder and click Ok. This step will make sure that only the chola package will be available in the project.
Page 85
Chapter IV – Search Page
Fig 4 – 13: Select Package20. In the Application Navigator you will notice only the chola package.
Page 86
Chapter IV – Search Page
Fig 4 – 14: Select Package21. Right click on the project and select New. Select Business Tier → ADF
Business Components → Entity Object.
Page 87
Chapter IV – Search Page
Fig 4 – 15: New Entity Object22. Set the below values for the EO:
EO Properties:
Name – EmployeeEOPackage – chola.oracle.apps.fnd.schema.server Schema Object – EMP
Fig 4 – 16: Entity Object Properties
23. Click Next.
Page 88
Chapter IV – Search Page
Fig 4 – 17: Entity Object Properties24. All the attributes from the EMP table will be displayed. The EO should
always contain the entire attributes from the table.
25. Click Next.
26. In the Java methods check the Create, Delete and Validation methods.
Page 89
Chapter IV – Search Page
Fig 4 – 18: Entity Object Properties27. Click Next and Finish.
28. Right click on chola.oracle.apps.fnd.schema.server and select new → Entity Object.
29. Set the below values:
EO Properties:
Name – DepartmentEOPackage – chola.oracle.apps.fnd.schema.serverSchema Object – DEPT
Page 90
Chapter IV – Search Page
Fig 4 – 19: Entity Object Properties30. All attributes in the Dept table will be displayed.
31. Click Next.
Page 91
Chapter IV – Search Page
32. Check the Create , Delete and Validation methods.
Fig 4 – 20: Entity Object Properties
Page 92
Chapter IV – Search Page
33. Click Next and Finish.
34. Right click on chola.oracle.apps.schema.server and select New → Association.
35. An Association Object is created here in order to join the Emp and Dept table so that we get the Department Name as well in the details.
36. Set the below values:
AO Properties:
Name – EmpToDeptAO Package - chola.oracle.apps.schema.server
Page 93
Chapter IV – Search Page
Fig 4 – 21: Association Object Properties
Page 94
Chapter IV – Search Page
37. Click Next and select the below values:
Cardinality - * to 0..1Source Attribute – Deptno(EmployeeEO)Destination Attribute – Deptno ( DepartmentEO)
38. Click Add and then Next and Finish.
Fig 4 – 22: Association Object Properties39. Click Next and Finish.
Page 95
Chapter IV – Search Page
40. Right click on chola.oracle.apps.adv.server and select new → View Object.
Page 96
Chapter IV – Search Page
41. Set the below values:
VO Properties:
Name – EmpDetailsVO Package - chola.oracle.apps.adv.server
Fig 4 – 23: View Object Properties42. Click Next. Select the EmployeeEO and DepartmentEO and shuttle it to the
right side. Set the Association for DepartmentEO as EmpToDeptAO.DepartmemtEO1. Check the Updatable.
Page 97
Chapter IV – Search Page
Fig 4 – 24: View Object Properties43. Click Next.
44. From the EmployeeEO select Empno, Ename,Sal,Job, Hiredate,Comm,Address1,City,State,Country,Deptno and from DepartmentEO select Dname,Loc and Deptno.
Page 98
Chapter IV – Search Page
Fig 4 – 25: View Object Properties45. Click Next. In the SQL statement click on Expert Mode and use the below
query:
SQL Query:
SELECT EmployeeEO.EMPNO, EmployeeEO.ENAME, EmployeeEO.JOB, EmployeeEO.HIREDATE, EmployeeEO.SAL, EmployeeEO.DEPTNO AS DEPTNO1, EmployeeEO.COMM, EmployeeEO.ADDRESS1, EmployeeEO.CITY,
Page 99
Chapter IV – Search Page
EmployeeEO.STATE, EmployeeEO.COUNTRY, DepartmentEO.DEPTNO, DepartmentEO.DNAME, DepartmentEO.LOCFROM EMP EmployeeEO, DEPT DepartmentEOWHERE EmployeeEO.DEPTNO = DepartmentEO.DEPTNO(+)
Code Listing 4 - 2: SQL Query
Fig 4 – 26: View Object Properties46. Click Next and in the Java methods check EmpDetailsRowImpl.java and
click Finish. Oracle standard is to always create the rowImpl.java file for the VO's which will improve the performance.
Page 100
Chapter IV – Search Page
Fig 4 – 27: View Object Properties47. Right click on CholaAdvAM and click Edit CholaAdvAM. Whenever a VO
is created it needs to be associated with the AM before use.
48. Shuttle the EmpDetailsVO to the right side and click Ok.
49. Right click on the project and select New.
50. In Web Tier → OA Components select Page.
Page 101
Chapter IV – Search Page
Fig 4 – 28: New Page51. Set the below values:
Page Properties:
Name – EmployeeManagerPGPackage – chola.oracle.apps.fnd.adv.webui
Page 102
Chapter IV – Search Page
Fig 4 – 29: Page Properties
52. In the structure pane of EmployeeManagerPG, set the below properties for region1.
Region1 properties:
Id – PageLayoutRNAM Definition – chola.oracle.apps.fnd.adv.server.CholaAdvAMWindow Title - Chola's Search PagePage Title – Search Employee
53. Right click PageLayoutRN and select New → Region.
54. Set the below properties
QueryRN properties:
Id – QueryRNRegion Style – queryConstruction Mode – autoCustomizationCriteria
55. Right click on QueryRN and select New → Region using wizard.
56. Select the CholaAdvAM and then select EmpDetailsVO1 and click Next.
Page 103
Chapter IV – Search Page
Fig 4 – 30: Page Properties57. Set the Region Id as ResultsTable and Region Style as table. Click Next.
Page 104
Chapter IV – Search Page
Fig 4 – 31: Page Properties58. Shuttle all the attributes to the right side.
Page 105
Chapter IV – Search Page
Fig 4 – 32: Page Properties59. Change the item style of all the attributes to messageStyledText and set the
Prompt as per the screen shot. Click Next and finish.
Page 106
Chapter IV – Search Page
Fig 4 – 33: Page Properties60. Set the Width of ResultsTable to 100%.
Page 107
Chapter IV – Search Page
61. Right click on QueryRN and select new → simpleSearchPanel.
Fig 4 – 34: Page Properties62. Set the header Id to SimpleSearchHeader.
63. Right click Region1 and select new → messageTextInput.
64. Set the below pr operties
MessageTextInput Properties:
Id – SearchEmpNamePrompt - Name
65. Right click Region1 and select new → messageTextInput.
66. Set the below properties
MessageTextInput Properties:
Id – SearchEmpNoPrompt - Number
67. Right click on QueryRN and select new → simpleSearchMappings.
Page 108
Chapter IV – Search Page
Fig 4 – 35: Page Properties68. Set the below properties for the default criteriaMap1.
CriteriaMap1 Properties:
Id – NameMapSearch Item – SearchEmpNameResults Item – Ename
69. Right click simpleSearchMappings and click new → criteriaMap.Set the below properties
CriteriaMap2 Properties:
Id – NoMapSearch Item – SearchEmpNoResults Item – Empno
70. Save your work and run the EmployeeManagerPG.
Page 109
Chapter IV – Search Page
71. The page should look like below:
Fig 4 – 36: Output72. The output should look like below:
Fig 4 – 37: Output
Page 110
Chapter IV – Search Page
Adding Attachments to the Results Table
Attachments can be added in a table or an advanced table where we can attach a file or text or URL. Let us see the steps involved in implementing the attachments.
1. Go to the EmployeeManagerPG and in the Structure pane right click on the ResultsTable and select New → Item.
Fig 4 – 38: New Item2. Set the below properties for the new Item.
ID – AttachmentItem Style – attachmentImageView Instance – EmpDetailsVO1 Automatic Save – True Prompt - Attach
3. A entityMap1 gets created automatically and set its Entity property to Chola.
4. Right click on entityMap1 and select new → primaryKeys.
Page 111
Chapter IV – Search Page
5. Set the below values for the PrimaryKey1.
Page 112
Chapter IV – Search Page
View Attribute - Empno
6. Save your work and Run the EmployeeManagerPG.
7. You can notice a new column in the ResultsTable .
8. Click on the + symbol and attach a new file.
9. Select a file and click on Apply.
Fig 4 – 39: Add Attachment
Page 113
Chapter IV – Search Page
10. A confirmation message is displayed. You can notice a new icon in the Attach column.
Fig 4 – 40: Output
Fig 4 – 41: Output
Page 114
Chapter IV – Search Page
Summary:
In Chapter IV, we learned how to do the below labs:
• Auto Customization Criteria Search.
• Adding Attachments to the Results Table.
Page 115
Chapter IV – Search Page
CHAPTER
5Advanced Table
Page 116
Chapter V – Advanced Table
Chapter V – Advanced Table
In Chapter V, we will be covering the below topics:
• Convert Results Table into Advanced Table.
• Add Create functionality
• Adding Poplist and LOV to the Advanced Table
• Add Single Select Delete functionality.
• Convert Single Select Delete to Multi Select Delete
Page 117
Chapter V – Advanced Table
Convert Results Table into Advanced Table
The advantage of using the Advanced Table is that we can create, Update and Delete records using the Advanced Table itself. By adding table actions we can create a Delete button for deleting records. Add Another Row feature allows user to create a new record. That's the advantage of using the Advanced Table.
Let us see the steps in creating the Advanced Table.
1. Go to the EmployeeManagerPG and right click on QueryRN and select new → Region.
2. Set the below properties:
Table Properties:
ID – ResultsAdvTableRegionStyle – advancedTableView Instance – EmpDetailsVO1Width - 80%
3. Right click on ResultsAdvTable and select new -> column.
4. We will the existing items in the table to create the advanced table which will save a lot of effort.
5. Drag the Empno from the ResultsTable and drop it inside the column1.
Fig 5 – 1: Results Table
6. Right click on the columnHeader and select new -> sortableHeader. Select
Page 118
Chapter V – Advanced Table
the sortableHeader and set the Prompt to Emp No.
7. Right click on ResultsAdvTable and select new -> column.
8. Drag the Ename from the ResultsTable and drop it inside the column2.
9. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Emp Name.
10. Right click on ResultsAdvTable and select new -> column.
11. Drag the Job from the ResultsTable and drop it inside the column3.
12. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Job.
13. Right click on ResultsAdvTable and select new -> column.
14. Drag the Hiredate from the ResultsTable and drop it inside the column4.
15. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Hire Date.
16. Right click on ResultsAdvTable and select new -> column.
17. Drag the Deptno1 from the ResultsTable and drop it inside the column5.
18. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Dept Num.
19. Right click on ResultsAdvTable and select new -> column.
20. Drag the Sal from the ResultsTable and drop it inside the column6.
21. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Salary.
22. Right click on ResultsAdvTable and select new -> column.
23. Drag the Comm from the ResultsTable and drop it inside the column7.
24. Right click on the column and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Comm.
25. Right click on ResultsAdvTable and select new -> columnGroup
26. Right click on columnGroup1 and select new -> column.
Page 119
Chapter V – Advanced Table
27. Drag the Address1 from from the ResultsTable and drop it inside the column8.
28. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Address1.
29. Right click on columnGroup1 and select new -> column.
30. Drag the City from from the ResultsTable and drop it inside the column9.
31. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to City.
32. Right click on columnGroup1 and select new -> column.
33. Drag the State from from the ResultsTable and drop it inside the column10.
34. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to State.
35. Right click on columnGroup1 and select new -> column.Drag the Country from from the ResultsTable and drop it inside the column11.
36. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Country.
37. Right click on columnGroup1's columnHeader and click new → sortableHeader.
38. Set the Prompt as Address.
39. Right click on ResultsAdvTable and select new -> column.
40. Drag the Deptname from the ResultsTable and drop it inside the column12.
41. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Dept Name.
42. Right click on ResultsAdvTable and select new -> column.
43. Drag the Attachment from the ResultsTable and drop it inside the column13.
44. Right click on the column and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Attach.
45. Delete the Loc and Deptno from the table.
46. Save your work and Run the EmployeeManagerPG to test if the page is
Page 120
Chapter V – Advanced Table
working fine.
Page 121
Chapter V – Advanced Table
Create Functionality
Create Functionality can be achieved in the Advanced Table by adding a table footer which in turn contains the Add Another Row button in the Advanced Table.
Let us see the steps in creating the button.
1. Right click on the ResultsAdvTable of the EmployeeManagerPG and select New → footer.
2. Right click on tableFooter1 and select addTableRow.
3. Set the below properties:
Add Another Row Properties:
Id - AddAnotherRowPrompt - Add Another RowRowsToAdd – 1Insert Rows Automatically - false
4. Change the Item Style of all the items inside the ResultsAdvTable to messageTextInput since the user will have the flexibility to enter data and create a new employee in the advanced table itself.
5. Right click on PageLayoutRN. Set the Region style → pageButtonBar.
6. Right click the pageButtonBar and select new-> Item
7. Set the below properties:
ID – ApplyItem Style - submitButtonPrompt - Apply
8. Right click the pageButtonBar and select new- Item.
ID – CancelItem Style - submitButton
Page 122
Chapter V – Advanced Table
Prompt - Cancel
Page 123
Chapter V – Advanced Table
9. Use the below code for defaulting a empno in the EmployeeEOImpl.java
Default Emp no:
OADBTransaction transaction = getOADBTransaction(); Number employeeId = transaction.getSequenceValue("EMPLOYEES_S"); setEmpno(employeeId);
Code Listing 5 - 1: EmployeeEOImpl.java Code10. Right click on ResultsAdvTable and click Set new Controller.
11. Set the below properties
Controller :
Name – ResultsAdvTableCOPackage – chola.oracle.apps.fnd.adv.webui
12. Use the below code for handling the Add Another Row button in the processFormRequest of ResultsAdvTableCO .
Handle Add Another Row:
import oracle.apps.fnd.framework.OAApplicationModule;import oracle.apps.fnd.framework.webui.beans.OAWebBean;
OAApplicationModule am = pageContext.getApplicationModule(webBean); if ("ResultsAdvTable".equals(pageContext.getParameter(SOURCE_PARAM)) && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) { am.invokeMethod("createEmployee"); }
Code Listing 5 - 2: Add Another Row Button Code13. Right click on PageLayoutRN and click Set net Controller.
Controller :
Page 124
Chapter V – Advanced Table
Name – EmployeeManagerCOPackage – chola.oracle.apps.fnd.adv.webui
14. Use the below code in the processFormRequest to handle Apply and Cancel button.
Handle Apply and Cancel Buttons:
import oracle.apps.fnd.framework.OAApplicationModule;import oracle.apps.fnd.framework.webui.TransactionUnitHelper;import oracle.apps.fnd.framework.webui.beans.OAWebBean;
OAApplicationModule am = pageContext.getApplicationModule(webBean); if (pageContext.getParameter("Apply") != null) { am.invokeMethod("apply"); } else if (pageContext.getParameter("Cancel") != null) { am.invokeMethod("rollbackEmployee"); TransactionUnitHelper.endTransactionUnit(pageContext, "empCreateTxn"); }
Code Listing 5 – 3 : Process Form Request Code
Page 125
Chapter V – Advanced Table
15. In the CholaAdvAMImpl.java use the below code:
CreateEmployee Method:
import oracle.apps.fnd.framework.OAViewObject;import oracle.jbo.Row;
public void createEmployee() { OAViewObject vo = (OAViewObject)getEmpDetailsVO1(); if (!vo.isPreparedForExecution()) { vo.setMaxFetchSize(0); } Row row = vo.createRow(); vo.last(); vo.next(); vo.insertRow(row); row.setNewRowState(Row.STATUS_INITIALIZED); }
Code Listing 5 – 4 : Create Employee Code
16. In the CholaAdvAMImpl.java use the below code:
Apply Method:
public void apply(){ getTransaction().commit(); }
Code Listing 5 – 5 : Apply method Code
Page 126
Chapter V – Advanced Table
17. In the CholaAdvAMImpl.java use the below code
Rollback Method:
import oracle.jbo.Transaction;
public void rollbackEmployee() { Transaction txn = getTransaction(); if (txn.isDirty()) { txn.rollback(); } }
Code Listing 5 – 6 : Rollback method Code18. Save your work and run the EmployeeManagerPG.
19. Click on Add Another Row. A new rows gets inserted with a default value on the Emp no.
Fig 5 – 2: Output
Page 127
Chapter V – Advanced Table
20. Enter values for other fields and click Apply. A new row gets added in the table.
21. Set the length of the below attributes:
Emp No – 4 Ename – 10 Job – 9 DeptNo1 – 2 Sal – 7 Comm – 7 Dname – 14
Page 128
Chapter V – Advanced Table
Adding Poplist and LOV to the Advanced Table
Poplist is nothing but a drop down list which contains various values and the user can choose any value from the list. The item style for poplist is messageChoice. LOV is nothing but list of values where the user can search for a record by giving search criteria. The item style for LOV is messageLovInput.
LOV's can be created in 2 ways:• Internal LOV
◦ Internal LOV is the LOV which will be created within that particular attribute and cannot be used by any other page. It is not re-usable.
• External LOV◦ External LOV is the LOV which is created as a new region and can be
associated with any attribute in any page. It is a re-usable component that can be used across pages.
In this we will be using the External LOV which will be used by multiple pages.
Let us see the steps in creating the Poplist and LOV.
1. Right click on the project and select New → Business Tier → ADF Business Components → View Object.
2. Set the following properties:
VO Properties:
Name - DeptNamesVO Package - chola.oracle.apps.fnd.lov.server
Page 129
Chapter V – Advanced Table
Fig 5 – 3: View Object Properties3. Go to the SQL statements step and use the below query:
SELECT Dname, Deptno from Dept
Code Listing 5 – 7 : SQL Query
4. Uncheck the DeptNamesVOImpl.java(since we won't be writing any code in the file) and check the DeptNamesVORowImpl.java(good practice to do so) and click Finish.
5. Edit the CholaAdvAM and shuttle the DeptNamesVO to the right click and click Ok.
Page 130
Chapter V – Advanced Table
6. Right click project and select View Object in the ADF Business Components . Set package as chola.oracle.apps.fnd.poplist.server .
7. Name the VO as JobsVO and click Next.
Page 131
Chapter V – Advanced Table
Fig 5 – 4: View Object Properties8. Go to the SQL statement and paste the below query:
SELECT meaning, lookup_codeFROM fnd_lookupsWHERE lookup_type = 'CHOLA_JOB'
Code Listing 5 – 8: SQL Query9. Check only the JobsVORowImpl.java and click Finish.10. Change the Item Style of Deptname to messageLovInput and Job to
messageChoice.
Page 132
Chapter V – Advanced Table
11. Set the below properties Job:
Deptname Properties:
Picklist View Definition - chola.oracle.apps.fnd.poplist.server.JobsVOPicklist View Instance – JobsVO1Picklist Display Attribute – MeaningPicklist Value Attribute - LookupCode
12. Right click on the project and click New. In the OAComponents → Select Region.
13. Set the below properties:Region Properties:
Id - DeptNamesLovRNPackage – chola.oracle.apps.fnd.lov.webuiRegion Style - listOfValues
Fig 5 – 5: Region Properties14. Set the Scope to Public.15. Right click on DeptNamesLovRN on the structure pane and click Table using
wizard.16. Choose the CholaAdvAM and then click on DeptNamesVO1 and click Next.
Page 133
Chapter V – Advanced Table
Fig 5 – 6: Region Properties
17. Shuttle the all the attributes to the right.18. Click Next and Finish.19. Set the Scope of DeptNamesLovRN in the structure pane to Public.20. Set the SearchAllowed property for Deptno and Dname to True.21. In the Page set the External LOV property of DName to
/chola/oracle/apps/fnd/lov/webui/DeptNamesLovRN.In the default lovmap
22. Set the below propertiesLovMap properties:
Id – DnameMapLOV Region Item – DnameReturn Item – DeptnameCriteria Item - Deptname
Page 134
Chapter V – Advanced Table
Page 135
Chapter V – Advanced Table
23. Right click on Lovmappings and select new → lovMap.LovMap properties:
Id – DnoMapLOV Region Item – DeptnoReturn Item – Deptno1
Page 136
Chapter V – Advanced Table
Add Single Select Delete functionality
Single Delete as the name suggest the user can delete only one record at a time in the advanced Table. The single delete functionality can be achieved by adding a radio button to the table and adding tableActions to the Advanced Table. Whenever the user clicks on the radio button and then click on Delete button the record will be deleted.
1. Edit the EmpDetailsVO1 and click on Attributes tab.
2. Click on New.
3. Set the below values:
Name – SelectFlagType – StringUpdatable – Always
Page 137
Chapter V – Advanced Table
4. Click Ok.
Fig 5 – 7: New Attribute5. Right click on ResultsAdvTable and select new → singleSelection( adds a
radio button in the table).
Fig 5 – 8: New Single Selection
Page 138
Chapter V – Advanced Table
6. Set the below values:
View Attribute – SelectFlagText – Select
7. Right click on ResultsAdvTable and select new → tableActions.
Fig 5 – 9: New Table Action8. Right click on region2 and select new → Item.Set the below properties
Id – DeletePrompt – DeleteAction Type – fireAction Event - delete
9. Use the below code in the processFormRequest of ResultsAdvTableCO.
Delete Event:
if ("delete".equals(pageContext.getParameter(EVENT_PARAM))) { am.invokeMethod("deleteEmp"); am.invokeMethod("apply"); }
Page 139
Chapter V – Advanced Table
Code Listing 5 – 9: Handle Delete Event
10. Use the below code in CholaAdvAMImpl.java
DeleteEmp Method:
public void deleteEmp() { OAViewObject vo = (OAViewObject)getEmpDetailsVO1(); EmpDetailsVORowImpl row = null; int fetchedRowCount = vo.getFetchedRowCount(); int savedRangeSize = 0; int savedRangeStart = 0; if (fetchedRowCount > 0) { savedRangeSize = vo.getRangeSize(); savedRangeStart = vo.getRangeStart(); vo.setRangeStart(0); vo.setRangeSize(fetchedRowCount); setRangeStart(0); setRangeSize(fetchedRowCount); Row[] rows = vo.getAllRowsInRange(); for (int i = 0; i < fetchedRowCount; i++) { if (rows[i] != null && "Y".equals(rows[i].getAttribute("SelectFlag"))) //call to delete api { rows[i].remove(); } } } vo.setRangeSize(savedRangeSize); vo.setRangeStart(savedRangeStart); }
Code Listing 5 – 10: Delete Method11. Save your work and run the EmployeeManagerPG.
12. Click Go and all the records will be displayed.
13. Click on any of the radio buttons and click Delete.
Page 140
Chapter V – Advanced Table
Fig 5 – 10: Region Properties14. You will notice that record is not present.
Page 141
Chapter V – Advanced Table
Convert Single Select Delete to Multi Select Delete
Multi Delete gives the user the flexibility to delete multiple records at one time. This can be achieved by adding a check box to the Advanced Table( we already have the table Actions that we added in the Single Delete) . The user can select multiple records and click Delete and the rows will be deleted.
1. For converting the single selection to multi selection delete the single selection in the EmployeeManagerPG.
2. Right click on ResultsAdvTable and select new → multiSelection.
Fig 5 – 11: Region Properties3. Set the below properties
Multi Select Properties:
ID – MultiSelectText – SelectView Attribute – SelectFlag
4. Save your work and Run the EmployeeManagerPG.
5. You can see that there is a checkbox in the first column. Select the first 2 records and click Delete.
Page 142
Chapter V – Advanced Table
Fig 5 – 12: Output
Page 143
Chapter V – Advanced Table
6. You will see only 1 record now. The 2 rows have been deleted.
Fig 5 – 13: Output
Page 144
Chapter V – Advanced Table
Summary:
In Chapter V we learned how to do the below labs :
• Convert Results Table into Advanced Table.
• Add Create functionality
• Adding Poplist and LOV to the Advanced Table
• Add Single Select Delete functionality.
• Convert Single Select Delete to Multi Select Delete
Page 145
Chapter V – Advanced Table
CHAPTER
6Dependent LOV and
Poplist
Page 146
Chapter VI – Dependent LOV and Poplist
Chapter VI – Dependent LOV and Poplist
In Chapter VI , we will be covering the below topics:
• Dependent Poplist
• Dependent LOV
• Google Style Auto Suggest LOV
Page 147
Chapter VI – Dependent LOV and Poplist
Dependent Poplist
Dependent Poplist is one of the common requirement where one poplist value depends on the value selected in another poplist. For example the value of State poplist depends on the value chosen in the Country Poplist.
Let us see the steps involved in creating the Dependent Poplist.
1. Right click on chola.oracle.apps.fnd.poplist.server and select new → View Object.
2. Set the Name as CountryVO and click Next.
3. Go to the SQL Statement and use the below query:
CountryVO Query:
SELECT meaning, lookup_codeFROM fnd_lookup_values_vlWHERE lookup_type = 'CHOLA_COUNTRY'
Code Listing 6 – 1: SQL Query4. Uncheck the CountryVOImpl.java and check the CountryVORowImpl.java
and click Finish.
5. Right click on chola.oracle.apps.fnd.poplist.server and select new → View Object.
6. Set the Name as StateVO and click Next.
7. Go to the SQL Statement and use the below query:
StateVO Query:
SELECT meaning, lookup_code,tagFROM fnd_lookup_values_vlWHERE lookup_type = 'CHOLA_STATE' and tag=:1
Code Listing 6 – 12 SQL Query8. Check the StateVORowImpl.java and click Finish.
9. Right click on chola.oracle.apps.fnd.poplist.server and select new → View
Page 148
Chapter VI – Dependent LOV and Poplist
Object.
10. Set the Name as CityVO and click Next.
11. Go to the SQL Statement and use the below query:
CityVO Query:
SELECT meaning, lookup_code,tagFROM fnd_lookup_values_vlWHERE lookup_type = 'CHOLA_CITY'
Code Listing 6 – 3: SQL Query12. Uncheck the CityVOImpl.java and check the CityVORowImpl.java and click
Finish.
13. Edit the CholaAdvAM and shuttle the CountryVO, StateVO and CityVO to the right side.
14. Go to EmployeeManagerPG and change the Item Style of Country to messageChoice.
15. Set the below properties for Country:
Country Item Properties:
Picklist View Definition - chola.oracle.apps.fnd.poplist.server.CountryVOPicklist View Instance – CountryVO1Picklist Display Attribute – MeaningPicklist Value Attribute – LookupCodeAction Type – firePartialActionEvent - country
16. Action Type is set in order to fire an action which will query for the data in the StateVO so that all the states under the Country chosen in the poplist will be displayed in the State poplist.
17. Click on Parameters and set the name as Country and give the value as
${oa.EmpDetailsVO1.Country}
18. Go to EmployeeManagerPG and change the Item Style of State to messageChoice.
Page 149
Chapter VI – Dependent LOV and Poplist
19. Set the below properties for State:
State Item Properties:
Picklist View Definition - chola.oracle.apps.fnd.poplist.server.StateVOPicklist View Instance – StateVO1Picklist Display Attribute – MeaningPicklist Value Attribute - LookupCode
20. Use the below code in processRequest of EmployeeManagerCO:
ProcessRequest Code:
OAAdvancedTableBean advTable = (OAAdvancedTableBean)webBean.findChildRecursive("ResultsAdvTable"); OAMessageChoiceBean empPoplist = (OAMessageChoiceBean)advTable.findChildRecursive("State"); empPoplist.setListVOBoundContainerColumn(0, advTable,"Country");
Code Listing 6 – 4: ProcessRequest Code
21. Use the below code in processFormRequest of EmployeeManagerCO:
ProcessFormRequest Code:
if ("country".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM))) { am.invokeMethod("initStateVOQuery"); }
Code Listing 6 – 5: ProcessFormRequest Code
Page 150
Chapter VI – Dependent LOV and Poplist
22. Use the below code in CholaAdvAMImpl.java
InitStateVOQuery method:
public void initStateVOQuery() { StateVOImpl vo = (StateVOImpl) getStateVO1(); if (vo == null) { MessageToken[] errTokens = {new MessageToken("OBJECT_NAME", "CountyVO1")}; throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens); } vo.executeQuery(); }
Code Listing 6 – 6: InitStateVOQuery method23. Save your work and run the page.
24. Click on Add Another Row and select the country as India. Now in the State poplist you will see only the states in India. That is we will have only one value Tamil Nadu.
Page 151
Chapter VI – Dependent LOV and Poplist
Fig 6 – 1: Output
Page 152
Chapter VI – Dependent LOV and Poplist
25. Now select the Country as Singapore. There are no states in Singapore, so no value will be present for Singapore Country.
Fig 6 – 2: Output
Page 153
Chapter VI – Dependent LOV and Poplist
Dependent LOV
Similar to the Dependent Poplist we have the Dependent LOV where the results will of the LOV will depend on the value chosen in the other poplist or LOV. In this we will see the City LOV where the values in the LOV depends on the Country and State poplist.
Let us see the steps in creating the Dependent LOV.
1. Right click on chola.oracle.apps.fnd.lov.webui and click New → Web Tier → OA Components → Region.
2. Set the below values:
Region Properties:
Name – CityLovRNPackage - chola.oracle.apps.fnd.lov.webui Style – listOfValues
Fig 6 – 3: New Region3. Right click on CityLovRN on the structure pane and select new →
tableUsingWizard.
4. Select the CholaAdvAM and click on CityVO1 and click Next.
Page 154
Chapter VI – Dependent LOV and Poplist
Fig 6 – 4: Region Properties
Page 155
Chapter VI – Dependent LOV and Poplist
5. Shuttle all the attributes to the right and click Next.
Fig 6 – 5: Region Properties6. Click Next and Finish.
7. Set the Scope property of CityLovRN to public.
8. Set the Search Allowed property to True for Meaning and LookupCode.
9. Change the prompt and Id of Meaning to City, LookupCode to City Code.
10. Change the Item style of Tag to formValue.
11. In the EmployeeManagerPG change the Message Style of City to messageLovInput.Set the External LOV property of City to
/chola/oracle/apps/fnd/lov/webui/CityLovRN.
Page 156
Chapter VI – Dependent LOV and Poplist
12. Click Yes when prompted to delete the existing mappings.
13. Set the below properties for the existing LOV map.
Page 157
Chapter VI – Dependent LOV and Poplist
LOV Map Properties:
Id – MeaningMapLOV Region Item – CityReturn Item – CityCriteria Item - City
14. Right click on LovMappings and select new → LovMap.
15. Set the below properties for the new LOV map.
LOV Map Properties:
Id – TagMapLOV Region Item – TagCriteria Item - State
16. Right click on LovMappings and select new → LovMap.
17. Set the below properties for the new LOV map.
LOV Map Properties:
Id – LookupMapLOV Region Item – CityCodeCriteria Item - Country
18. Save your work and run the EmployeeManagerPG.
19. Click Add Another Row and select Country as India. State as Karnataka.
20. Click on the Lov and click Go.
21. You will notice that only the city under the state Karnataka is displayed.
Page 158
Chapter VI – Dependent LOV and Poplist
Fig 6 – 6: Output22. Now change the State to Tamil Nadu and click the Lov.
Fig 6 – 7: Output
Page 159
Chapter VI – Dependent LOV and Poplist
23. You will see 2 cities.
Fig 6 – 8: Output
Page 160
Chapter VI – Dependent LOV and Poplist
Google Style Auto Suggest LOV
1.Go to http://script.aculo.us/downloads and download the current version.
Fig 6 – 9: Scriptaculous2. Unzip the files in your local machine.
3. Copy the prototype.js from lib folder to the src folder.
Page 161
Chapter VI – Dependent LOV and Poplist
4. The files under the src folder should look like below:
Fig 6 – 10: Folders
5. Transfer all these files to $OA_HTML in the server.Create a jsp file with the name as EmpAutoSuggestLov3.jsp under $OA_HTML with the below code:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" import="java.sql.*" import="oracle.jdbc.driver.OracleConnection" import="oracle.apps.jtf.aom.transaction.TransactionScope" %><% OracleConnection conn = null; PreparedStatement stmt = null; ResultSet rs = null; int i=0; try { conn = (OracleConnection)TransactionScope.getConnection(); String sName = request.getParameter("SearchEmpName") + "%"; String sql = "SELECT Ename,Empno FROM emp where lower(ename) like (?) "; stmt = conn.prepareStatement(sql); stmt.setString(1, sName);
rs = stmt.executeQuery(); out.write("<ul>"); while (rs.next()) { i = i + 1;
Page 162
Chapter VI – Dependent LOV and Poplist
out.write("<li>"); out.write(rs.getString("Ename")); out.write("</li>"); } if (i == 0) { out.write("<li>"); out.write("<p><b>No Results Found</b></p>"); out.write("</li>");
} out.write("</ul>"); } catch(Exception e) { out.write("failed:" + e.toString()); } finally { if (rs != null) rs.close(); if (stmt != null) stmt.close(); if (conn != null) TransactionScope.releaseConnection(conn); }%>
Code Listing 6 – 7: EmpAutoSuggestLov3.jsp
6. Compile the jsp file using the below command:
1. export PATH=$PATH:$FND_TOP/patch/115/bin 2. ojspCompile.pl --compile --fast --quiet
7. Go to the EmployeeManagerPG or the page where you want to implement the google style auto suggest LOV and click Personalize Page.
8. Click on the Create Item icon next to Page Layout.
9. Set the below Properties for the new Item:Item Properties:
Item Style – rawText
Page 163
Chapter VI – Dependent LOV and Poplist
ID – CholaGlobalGoogleStyle
Fig 6 – 11: New Item
10. Set the Text as :
<html> <head><title>Chola Global AutoComplete</title> <style type="text/css"> div.autocomplete { position:absolute; width:400px; background-color:white; border:1px solid #ccc; margin:0px; padding:0px; font-size:0.9em; text-align:left; max-height:200px; overflow:auto; } div.autocomplete ul { list-style-type:none; margin:0px; padding:0px; } div.autocomplete ul li.selected { background-color: #EAF2FB; } div.autocomplete ul li { list-style-type:none; display:block; margin:0; padding:2px; cursor:pointer; } /* alternative style */ div.autocomplete2 { position:absolute; width:400px; background-color:white; border:1px solid #ccc; margin:0px; padding:0px; font-size:0.9em; text-align:left; max-height:200px;
Page 164
Chapter VI – Dependent LOV and Poplist
overflow:auto; } div.autocomplete2 ul { list-style-type:none; margin:0px; padding:0px; } div.autocomplete2 ul li.selected { background-color: #deffff; } div.autocomplete2 ul li { list-style-type:none; display:block; margin:0; padding:2px; cursor:pointer; } /* new style version 0.4 */ div.autocomplete4 { position:absolute; width:500px; background-color:black; margin:0px; margin-left:5px; padding:0px; font-size:0.9em; text-align:left; max-height:200px; overflow:auto; color:#f4f4f4; } div.autocomplete4 ul { list-style-type:none; margin:0px; padding:0px; } div.autocomplete4 ul li.selected { background-color: #8bc9fe; color:black; } div.autocomplete4 ul li { list-style-type:none; display:block; margin:0; padding:2px; cursor:pointer; } </style>
<script type="text/javascript" src="prototype.js"></script> <script type="text/javascript" src="scriptaculous.js"></script> <script type="text/javascript" src="effects.js"></script> <script type="text/javascript" src="controls.js"></script> <script type="text/javascript"> function init() { new Ajax.Autocompleter("SearchEmpName","EmployeeOptions","EmpAutoSuggestLov3.jsp"); } window.onload = init; </script> </head> <body> <form> <div class="autocomplete" id="EmployeeOptions" style="position:absolute; width:400px; background-color:white; border:1px solid #ccc; margin:0px; padding:0px; font-size:0.9em; text-align:left; max-height:200px; overflow:auto; "></div> </form> </body> </html>
Page 165
Chapter VI – Dependent LOV and Poplist
Code Listing 6 – 8: Raw Text
Fig 6 – 12: Output11. Click Apply.12. Click on Return to Application on the bottom left corner.13. In the Search Page, enter a value in Emp Name and you should see all the employee names starting with that letter as a drop down in the LOV.
Page 166
Chapter VI – Dependent LOV and Poplist
Fig 6 – 13: Output
Page 167
Chapter VI – Dependent LOV and Poplist
14. If the search criteria did not match then “No Results Found” will be displayed.
Fig 6 – 14: Output
15. If you don't want to use this Lov then you can use the normal LOV by clicking on the LOV icon. This will work like your standard LOV functionality.
Page 168
Chapter VI – Dependent LOV and Poplist
Summary:
In Chapter VI , we learned the below topics:
• Dependent Poplist
• Dependent LOV
• Google Style Auto Suggest LOV
Page 169
Chapter VI – Dependent LOV and Poplist
CHAPTER
7Master Detail
Page
Page 170
Chapter VII – Master Detail Page
Chapter VII – Master Detail Page
In Chapter VII , we will cover the below topics:
• Forms Style Master Detail Page
• Create Department and Drill Down to Details Page
Page 171
Chapter VII – Master Detail Page
Form Style Master Detail Page
1. Right click on chola.oracle.apps.fnd.adv.server and select New → View Object.Set the name as DeptCreateVO.
2. Shuttle the DepartmentEO to the right side and click Next.
3. Shuttle the Deptno, Dname and Loc to the right side and Click Next.
4. Check the DeptCreateVORowImpl.java and click finish.
5. Edit the CholaAdvAM and shuttle the DeptCreateVO to the right side and click ok.
6. Right click on chola.oracle.apps.fnd.adv.webui and select New → Web Tier → OA Components → Page.
7. Set the name as CreateDeptPG.
8. Click on region1 and set the below properties:
Id – PageLayoutRNAM Definition –chola.oracle.apps.fnd.adv.server.CholaAdvAMWindow Title - Chola's Create DepartmentTitle – Create Department
9. Right click on PageLayoutRN and select New → region using wizard.
10. Choose the CholaAdvAM and click on DeptCreateVO1 and click Next.
Page 172
Chapter VII – Master Detail Page
Fig 7 – 1: Region Properties11. Set the below properties:
Region ID – MainRNRegion Style - defaultSingleColumn
Page 173
Chapter VII – Master Detail Page
Fig 7 – 2: Region Properties12. Click Next and shuttle all the attributes to the right side.
13. Click Next and Finish. Select the PageLayoutRN in the Structure pane, then right-click and select New > Region from the context menu.
ID - PageButtonsRegion Style - pageButtonBar
14. Right-click PageButtons in the Structure pane, and select New > Item from the context menu. Set or verify the following properties for this item:
ID - CancelItem Style - submitButtonAttribute set - /oracle/apps/fnd/attributesets/Buttons/CancelDisable Server Side Validation - trueDisable client Side Validation - truePrompt - Cancel
Page 174
Chapter VII – Master Detail Page
15. Right-click PageButtons in the Structure pane, and select New > Item from the context menu. Set or verify the following properties for this item:
ID - ApplyItem Style - submitButtonAttribute set - /oracle/apps/fnd/attributesets/Buttons/ApplyAdditional Text - Select to save this employee
16. Change the Region Style of MainRN to messageComponentLayout.Right click on PageLayoutRN and select new → Region. Set the below properties:
ID – EmpDetailsRegionStyle – advancedTableView Instance – EmpDetailsVO1
17. Right click on EmpDetails and select new -> column. Right click on colum1 and select new → Item.
ID – EnameItemStyle – messageInputTextView Attribute – EnamePrompt - Emp Name
18. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Emp Name.
19. Right click on EmpDetails and select new -> column. Right click on column2 and select new → Item.
ID – EmpNo
Page 175
Chapter VII – Master Detail Page
ItemStyle – formValueView Attribute – EmpnoPrompt - Emp Num
Page 176
Chapter VII – Master Detail Page
20. Right click on EmpDetails and select new -> column. Right click on column3 and select new → Item.
ID – JobItemStyle – messageChoicePick List View Definition - chola.oracle.apps.fnd.poplist.server.JobsVOPick List View Instance – JobsVO1Pick List Display Attribute – MeaningPick List Value Attribute - LookupCode View Attribute – JobPrompt - Job
21. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Job.
22. Right click on EmpDetails and select new -> column. Right click on column4 and select new → Item.
ID – SalaryItemStyle – messageInputTextView Attribute – SalPrompt - Salary
23. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Salary.
24. Right click on EmpDetails and select new -> column. Right click on column5 and select new → Item.
ID – HireDateItemStyle – messageInputTextView Attribute – HiredatePrompt – Hire Date
Page 177
Chapter VII – Master Detail Page
25. Right click on the columnHeader and select new -> sortableHeader. Select the sortableHeader and set the Prompt to Hire Date .
26. Right click on the EmpTable of the CreateDeptPG and select New → footer.
27. Right click on tableFooter1 and select addTableRow.
28. Set the below properties:
Add Another Row Properties:
Id - AddAnotherRowPrompt - Add Another RowRowsToAdd – 1Insert Rows Automatically - false
29. Right click on EmpTable and select new → multiSelection.
Set the below properties
Multi Select Properties:
ID – MultiSelectText – SelectView Attribute – SelectFlag
30. Right click on ResultsAdvTable and select new → tableActions.
31. Right click on region2 and select new → Item.
32. Set the below properties
Id – DeletePrompt – DeleteAction Type – fireAction Event - delete
33. Right click on PageLayoutRN and select Set new Controller.
34. Set the name as CreateDeptCO and package as chola.oracle.apps.fnd.adv.webui.
Page 178
Chapter VII – Master Detail Page
35. Use the below code in ProcessRequest:
ProcessRequest Code:
if (!pageContext.isBackNavigationFired(false)) { TransactionUnitHelper.startTransactionUnit(pageContext, "deptCreateTxn"); if (!pageContext.isFormSubmission()) { OAApplicationModule am = pageContext.getApplicationModule(webBean); am.invokeMethod("createDept", null); am.invokeMethod("apply"); } } else { if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext, "deptCreateTxn", true)) { OADialogPage dialogPage = new OADialogPage(NAVIGATION_ERROR); pageContext.redirectToDialogPage(dialogPage); } }
Code Listing 7- 1 : ProcessRequest Code
Page 179
Chapter VII – Master Detail Page
36. Use the below code in ProcessFormRequest:
ProcessFormRequest:
OAApplicationModule am = pageContext.getApplicationModule(webBean); if (pageContext.getParameter("Apply") != null) { OAViewObject vo = (OAViewObject)am.findViewObject("DeptCreateVO1"); String deptName = (String)vo.getCurrentRow(). getAttribute("Dname"); Number deptNumber = (Number)vo.getCurrentRow() .getAttribute("Deptno"); String DeptNum = String.valueOf(deptNumber.intValue()); am.invokeMethod("apply"); MessageToken[] tokens = { new MessageToken("DNAME", deptName), new MessageToken("DEPTNO", DeptNum) }; OAException confirmMessage = new OAException("AK", "FWK_TBX_T_EMP_CREATE_CONFIRM", tokens, OAException.CONFIRMATION, null); pageContext.putDialogMessage(confirmMessage); } else if (pageContext.getParameter("Cancel") != null) { am.invokeMethod("rollbackDept"); TransactionUnitHelper.endTransactionUnit(pageContext, "deptCreateTxn");
}
Code Listing 7- 2 : ProcessFormRequest Code
Page 180
Chapter VII – Master Detail Page
37. Use the below code in CholaAdvAMImpl.java .
Create Department Code:
public void createDept() { OAViewObject vo = (OAViewObject)getDeptCreateVO1(); if (!vo.isPreparedForExecution()) { vo.executeQuery(); } Row row = vo.createRow(); vo.insertRow(row); row.setNewRowState(Row.STATUS_INITIALIZED); }
Code Listing 7- 3 : Create Department Code
38. Use the below code in CholaAdvAMImpl.java .
RollBack :
public void rollbackDept() { Transaction txn = getTransaction(); if (txn.isDirty()) { txn.rollback(); } }
Code Listing 7- 4 : Rollback method Code39. Use the below code in create method of DepartmentEOImpl.java
Default Dept ID:
OADBTransaction transaction = getOADBTransaction(); Number deptId = transaction.getSequenceValue("DEPARTMENT_S"); setDeptno(deptId);
Page 181
Chapter VII – Master Detail Page
Code Listing 7- 5 : DepartmentEOImpl.java Code
40. Right click on EmpTable and select Set new Controller.
41. Set the name as EmpTableCO and package as chola.oracle.apps.fnd.adv.webui .
42. Use the below code in processFormRequest.
ProcessFormRequest Code:
OAApplicationModule am = pageContext.getApplicationModule(webBean); if ("EmpTable".equals(pageContext.getParameter(SOURCE_PARAM)) && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) { String Deptno= (String)pageContext.getParameter("Deptno1"); Serializable[] param={Deptno}; am.invokeMethod("createEmp", param); } if ("deleteEmp".equals(pageContext.getParameter(EVENT_PARAM))) { am.invokeMethod("deleteEmp"); am.invokeMethod("apply"); }
Code Listing 7- 6 : ProcessFormRequest Code
Page 182
Chapter VII – Master Detail Page
43. Use the below code in CholaAdvAMImpl.java.
public void createEmp(String Deptno) { OAViewObject vo = (OAViewObject)getEmpDetailsVO1(); Number deptNo = null; try { deptNo = new Number(Deptno); } catch(Exception e) {} if (!vo.isPreparedForExecution()) { vo.setWhereClause("1=2"); vo.executeQuery(); } Row row = vo.createRow(); System.out.println("deptNo"+deptNo); row.setAttribute("Deptno1", deptNo); vo.last(); vo.next(); vo.insertRow(row); row.setNewRowState(Row.STATUS_INITIALIZED); } // end createEmp()
Code Listing 7- 7 : Create Employee Code
44. Save your work and Run the CreateDeptPG.
45. A department number will be defaulted. Enter the Dept name and location.
46. Click Add Another Row.
47. Enter details for Employee and click Apply.
Page 183
Chapter VII – Master Detail Page
48. You will see and confirmation message telling the department has been created.
Fig 7 – 3: Output
Page 184
Chapter VII – Master Detail Page
Search Department and Drill Down to Details Page
Drill down to details is implemented by setting the Destination URI to the Dept Name. By this the Dept Name becomes like a hyperlink and when the user clicks on the Dept Name it goes to another page where all the details of the department and the users in that department will be displayed.
1. Right click on chola.oracle.apps.fnd.adv.webui and select New.
2. In the web Tier → OA Components select Page.
3. Set the name as DeptManagerPG and package as chola.oracle.apps.fnd.adv.webui
4. In the structure pane of DeptManagerPG, set the below properties for region1.
Region1 properties:
Id – PageLayoutRNAM Definition – chola.oracle.apps.fnd.adv.server.CholaAdvAMWindow Title - Chola's Search PagePage Title – Search Department
5. Right click PageLayoutRN and select New → Region.
6. Set the below properties
QueryRN properties:
Id – QueryRNRegion Style – queryConstruction Mode – autoCustomizationCriteria
7. Right click on QueryRN and select New → Region using wizard.
8. Select the CholaAdvAM and click on CreateDeptVO and click Next.
Page 185
Chapter VII – Master Detail Page
Fig 7 – 4: Output9. Set the below properties:
Region Id – MainRNRegion Style - table
10. Shuttle all the attributes to the right side and click Next.
Page 186
Chapter VII – Master Detail Page
11. Set the prompt as per the below screenshot.
Fig 7 – 5: Change Prompt12. Click Next and Finish.
13. Change the Item style of all the attributes to messageStyledText.Set the width of MainRN to 80%.
14. Right click on QueryRN and select New → simpleSearchPanel.
15. Set the ID for region2 to SimpleSearchHeader.
16. Right click on region1 and click new → messageTextInput.
17. Set the following properties for the messageTextInput.
Page 187
Chapter VII – Master Detail Page
ID – SearchDeptName Prompt - Name
Page 188
Chapter VII – Master Detail Page
18. Right click on region1 and click new → messageTextInput.
ID – SearchDeptNo Prompt - Number
19. Right click on QueryRN and select New → simpleSearchMappings.
20. Set the criteriaMap1 properties:
ID – SearchNameMapSearch Item – SearchDeptNameResults Item – Dname
21. Right click on simpleSearchMappings and click new → criteriaMap.
22. Set the below properties:
ID – SearchNumMapSearch Item – SearchDeptNoResults Item – Deptno
23. In the DeptManagerPG , set the Destination URI property of Dname to OA.jsp?page=/chola/oracle/apps/fnd/adv/webui/CreateDeptPG&DeptNo={@Deptno}&retainAM=Y
24. Add the below code in processRequest of DeptCreateCO.
ProcessRequest Code:
String deptNumber = pageContext.getParameter("DeptNo"); OAApplicationModule am = pageContext.getApplicationModule(webBean); Serializable[] parameters = { deptNumber }; am.invokeMethod("initDetails", parameters); am.invokeMethod("initEmpDetails", parameters);
Code Listing 7- 8 : ProcessRequest Code
Page 189
Chapter VII – Master Detail Page
25. Use the below code in CholaAdvAMImpl.java
public void initDetails(String deptNumber) { DeptCreateVOImpl vo =(DeptCreateVOImpl) getDeptCreateVO1(); if (vo == null) { MessageToken[] errTokens = { new MessageToken("OBJECT_NAME", "DeptCreateVO1")}; throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens); } vo.initQuery(deptNumber); }
Code Listing 7- 9 : InitDetails Method Code
26. Use the below code in CholaAdvAMImpl.java
public void initEmpDetails(String deptNumber) { EmpDetailsVOImpl vo =(EmpDetailsVOImpl) getEmpDetailsVO1(); if (vo == null) { MessageToken[] errTokens = { new MessageToken("OBJECT_NAME", "EmpDetailsVO1")}; throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens); } vo.initEmpQuery(deptNumber); }
Code Listing 7- 10 : InitEmpDetails Method Code
Page 190
Chapter VII – Master Detail Page
27. Use the below code in DeptCreateVOImpl.java
Import Statements:import oracle.jbo.domain.Number;
public void initQuery(String employeeNumber) { if ((employeeNumber != null) && (!("".equals(employeeNumber.trim())))) {Number empNum = null; try { empNum = new Number(employeeNumber); } catch(Exception e) { throw new OAException("AK", "FWK_TBX_INVALID_EMP_NUMBER"); } setWhereClause("DEPTNO = :1"); setWhereClauseParams(null); // Always reset setWhereClauseParam(0, empNum); executeQuery(); } }
Code Listing 7- 11 : InitQuery Method Code
Page 191
Chapter VII – Master Detail Page
28. Use the below code in EmpDetailsVOImpl.java
Import Statements:import oracle.jbo.domain.Number;
public void initEmpQuery(String deptNumber) { if ((deptNumber != null) && (!("".equals(deptNumber.trim())))) {Number deptNum = null; try { deptNum = new Number(deptNumber); } catch(Exception e) { throw new OAException("AK", "FWK_TBX_INVALID_EMP_NUMBER"); } setWhereClause("DEPTNO = :1"); setWhereClauseParams(null); // Always reset setWhereClauseParam(0, deptNum); executeQuery(); } }
Code Listing 7- 12 : InitEmpQuery Method Code
Page 192
Chapter VII – Master Detail Page
29. Include the below code in ProcessFormRequest after transaction code in the Cancel If loop of CreateDeptCO.
pageContext.forwardImmediately("OA.jsp?page=/chola/oracle/apps/fnd/adv/webui/DeptManagerPG", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null, null, false, // retain AM OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
Code Listing 7- 13 : ProcessFormRequest Code30. Save your work and run the DeptManagerPG.
31. Click Go button. You will see all the departments displayed. The Department
Name will be displayed as a link.
Page 193
Chapter VII – Master Detail Page
Fig 7 – 6: Output
Page 194
Chapter VII – Master Detail Page
32. Click on CholaOAF and it will go to the DeptCreatePG with all the details of the department and it will show the employees under the CholaOAF department.
Fig 7 – 7: Output
Page 195
Chapter VII – Master Detail Page
Summary:In Chapter VII , we covered the below topics:
• Forms Style Master Detail Page
• Create Department and Drill Down to Details Page
Page 196
Chapter VII – Master Detail Page
CHAPTER
8Deployment
Page 197
Chapter VIII – Deployment
Chapter VIII – Deployment
In Chapter VII, we will be covering the below topics:
• Deployment
• Home Page with Tabs
Page 198
Chapter VIII – Deployment
Deployment
Important steps involved in deployment are as follows:
Local Machine:
1. Make a zip file of required files to be migrated. Let us zip the chola folder under <JDEV_USER_HOME>/myclasses.
2. The zip file will contain Class files and VO/EO/AM xml files PG/RN xml files.
Server Steps:
1. FTP the chola.zip file to the server.
2. Unzip the chola.zip file into $JAVA_TOP.
3. Import PG/RN xml files to MDS repository.
4. Use the below command for importing Pages and Regions.
java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/chola/oracle/apps/fnd/adv/webui/EmployeeManagerPG.xml -username APPS -password apps -dbconnection "(DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=<Host Name>)(PORT=<port>)) (CONNECT_DATA= (SID=<SID>) ) )" -rootdir $JAVA_TOP ;
Code Listing 8- 1 : XML Importer Command
Page 199
Chapter VIII – Deployment
5. Similarly import all the pages and regions under the chola by changing the path in the command.
Fig 8 – 1: Page Import
Page 200
Home Page with Tabs
After deploying the files into the server we would like to have the Employee and Department as separate tabs in the application. Let us see how to create Tabs in the Application and associate with Employee Page and Department Page.
1. Now we will create a function and menu for viewing the page in the application.
2. Login to the application. Go to Functional Administrator responsibility.
3. Go to Core Services tab → Functions → Create Function.
4. Set the below values:
Function Values:
Name – Chola Emp Function Code – CHOLA_EMP_FUNCType – SSWA Jsp FunctionalHTML Call - OA.jsp?page=/chola/oracle/apps/fnd/adv/webui/EmployeeManagerPG
Fig 8 – 2: Function Properties
Page 201
5. Create another function and set the below values:
Function Values:
Name – Chola Emp Function Code – CHOLA_DEPT_FUNCType – SSWA Jsp FunctionalHTML Call - OA.jsp?page=/chola/oracle/apps/fnd/adv/webui/DeptManagerPG
Fig 8 – 3: Function Properties6. Go the Menu's tab and click Create New Navigation Menu.
7. Set the below values:
Menu Values:
Name – Chola Emp MenuCode – EMP_MENU Type – HTML Tab Function – Chola Emp Function
Page 202
Fig 8 – 4: Menu Properties8. Click Submit.
9. Create another menu and set the below values:
Menu Values:
Name – Chola Emp MenuCode – EMP_MENU Type – HTML Tab Function – Chola Emp Function
Page 203
Fig 8 – 5: Menu Properties10. Create a new Menu and set the below values:
Menu Values:
Name – Emp Dept MenuCode – EMP_DEPT_MENU Type – Home Page Sub Menu1 – Chola Employee MenuSub Menu1 – Chola Dept Menu
Page 204
Fig 8 – 6: Menu Properties11. Click Submit.
12. Go to Function and create a new function with the below values:
Function Values:
Name – Chola Home Page FunctionCode – CH_HOME_FUNCType – SSWA Jsp Function HTML Call - OA.jsp?OAFunc=CHOLA_EMP_FUNC&OAHP=CH_HOME_FUNC&OASF=CHOLA_EMP_FUNC
Page 205
13. Go to the Responsibility to which you want to attach the application. We will use the Application Developer responsibility now.
14. Go to the Menu and search for FND%DEV%NAVIGATE and update the menu.
15. Add a new row and set the Prompt as Chola Emp Dept Manager Page and function as Chola Home Page Function.
16. Click Add Another Row and enter the Prompt as Employee and select the Chola Employee Menu in the Sub Menu.
17. Similarly add Click Add Another Row and enter the Prompt as Department and select the Chola Dept Menu in the Sub Menu.
18. Click Submit.
Page 206
Fig 8 – 7: Menu Properties19. Go to the Application Developer responsibility and in the functions you will
see Chola Emp Dept Manager Page. Click on that.
20. You will see 2 tabs, Employee and Department.
Page 207
Fig 8 – 6: Menu Properties
Page 208
Summary:In Chapter VIII. we covered the below topics:
• Deployment
• Home Page with Tabs
Page 209
CHAPTER
9Extension
Page 210
Chapter IX - Extension
Chapter IX - ExtensionIn the Chapter IX we will be covering the below topics:
Page 211
Chapter IX - Extension
• Extension
◦ VO Extension
◦ CO Extension
◦ EO Extension
◦ Deploying the Substitution
• Personalization
Page 212
Chapter IX - Extension
Extension
Extension in OA Framework is nothing but adding a new functionality to the application without touching the standard objects. By extending the standard objects we are not touching the standard objects. This will ensure that your changes will not be overwritten by patching or upgrades. There are 3 types of Extension:
1. VO Extension
2. EO Extension
3. CO Extension
VO Extension:
1. Open the application and go to Payables ,Vision Operation(USA) responsibility.
Fig 9 – 1: Responsibility2. In the Suppliers Menu click on the Entry function.
Page 213
Chapter IX - Extension
Fig 9 – 2: Function3. Click About This page to determine the VO for the summary table.
Fig 9 – 3: About This Page4. Click Expand All to see all the items and regions in the page.
Page 214
Chapter IX - Extension
Fig 9 – 4: Expand All
Page 215
Chapter IX - Extension
5. Suppliers table is the table which is displaying the results of the search page. The VO associated with the table is SuppSummVO. We are going to extend the SuppSummVO to include an attribute with a different name.
Fig 9 – 5: View Object
Page 216
Chapter IX - Extension
6. Below picture shows you all the BC4J components referenced by this page.
Fig 9 – 6: VO's
Page 217
Chapter IX - Extension
7. The page name is /oracle/apps/pos/supplier/webui/SuppSummPG .
Fig 9 – 7: Page8. Create pos folder under myprojects/oracle/apps. Under pos create supplier
folder. Under supplier folder create webui folder. From server copy SuppSummPG and paste it in your my projects/oracle/apps/pos/supplier/webui folder.
9. Copy oracle folder from the server and paste into the myclasses folder.10. Create a new OA Workspace by right clicking on Application and select new
OA Workspace.
Page 218
Chapter IX - Extension
Fig 9 – 8: New Workspace
Set the name of the workspace as below and click Ok. Make sure that the new OA Project is checked.
Name - CholaVOExt
Page 219
Chapter IX - Extension
Fig 9 – 9: Page Properties
Page 220
Chapter IX - Extension
11. Set the below values for the project:
Name – CholaVOExtPackage – xxcholaext.oracle.apps.pos.supplier
12. Select the DB connection as Chola.Create the Dbconnection if it doesn't already exist.
Fig 9 – 10: Database Properties13. To determine the responsibility associated with the Payables Vision
Operations go to the application and go to System Administrator responsibility and go to Security → Responsibility → Define.
14. Search for the Responsibility Name “Payables, Vision Operations (USA)”.The Responsibility Key is “PAYABLES_OPERATIONS”.
Page 221
Chapter IX - Extension
15. Open the Application Developer responsibility and go to Application → Register.Query for the application Payables.
Fig 9 – 11: Page Properties
16. Set the below values for project:
DBC File – C:\CholaJdev\jdevhome\jdev\dbc_files\secure\VIS.dbcUsername – operationsPassword – welcomeApplication Short Name - SQLAPResponsibility Key - PAYABLES_OPERATIONS
Page 222
Chapter IX - Extension
17. Right click on CholaVOExt and click Add to project content.
Fig 9 – 12: Project Content
Page 223
Chapter IX - Extension
18. Select Oracle->Apps->pos. And the xxcholaext.
Fig 9 – 13: Add Package
Page 224
Chapter IX - Extension
19. Right click on xxcholaext.oracle.apps.pos.supplier.server and click View Object.
Fig 9 – 14: New View Object
20. Set the below values for the VO:
Name – CholaExtSuppSummVOPackage – xxcholaext.oracle.apps.pos.supplier.serverExtends - oracle.apps.pos.supplier.server.SuppSummVO
Page 225
Chapter IX - Extension
Fig 9 – 15: VO Properties21. Use the below query in the SQL Statement window:
VO Query for the Extended VO
select hp.party_name, hp.party_id as party_id, hp.duns_number_c as duns,pv.vendor_id, pv.vendor_name, decode(pv.organization_type_lookup_code,'INDIVIDUAL',pv.individual_1099,'FOREIGN INDIVIDUAL',pv.individual_1099, pv.num_1099) taxpayer_id,pv.vat_registration_num as tax_reg_num, pv.segment1,pv.VENDOR_NAME_ALT as alternate_name, pv.end_date_active as end_date_active,
Page 226
Chapter IX - Extension
pv.start_date_active as start_date_active, pv.ONE_TIME_FLAG, pv.VENDOR_TYPE_LOOKUP_CODE, pv.PARENT_VENDOR_ID, parent.vendor_name as parent_vendor_name, pv.PAYMENT_PRIORITY,parent.segment1 as parent_Segment1,pv.TAX_REPORTING_NAME,pv.terms_id,terms.name as terms_desc,pv.FEDERAL_REPORTABLE_FLAG,pv.STATE_REPORTABLE_FLAG,pv.PAY_GROUP_LOOKUP_CODE,pay_group.description as pay_group_desc,aptt.description as income_tax_type,hp.organization_name_phonetic,plc.DISPLAYED_FIELD as VENDOR_TYPE_DISPLAY,pv.type_1099 as income_tax_type_code,pv.employee_id as employee_id,hp.party_id as ext_party_idfrom hz_parties hp, ap_suppliers pv, ap_suppliers parent,ap_terms_tl terms,fnd_lookup_values pay_group,AP_INCOME_TAX_TYPES aptt,po_lookup_codes plcwhere pv.party_id = hp.party_id and parent.vendor_id (+) = pv.parent_vendor_id and pv.terms_id = terms.term_id (+)and terms.language (+) = userenv('LANG') and terms.enabled_flag (+) ='Y' and pv.pay_group_lookup_code = pay_group.lookup_code (+) and pay_group.lookup_type (+)='PAY GROUP' and pay_group.language (+)=userenv('lang') and pv.type_1099 = aptt.income_tax_type (+) andpv.VENDOR_TYPE_LOOKUP_CODE = plc.LOOKUP_CODE (+) and
Page 227
Chapter IX - Extension
plc.lookup_type (+) = 'VENDOR TYPE'
Code Listing 9- 1 : SQL Query22. Click Next and then Finish.
23. Right click on CholaExtVO project and click Project Properties.
Page 228
Chapter IX - Extension
24. Click Business Components-> Substitution.
25. In the Available select oracle.apps.pos.supplier.server.SuppSummVO.In the Substitute select xxcholaext.oracle.apps.pos.supplier.server.CholaExtSuppSummVO.
Fig 9 – 16: Substitution
Page 229
Chapter IX - Extension
26. In the Project properties go to Run/Debug. Click Edit.
Fig 9 – 17: Run/Debug Properties
Page 230
Chapter IX - Extension
27. In the Java options at the last add a space and then paste the below:-Djbo.project=CholaVOExt
Fig 9 – 18: Edit Properties
28. Select the SuppSummPG and in the structure pane go to the ResultsRN and add a new attribute in the table.
ID – ExtPartyIdView Instance – SuppSummVOView Attribute – ExtPartyIdPrompt - Extended Party Id
29. Save and Run the page,30. We do this step just for testing purpose from Jdeveloper without affecting the
application.
Page 231
Chapter IX - Extension
31. Query for a record and you will see an extra column names Extended Party Id.
Fig 9 – 19: Output
Page 232
Chapter IX - Extension
CO Extension
First step in doing the CO Extension is to find the Controller associated with the Page. Let's see the steps involved in doing the CO Extension.
1. Go to Payables Vision Operations USA responsibility and click on Entry.
2. Click on About This Page link at the bottom of the page.
3. Click on Business Component References Objects.
4. The controller associated with the page will be displayed.
Fig 9 – 20: Controller5. Since we had already copied the entire pos folder we don't have to copy the
files again into our myprojects folder.
6. Right click on xxcholaext.oracle.apps.fnd.pos.webui and click New. In the Simple Files select Java Class.
7. Enter the below values:
Name – ExtSuppSummCOPackage - xxcholaext.oracle.apps.fnd.pos.webui Extends - oracle.apps.fnd.pos.webui.SuppSummCO
Page 233
Chapter IX - Extension
Fig 9 – 21: New Class
Page 234
Chapter IX - Extension
8. Use the below code in the file:
Import Statements:import oracle.apps.fnd.framework.webui.OAPageContext;import oracle.apps.fnd.framework.webui.beans.OAWebBean;import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;import oracle.apps.pos.supplier.webui.SuppSummCO;import oracle.cabo.style.CSSStyle;
public CSSStyle cellUpperCase; public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); cellUpperCase = new CSSStyle(); cellUpperCase.setProperty("text-transform","uppercase"); OAMessageTextInputBean msgbean=(OAMessageTextInputBean)webBean.findChildRecursive("SearchSuppName"); if (msgbean != null) msgbean.setInlineStyle(cellUpperCase); }
Code Listing 9- 2 : Process Request Code
9. Run the SuppSummPG and click on Personalize Page.We need to change the controller and set the new controller to the Page.Click on Personalize next to Page Layout : Suppliers.
Page 235
Chapter IX - Extension
Fig 9 – 22: Personalize
10. In the Controller Class set the new controller. Set the value as xxcholaext.oracle.apps.pos.supplier.webui.ExtSuppSummCO
11. Click Apply.
12. In the search enter value for Supplier Name you will notice that the values entered will be in upper case.
Fig 9 – 23: Output
Page 236
Chapter IX - Extension
EO Extension
1. Login to the application as Operations user.
2. Click on Functional Developer responsibility.
3. Click on Core Services → Profiles.
Fig 9 – 24: Profiles4. Click on Create Profile Button.
5. Click on About This page at the left hand corner.
6. Click on Business Component References Details to view the BC4J object associated with the page.
7. You will notice that the EO associated with the page is FndProfileEO.
Page 237
Chapter IX - Extension
Fig 9 – 25: EO8. We will extend this EO.
9. Go to the server backend and copy the asn folder under oracle.apps to the myclasses.oracle.apps folder.
10. Create the a new folder with name fnd under oracle.apps folder in myprojects. Under fnd create lead and under messages create webui folder.
11. Right click and select New → ADF Business Components → Entity Object.
12. Set the below properties
Name – ExtFndProfileEOPackage – xxcholaext.oracle.apps.fnd.schema.profile.serverExtends – oracle.apps.fnd.schema.profile.server.FndProfileEO
Page 238
Chapter IX - Extension
Fig 9 – 26: New Entity Object
13. Click Next.Click New from Table and shuttle all the attributes to the right side except the RowId .
14. Click Next and check only the create method since we are not going to write any code in the other methods.
Fig 9 – 27: Java Methods15. Click Finish.
16. The Page associated is FndProfileCreatePG.
17. Copy the FndProfileCreatePG from mds repository /d01/oracle/VIS/apps/apps_st/appl/fnd/12.0.0/mds/messages/webui and paste
Page 239
Chapter IX - Extension
in the xxcholaext.oracle.apps.fnd.messages.webui folder.
18. Open Jdeveloper and you will see the page.
Page 240
Chapter IX - Extension
19. In the below code in setStartDateActive in FndMessageEOImpl use the below code:
Date startDate = getStartDateActive(); OADBTransaction txn=(OADBTransaction)getOADBTransaction(); Date endDate=(Date)txn.getCurrentDBDate(); if (endDate != null) { long endDateLong = endDate.dateValue().getTime(); if (endDateLong < startDate.dateValue().getTime()) { throw new OARowValException(OARowValException.TYP_ENTITY_OBJECT, getEntityDef().getFullName(), getPrimaryKey(), "AK", // Message product short name "FWK_TBX_T_START_END_BAD"); // Message name } }
Code Listing 9- 3 : FndMessageEOImpl Code
20. Right click on CholaExtVO project and click Project Properties.
21. Click Business Components-> Substitution.
22. In the Available select oracle.apps.fnd.schema.profile.server.FndProfileEO.
23. In the substitute select xxcholaext.oracle.apps.fnd.schema.profile.server.FndProfileEO.
24.Save your work and Run the FndProfileCreatePG.
25. Select the Start Date before the current date and click Apply.
26.An error message will be displayed next to the date.
Page 241
Chapter IX - Extension
Deploying the VO Substitution
After performing the extension you need to deploy the substitution to the mds for the changes to take effect in the application.
1. Copy the jpx file to the server. jpx is the file that gets updated with the substitution entry when we create the substitution. Before you copy the file verify your substitution definition inside the jpx file. The jpx file should look like below:
Fig 9 – 28 : JPX File
2. Copy the CholaVOExt.jpx file to the $JAVA_TOP.
3. Execute the below command to deploy the CholaVOExt.jpx which will create a site level personalization document in the mds.
java oracle.jrad.tools.xml.importer.JPXImporter $JAVA_TOP/CholaVOExt.jpx
-username APPS -password apps -dbconnection "(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=<host name>)(PORT=<port number>))
(CONNECT_DATA= (SID=<SID>) ) )"
Code Listing 9 - 4 : JPX Importer Command
Page 242
Chapter IX - Extension
4. Use the below command to view the personalization document definition created through jpx importer.
begin
jdr_utils.printDocument('/oracle/apps/pos/supplier/server/customizations/site/0/Sup
pSummVO')
end;
Code Listing 9 - 5 : jdr Utils Command
Now use the personalization to expose the new column to the supplier search table by associating the newly created attribute by VO Extension.
Navigate to Functional Administrator responsibility. Click on Personalization tab.
Fig 9 – 29 : Personalization Document
Verify that Site level is checked and click Apply.
Page 243
Chapter IX - Extension
Fig 9 – 30 : Personalization Document
Click on Complete View and then Expand All.Click on Create Item icon next to the Supplier Table.
Fig 9 – 31 : Personalize Page
Page 244
Chapter IX - Extension
Set the below properties:
ID – CholaExtPartyIDPrompt – Extended Party IdView Instance – SuppSummVO1View Attribute - ExtPartyId
Fig 9 – 32 : Add new Field
Page 245
Chapter IX - Extension
Fig 9 – 33 : Add new Field
Page 246
Chapter IX - Extension
Final Output:
Fig 9 – 34 : Output
Page 247
Chapter IX - Extension
Personalization
Personalization refers to the ability to declaratively alter the UI to suit user or business needs. Personalization is the quickest and easiest way of altering the OAF UI, changes are protected from future upgrades. If you have any requirement to alter the OAF UI, personalization should be your first stop.
Now lets see how to add an attachment to the results table of the Supplier page.
1. Login with operations user to the application.
2. Before starting with Personalization we need to enable personalization. Go to Functional Administrator responsibility and click on Core Services → Profile.
3. Search for “pers%self% and Click on Update.
Fig 9 – 35: Set profile value
Page 248
Chapter IX - Extension
4. Set the profile value to Yes.
Fig 9 – 36: Set Value5. Logout and login to the application again.
6. You will notice Personalize Page link at the top right corner.
7. Go to Payables Vision Operations USA responsibility and click on Entry function.
Fig 9 – 37: Function8. In the results table we will be adding a new column where attachments can
be added.
9. Click On Personalize Page.
Page 249
Chapter IX - Extension
10. Click on the Create Item button next to Suppliers Table.
Fig 9 – 38: Create Item11. Set the below properties
Level – SiteItem Style – Attachment ImageID – Attach View Instance – SuppSummVO1
Fig 9 – 39: New Item
Page 250
Chapter IX - Extension
12. Click Apply.
13. Click on Create Item button next to the entityMappings.
Fig 9 – 40: Create Entity Mappings14. Set the below values:
Id – EntityMapEntity - CholaEntity
Fig 9 – 41: Entity Map Values
Page 251
Chapter IX - Extension
Click Apply.15. Click Create Item next to the primaryKeys.
Page 252
Chapter IX - Extension
16. Set the below values:
Id – PrimaryKey
Fig 9 – 42: PrimaryKey17. Click Apply and click on Return to Application at the end of the page in the
left side.
18. Click go and you will see a Attachment column in the results table.
Page 253
Chapter IX - Extension
Fig 9 – 43: Output
Page 254
Chapter IX - Extension
Summary:In the Chapter IX we covered the below topics:
• Extension
◦ VO Extension
◦ CO Extension
◦ EO Extension
• Personalization
Page 255
Chapter IX - Extension
CHAPTER
10Debugging
Page 256
Debugging OA Framework Page
Debugging OA Framework Page
1. The first step in debugging any OAF Page is to put breakpoints in the code where you think might be a problem. For putting breakpoints click on the outer side of the code where you need to set the breakpoint.
2. Let us take the Create Employee ie. EmployeeManagerPG. In the ResultsAdvTableCO whenever the user clicks on Add Another Row you want to check what is happening. So we set a breakpoint on the if condition.
Fig 10 – 1 : Breakpoints3. Then in the CholaAdvAMImpl.java set another breakpoint in the
CreateEmployee code.
Fig 10 – 2 : Breakpoints
Page 257
Debugging OA Framework Page
4. Right click on EmployeeManagerPG and click on Debug.
5. Click on Add Another Row and you will notice that the control will go Jdeveloper code (ResultsAdvTableCO)
Fig 10 – 3 : Output
6. Click on Step Over to go to the next step.
7. The control will go to the next step in the code. Then click Step out. Enter values in the rows and click Apply.
8. The control will go to the next breakpoint.
Page 258
Debugging OA Framework Page
Appendix A – Database Scripts
Emp Table Script :
CREATE TABLE EMP ( EMPNO NUMBER(4,0) ,
ENAME VARCHAR2(10), JOB VARCHAR2(9 ), MGR NUMBER(4,0),
HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2,0), LAST_UPDATE_DATE DATE, LAST_UPDATED_BY NUMBER, CREATION_DATE DATE, CREATED_BY NUMBER, CHARGE_TYPE VARCHAR2(30 ), LAST_UPDATE_LOGIN NUMBER, ADDRESS1 VARCHAR2(50 ), CITY VARCHAR2(50 ), STATE VARCHAR2(50 ), COUNTRY VARCHAR2(50 )
);
Dept Table Script:
CREATE TABLE DEPT ( DEPTNO NUMBER(2,0), DNAME VARCHAR2(14 BYTE),
LOC VARCHAR2(13 BYTE), LAST_UPDATE_DATE DATE, LAST_UPDATED_BY NUMBER, CREATION_DATE DATE, CREATED_BY NUMBER, LAST_UPDATE_LOGIN NUMBER
);
Page 259
Debugging OA Framework Page
Emp No Sequence Script:
CREATE SEQUENCE EMPLOYEES_S MINVALUE 1 INCREMENT BY 1 START WITH 100 ;
Dept No Sequence Script :
CREATE SEQUENCE DEPARTMENT_S MINVALUE 1 INCREMENT BY 1 START WITH 100;
Page 260
Debugging OA Framework Page
Appendix B
Creating Attribute Sets:
Attribute Sets are nothing but a collection of properties. Lets take for example the Emp Name in our EMP table. The basic properties that needs to be set for the Emp Name attribute is Prompt, Max Length, Length and CSS. The main advantage of the attribute set is that we don't need to go and set each and every property for Emp Name. A single property will set all the above mentioned property( Attribute Set property).
Let us see the steps in creating the Attribute Set.
1. Right click on the project and click new → Web Tier → OA Components → Package File
2. Set the below properties
Name – AttributeSetsPackage - xxcholas.oracle.apps.fnd.attributesets.emp
Page 261
Debugging OA Framework Page
Page 262
Debugging OA Framework Page
3. Click on the AttributeSets.xml file and in the structure pane right click on AttributeSets and then click New → Attribute Set.
4. Set the name as Ename and shuttle the following properties to the right side.
1. CSS Class
2. Length
3. Maximum Length
4. Prompt
Page 263
Debugging OA Framework Page
5. Then set the properties for the Ename.
Maximum Length – 40Length – 20Prompt – NameCSS Class - OraDataText
Page 264
Debugging OA Framework Page
Creating Look Ups:
Country Lookup:
1. Login to the application as sysadmin/sysadmin.
2. Go to Functional Administrator responsibility.
3. Go to Core Services → Loopups.
4. Click on Create Lookup Type button.
5. Enter the below values for creating the Country Lookup:
Name - Chola Country Code – CHOLA_COUNTRYApplication Name - Application Object Library
6. In the Lookup Codes enter the below values:
Code – IND Description – India
Page 265
Debugging OA Framework Page
7. Similarly you can add as many countries you want by clicking on Add Another Row.
Page 266
Debugging OA Framework Page
State Lookup:
1. Click on Create Lookup Type and enter the below values:
Name - Chola State Code – CHOLA_STATEApplication Name - Application Object Library
Page 267
Debugging OA Framework Page
2. In the Lookup Codes enter the below values:
Code – TN Description – Tamil NaduTag - IND
3. We are using the Tag column here in order to differentiate the states according to the Country.
4. Similarly you can as multiple states with Tag as their Country and Click Apply.
Page 268
Debugging OA Framework Page
City Look up:
5. Click on Create Look up Type and enter the below values
Name - Chola City Code – CHOLA_CITYApplication Name - Application Object Library
6. In the Codes section enter the below values
Code – CHNDescription – Chennai Tag - TN
7. The tag field will be used to identify the state of the City.
8. Similarly multiple cities can be added by clicking on Add Another Row.
Page 269
Debugging OA Framework Page
Page 270
Interview Questions
Interview Questions1. What is BC4J and what are all the components of BC4J?
Business Components for Java is JDeveloper's programming framework for building multitier database applications from reusable business components. Such applications typically consist of:
• A client-side user interface written in Java and/o HTML. • One or more business logic tier components that provide business logic
and views of business objects. • Tables on the database server that store the underlying data.
Components of BC4J:• Entity Object - EO encapsulates the business logic and rules.EO’s are used
for Inserting,Updating and Deleting data. This is used for validating across the applications.
• View Object - View object encapsulates the database query. It is used for selecting data. It provides iteration over a query result set.VO’s are primarily based on Eo’s. It can be used on multiple EO’s if the UI is for update.
• Application Module - Application Modules serve as a containers for related BC4J components. The pages are related by participating in the same task. It also defines the logical data model and business methods needed.
2. What is an EO?
EO encapsulates the business logic and rules.EO’s are used for Inserting,Updating and Deleting data. This is used for validating across the applications. We can also link to other EO’s and create a Association object.
3. What is an VO?
View object encapsulates the database query. It is used for selecting data. It provides iteration over a query result set.VO’s are primarily based on Eo’s. It can be used on multiple EO’s if the UI is for update. It provides a single point of contact for getting and setting entity object values. It can be linked together to form View Links.
Page 271
Interview Questions
4. What is an AO?
An association object is created where we link EO’s. For example take the search page where we link the same EO to form a association between the manager and employee. Every employee should have a manager associated. But if it President then no there is no manager associated. This is a perfect example to understand the AO.
5. What is an VL?
A view link is an active link between view links. A view link can be created by providing the source and destination views and source and destination attributes. There are two modes of View link operation that can be performed. A document and Master/Detail operation.
6. What is UIX?
UIX is an extensible, J2EE-based framework for building web applications. It is based on the Model-View-Controller (MVC) design pattern, which provides the foundation for building scalable enterprise web applications.
7. What is MVC Architecture?
MVC Architecture is a Model View Controller Architecture. The controller responds to user actions and directs application flow. The model encapsulates underlying data and business logic of the application. The view formats and presents data from a model to the user.
8. Which is the MVC layer VO located?
VO is located in the View Layer which is responsible for presenting the data to the user.
Page 272
Interview Questions
9. Which package should include EO and AO.
The EO and AO will be present in the schema.server package.
10. What is the difference between inline lov and external lov.
Inline lov is a lov which is used only for that particular page for which it was created and cannot be used by any other page.
External lov is a common lov which can be used by any page. It is a common component for any page to use it. It can be used by giving the full path of the lov in the properties section “External LOV” of the item.
11. What is a Javabean?
JavaBeans is an object-oriented programming interface that lets you build re-useable applications or program building blocks called components that can be deployed in a network on any major operating system platform.
12. What is query Bean?
QueryBean is used to execute and return the results of a query on behalf of the QueryPortlet application.
13. What is the difference between autocustomization criteria and result based search?
Results based search generates search items automatically based on the columns on the results table.In Autocustomization search we need to set what all fields are required to display as a search criteria.
Page 273
Interview Questions
14. What is MDS?
MDS is MetaData Service. When a web page is broken into small units like buttons,fields etc they are stored in a database. These are not stored as binary files but as data in tables. The data are present in JDR tables. MDS provides service to store & return page definitions. MDS collects those definitions in components/fields in a meaningful manner to build a page.
15. What is XML?
XML is a markup language for documents containing structured information.Structured information contains both content (words, pictures, etc.) and some indication of what role that content plays (for example, content in a section heading has a different meaning from content in a footnote, which means something different than content in a figure caption or content in a database table, etc.).
16. What is the difference between customization and extension?
Customization is under direct user control. The user explicitly selects between certain options. Some customization examples include:
Altering the functionality of an applicationAltering existing UIAltering existing business logic
Extension is about extending the functionality of an application beyond what can be done through personalization. Some extensibility examples include:
Add new functional flowsExtend or override existing business logicNew application/moduleNew pageNew attributeExtend/Override defaults & validations
Page 274
Interview Questions
17. What is Personalization?
Personalization enables you to declaratively tailor the UI look-and-feel, layout or visibility of page content to suit a business need or a user preference. Some personalization examples include: • Tailor the order in which table columns are displayed. • Tailor a query result.• Tailor the color scheme of the UI.• Folder Forms• Forms Personalization• Oracle Application Framework (OAF)
18. What is rootAM?
The application module which is associated with the top-level page region (the pageLayout region) is root application module.
19. Why Should we give retainAM=Y?
The AM should be retained whenever you are navigating away from a page and when you know that there is a possibility to come back to the page again and data is to be retained. Example : Any navigation link that opens in a new page or any navigation which has a back button to come back to the initial page. The AM should not be retained for two independent pages, especially if they have common VOs which fetch different result sets. In such cases, retaining the AM may not remove the cache of VOs and so the result may not be as expected.
20. What is the significance of addBreadCrumb=Y?
The basic intention of the breadcrumb is to let the user know of the navigation path he took to reach the current page.
Page 275
Interview Questions
21. How do you find right jdev patch for your oracle application version?
Search in oracle.metalink.com as Jdev with OA Extension.
22. What are the tools you had used for decompiling java class?
JAD is one of the tool for decompiling the java class.
23. What will setmaxFetchSize(0) will do?
setmaxFetchSize just determines how much data to be sent at a time.When you execute the query after setting the setmaxFetchSize(0),no rows will be fetched to the middle tier.
24. Can we use dynamically created VO in OAF?What is the pros and cons?
Yes we can.But as far as possible try to create the VO during the design time due to performance consideration.
25. What is advanced table in table?
Advanced Table offers lot of flexibility to the developers by providing following functionalities.1) Multi Select.2) Select,Create,Update and Delete on the same page itself.3) You can group Columns in the table.
Page 276
Interview Questions
26. What is a HGrid?
A HGrid, otherwise known as a hierarchy grid, allows users to browse through complex sets of hierarchical data.
27. Tell me the OAF components required for a simple search page?
Atleast VO,AM and Page.
28. What is a switcher in OAF and when it is used?
A switcher is a control, that allows the selective display of information.For example if you want to display a image for update enabled and update disabled you can use switcher.
29. What are all the methods in CO?
processForRequest
processRequest
processFormData
30. When a page renders which method in CO fires?
processRequest
31. How do you handle back button navigation in OAF based application?
Using Transaction Unit and isBackNavigationFired in processRequest
32. Where will you write your business logic?
Model Layer(BC4J)
Page 277
Interview Questions
33. What will vo.createRow() do?
createRow creates a empty row instance in the VO and EO.
34. How do you catch the button event on ProcessFormRequest Method?
If ("update1".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
Here update1 is the event.
35. What is pageButton bar?
When you want to display buttons on top and bottom of the page then you create a region as pageButtonbar and create buttons within this region.
36. How do you add a link to OAF Page?
Create a new item with style as link and give its destination uri property which is the url where you want to navigate to.
37. Which is the top most region in OAF page?
PageLayoutRN
38. How do you enable custom footer in OAF page?
Set AutoFooter To True and then click on pageComponents Layout to Create a Custom Footer
39. What are all the several ways to debug an OAF based application?
We can use the debugger option .Set breakpoints and run the page in debug mode.
Page 278
Interview Questions
40. How do you call an pl/sql api from OAF page.
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
41. Should a search page have an EO?
Not necessary. If you are creating a record then we need a EO.
42. How do you get the current url for forward?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
43. What will happen when you set DisableClientSideValidation property to True?
If you set the property to True it shows that there will no validation that will occur on the web tier as part of the form submit.
44. What is SPEL?
It is an Simple expression that will can return the current VO attribute Values.
45. Where is a SPEL used?
SPEL is used in places where you want to show or hide an item programatically.It can also be used to get the Function Security and VO attribute values.
46. What is PPR?
PPR is Partial Page rendering. Which means that only a particular part of the page is refreshed and not the entire page.
Page 279
Interview Questions
47. Examples of PPR scenarios?
Hiding/Showing Objects
Required/Optional
Disabled/Enabled
Read only/Updatable
48. What is the procedure to add new viewattribute in a sql based VO?
Add the attribute to the last in list of the select statement or else your attribute mapping will go for a toss.
49. How do you raise an exception in OAF?
throw new OAException("Error with reading BlobDomain.", OAException.ERROR);
50. How do you generate stack of exception and display the list of error messages in OAF page?
ArrayList exceptions = new ArrayList();
exceptions.add(new OAException("Start Date Should be Greater Than Sysdate")); exceptions.add(new OAException("Start Date Should be Less Than End Date")); OAException.raiseBundledOAException(exceptions);
51. What is the significance of ProcessFormData method?
Fires when post action happens on the page
52. Describe the steps for VO Extension?
Read through the extension section of this book.
Page 280
Interview Questions
53. How do we set the context in AM?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
54. How do we implement a popup page in OAF?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
55. How do we set design time hint to a VO?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
56. How to enable personalization?
1.Login to the application.2.Click on Functional Administrator responsibility.3.Click on Core Services Tab.4.Click on Profiles.5.Enter Pers%Self% in Name and click Go.6.In the results you will see Personalize Self-Service Defn. Update it and enter Yes in the Site Value
57. When we should bounce the page?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
58. How do we set an OAF Home page?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
Page 281
Interview Questions
59. How do we add Custom region to existing OAF page?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
60. How do we compile a java files under subdirectories at once?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
61. What is the command used to import an oaf page and region?
java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/ -username <>-password <>-dbconnection "(DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1558)) (CONNECT_DATA= (SID=<>) ) )" -rootdir . ;
62. Where to locate the definition of standard OAF Pages and regions?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
63. How to automate the deployment process of OAF application?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
64. How to add dff to a custom oaf page?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
Page 282
Interview Questions
65. How do you upload an file to database from an OAF page?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
66. How do you display thumbnail images in OAF?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
67. What is the use of rawText bean?
Raw Text bean item is used to embed html content in a page.
68. How to set the CSS class property of an item programatically?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
69. Can a page have multiple COs and AMs?
Yes.
70. How to change the lovvo dynamically for an LOV?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
71. What is Passivation?
Passivation is the process of saving application state to a secondary medium (the database) at specific event points so it can be restored (activated) when needed.
72. How do you iterate throw the VO rows?
Left out for your Answer. Contact me at asksudhakar.com if you need
Page 283
Interview Questions
answer from me.
73. How do you get the value from the database sequence?
OADBTransaction transaction = getOADBTransaction();Number employeeId = transaction.getSequenceValue("SEQ Name");setEmployeeId(employeeId);
74. How do you perform your validation in OAF?
All OAF validations are done in the BC4J Layer.
75. How do you copy rows from one vo to another?
To copy multiple rows you can add the multipleSelection item for the table. Check which row is selected and write code for implementing this.
76. What is a transaction unit in OAF?
With the transaction unit identifier, you can indicate when a specific UI task begins and ends, and if the user navigates in an unexpected manner such as using the browser Back button. You can check the transaction unit status and react to ensure that inappropriate actions are not performed and unwanted data in the BC4J cache is not committed.
77. How to implement a dependent poplist?
Dependent poplist can be implemented by enabling firePartialAction and capturing the event for the source poplist and passing the value selected in the source to the method where we set the where clause and execute the query for the destination poplist.
78. How do you implement dependent LOV?
Dependent LOV can be implemented by setting the criteria item in the lov map to the item to which the value of lov should depend on.
79. How to add attachment functionality to the standard OAF page?
Page 284
Interview Questions
Attachments can be added to a simple table or Advanced table by including an item of type attachmentImage. It will automatically create a new entityMap1 and PrimaryKey1. Set the Entity as any unique value.
80. How do you set a default value for an item programatically in a standard OAF page?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
81. How do you migrate personalization from one instance to another?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
82. What is the diff between setforwardurl and setforwardimmediately?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
83. Can we extend rootAM?
No,All BC4J substuitions are stored as a personalization document and rootAM gets initialized before the personalizations are applied during the runtime.
84. How do we pass parameters between pages?
pageContext.forwardImmediately("OA.jsp?page=/xxch/oracle/apps/fnd/test/webui/DetailsPG&fname="+fname.
Here fname is the variable we are passing to the DetailsPG.
85. How do you import csv file into a OAF table region?
Left out for your Answer. Contact me at asksudhakar.com if you need
Page 285
Interview Questions
answer from me.
86. Steps to implement Export button?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
87. How do we display XML Publisher report from OAF page?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
88. How do we perform BC4J substitution?
Right click on the project and go to Substitution tab. VO and EO substitution can be made by choosing the available EO/VO and the substitute EO/VO.
89. Will patching erase custom extensions?
No
90. How do you do onscreen debugging of an OAF page?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
91. What are all the know issues in OAF?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
92. How do I pass different kinds of parameters together to AM method from CO(Like Boolean,String,Number)?
Left out for your Answer. Contact me at asksudhakar.com if you need
Page 286
Interview Questions
answer from me.
93. What is serializable?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
94. In which layer of BC4J,VAM and VVO's are included?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
95. How do we synchronize a EO and Table in the database?
Right click on the EO and click Synchronize.
96. Steps for implementing a three frame JSP?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
97. How to set currency formatting in an OAF advance table region?
Left out for your Answer. Contact me at asksudhakar.com if you need answer from me.
Page 287
Debugging OA Framework Page
Glossary
BC4J
Business Components For Java is JDeveloper's programming framework for building multi-tier database applications from reusable business components. Such applications typically consist of:
• A client-side user interface written in Java and/or HTML. • One or more business logic tier components that provide business
logic and views of business objects. • Tables on the database server that store the underlying data.
A multi-tier application built with the Business Components for Java framework deploys views, business rules, and custom code in components that clients can share. With the Business Components for Java framework, such components are easy to build and maintain, easy to use and reuse, and easy to customize. Components do not need modification to be deployed to any supported platform.
AM
An application module is a logical container for instances of view objects, view links, and transactions specified by other application modules.
VO
View objects use SQL queries to specify filtered subsets of attributes from entity objects. Clients manipulate data by navigating through the result set, getting and setting attribute values. Relationships between view objects are expressed using view links.
EO
An entity object encapsulates business logic for a database table, view or synonym. Clients access an entity object's data through one or more view objects. A given entity object can be used by any number of view objects. Relationships between entity objects are expressed using associations.
SPEL
SPEL is nothing but Simplest Possible Execution Language
IDE
Page 288
Debugging OA Framework Page
Integrated Development Environment. Jdeveloper is the IDE to be used for OA Framework development.
Page 289
Debugging OA Framework Page
Join the world's smartest OA Framework community at
http://oraclearea51.com and http://oralinked.com
All our books are available at the below link.
http://cholagls.com/books/oracle-books
Request for free support to complete the labs on this book at below link.
http://oraclearea51.com/forums.html
Need full fledged oracle training?Have a look at our recipe here.
http://cholagls.com/training-
Page 290