22a. Creating OAF Search Page

 

How to Create a Search Page in Oracle Application Framework (OAF)

Introduction

A Search Page in Oracle Application Framework (OAF) allows users to search for and view data from the database within an Oracle E-Business Suite application. It is one of the most common and fundamental page types in OAF development.

A typical search page consists of:

  1. Search Criteria Region: Fields where users enter search parameters

  2. Go Button: Executes the search query

  3. Results Table: Displays the matching records

  4. Action Icons: Update and Delete icons for each result row (added in separate guides)

This guide walks you through the complete process of creating a search page in OAF, from setting up the workspace to creating the required OAF objects.

Note: This topic is lengthy, so it is split into two parts:

  • Part 1 (this article): Creating the workspace, project, Entity Object, and View Object

  • Part 2: Creating the Application Module, OAF Page, Regions, Items, and Controller


Required OAF Objects for a Search Page

To create a search page in OAF, you need the following objects:

#ObjectFull NamePurpose
1EOEntity ObjectHandles business rules and DML operations (required if the page supports update/delete)
2VOView ObjectProvides data access and query capabilities
3AMApplication ModuleContainer that manages access to the BC4J model objects
4COControllerHandles user interactions and application flow
5PGOAF PageThe user interface component

Important: If the search page is read-only (no update or delete), an Entity Object is not strictly required. However, for a search page that will later support update and delete operations, the EO is essential.


Prerequisites

Before you begin, ensure the following:

  • Oracle JDeveloper is installed and configured with a valid Runtime Connection

  • Database Connection is established

  • You have an EBS user account with the necessary responsibilities

  • The database table (e.g., XX_SUPPLIER_MASTER) exists in the database


Step 1: Create a New Workspace

  1. Start the Workspace Wizard:

    • Right-click on Applications in the Application Navigator

    • Select New OA Workspace

  2. Name the Workspace:

    • Enter the workspace name: RohitSearchPage

    • Click OK


Step 2: Configure the Project

  1. Project Wizard:

    • The Project Wizard opens automatically

    • Click Next to proceed

  2. Enter Project Details:

    • Project Name: RohitSearchPage

    • Default Package: rohit.oracle.apps.fnd.RohitSearchPage

Important: The package name determines the directory structure where Java class files and other project files are stored. The oracle.apps.fnd portion is mandatory for OAF development. The fnd abbreviation represents the Oracle Application short name (you can use other application short names like ak as appropriate).

  1. Enter Runtime Connection Details:

    • Provide your Oracle E-Business Suite Username and Password

    • These are the same credentials you configured during JDev installation

  2. Complete the Wizard:

    • The workspace and project are now created


Step 3: Create the Entity Object (EO)

The Entity Object encapsulates business rules and handles database DML operations. It has a direct relationship with the database table.

  1. Open the New Gallery:

    • Right-click on the project RohitSearchPage

    • Select New

  2. Select Entity Object:

    • Navigate to Business Tier → ADF Business Components

    • Select Entity Object

    • Click OK

  3. Configure the Entity Object:

    • Entity Object Name: SupplierEO

    • Default Package: rohit.oracle.apps.fnd.RohitSearchPage.server

    • Schema Object: XX_SUPPLIER_MASTER (your table name)

Note: Entity Objects are always created under the server directory of the project, following OAF standards.

  1. Complete the Wizard:

    • Click Next, then click Finish

    • The Entity Object is now created

Note: The EO is required if the search page will support update or delete operations. For a purely read-only page, you can skip this step and base the View Object directly on a SQL query.


Step 4: Create the View Object (VO)

The View Object provides data access and query capabilities. It can be based on an Entity Object or on an independent SQL query.

  1. Open the New Gallery:

    • Right-click on the project RohitSearchPage

    • Select New

  2. Select View Object:

    • Navigate to Business Tier → ADF Business Components

    • Select View Object

    • Click OK

  3. Configure the View Object:

    • View Object Name: SupplierVO

    • Default Package: rohit.oracle.apps.fnd.RohitSearchPage.server

  4. Select the Entity Object:

    • At Step 2 of the wizard, select SupplierEO from the left-hand side

    • Shuttle SupplierEO to the right-hand side

    • Click Next

  5. Define the Query:

    • At Step 5 (Query), review or modify the SQL query. For example:

      sql
      SELECT SUPPLIER_ID, SUPPLIER_NAME, SUPPLIER_SITE, CONTACT_PERSON
      FROM XX_SUPPLIER_MASTER
    • Continue through the wizard and click Finish

  6. Complete the Wizard:

    • The View Object is now created

Note: When a VO is based on an EO, the VO inherits the EO's business rules and can participate in DML operations. This is essential if the search page will support update or delete.


Understanding the Object Relationships

The following diagram illustrates how the objects created in Part 1 relate to each other:

text
┌─────────────────────────────────────────────────────────────┐
│                    DATABASE TABLE                           │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  XX_SUPPLIER_MASTER                                 │   │
│  │  (SUPPLIER_ID, SUPPLIER_NAME, SUPPLIER_SITE, ...)   │   │
│  └─────────────────────────────────────────────────────┘   │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│                    ENTITY OBJECT                            │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  SupplierEO                                         │   │
│  │  (Encapsulates business rules, handles DML)         │   │
│  └─────────────────────────────────────────────────────┘   │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│                    VIEW OBJECT                              │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  SupplierVO                                         │   │
│  │  (Based on SupplierEO, provides data access)        │   │
│  └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

Object Roles

ObjectRoleRelationship
Entity ObjectBusiness rules and DMLDirect link to database table
View ObjectData access and queriesBased on Entity Object
Application ModuleContainer and access managerContains View Object (created in Part 2)

Directory Structure Overview

After completing Part 1, your project will have the following structure:

text
RohitSearchPage/
├── server/
│   ├── SupplierEO.xml (Entity Object)
│   └── SupplierVO.xml (View Object)
└── (webui/, AM, and page will be created in Part 2)

Note: The server directory contains all server-side business logic components. The webui directory (created in Part 2) will contain the user interface components.


Best Practices

PracticeDescription
Use EO for DMLIf the page will support update/delete, always base the VO on an EO
Follow Naming ConventionsUse consistent naming (EO, VO, AM suffixes)
Use Meaningful NamesName objects descriptively (e.g., SupplierEO, SupplierVO)
Optimize QueriesEnsure VO queries are efficient and return only necessary columns
Test Database ConnectivityVerify the table exists and is accessible
Keep Objects OrganizedUse the server directory for model objects

Troubleshooting Common Issues

IssuePossible CauseSolution
EO creation failsTable doesn't existVerify the table name and schema
VO doesn't show EOEO not selectedShuttle the EO to the right side in the wizard
Package name errorMissing oracle.apps.fndEnsure package includes the required prefix
Schema object not foundWrong table nameVerify the table name in the database
Connection errorInvalid credentialsVerify EBS username and password
Query returns no dataWrong table or columnsTest the SQL query directly in the database

What's Next (Part 2)

Now that you have created the foundational objects, Part 2 of this guide will cover:

  1. Creating the Application Module: The container for the View Object

  2. Creating the OAF Page: The user interface component

  3. Creating the Search Region: Fields for search criteria

  4. Creating the Results Table: Displaying search results

  5. Creating the Go Button: Executing the search

  6. Creating the Controller: Handling search events

  7. Implementing the Search Logic: Writing the query filter code

  8. Rebuilding and Running: Compiling and testing the search page


Summary

Creating a search page in OAF begins with the following foundational steps:

  1. Create the Workspace: Set up the development environment

  2. Configure the Project: Use proper package naming conventions

  3. Create the Entity Object: Encapsulates business rules and handles DML (required for update/delete support)

  4. Create the View Object: Based on the EO, provides data access and query capabilities

The Entity Object is the backbone of any page that needs to modify data. By basing the View Object on the EO, the search page can later support update and delete operations. If the page is purely read-only, the EO can be skipped, and the VO can be based on a direct SQL query.

By completing Part 1, you have established the server-side data model for your search page. In Part 2, you will create the user interface (page, regions, items) and the Controller logic that ties everything together.


References

No comments:

Post a Comment