103
ORACLE APPS - FORMS

Oracle Apps - Forms

Embed Size (px)

Citation preview

Page 1: Oracle Apps - Forms

ORACLE APPS - FORMS

Page 2: Oracle Apps - Forms

Agenda

Introduction to Forms Developer - Basics Creating Simple Form ModuleCreating and Managing Menu Modules Forms Builder Messages & Alerts Triggers & Objects & Item Interaction

Triggers

Page 3: Oracle Apps - Forms

Introduction to Oracle Forms Developer - Basics

Page 4: Oracle Apps - Forms

Objectives

• What is Oracle Forms Builder?• Forms in Client/Server Mode• Forms in Web Mode• Form Builder Key Features• Saving User Preferences• How to Start?

Page 5: Oracle Apps - Forms

What is Oracle Forms Builder?

Used to develop - Data Entry Screens - Query Screens

Page 6: Oracle Apps - Forms

Forms in Client/Server Mode

Client Database Server

Net8

2-Tier Architecture

Page 7: Oracle Apps - Forms

Client Database Server

Net8HTTP

Oracle 9i Application Server

Forms in Web Mode

3-Tier Architecture

Page 8: Oracle Apps - Forms

Form Builder Key Features

• Supports GUI Applications• Rapid Application Development Tool• Flexible source control• Extended scalability• Application partitioning• Object reuse• Oracle 10g/11g datatypes support• Improved Developer Productivity

Page 9: Oracle Apps - Forms

User Preferences

• Click on Tools menu- Select Preferences

Page 10: Oracle Apps - Forms

User Preferences cont..

• Click on Tools menu- Select Preferences

User Preferences fileWindows – Cauprefs.oraUnix – Prefs.ora

Page 11: Oracle Apps - Forms

How to Start?

• Start Form Builder• Welcome Page Displays• Connect to the Database by selecting

- File -> connect or use Ctrl+J• Provide Username, Password and Connect String

and click connect.

Page 12: Oracle Apps - Forms

Summary

• Introduction to Form Builder• Forms in Client/Server and Web• Key Features• User Preferences• Starting Form Builder

Page 13: Oracle Apps - Forms

Creating Simple Form Module

Page 14: Oracle Apps - Forms

Objectives

• Creating a Simple Form Module Using wizards• Types of Blocks• Control Block • Discuss properties of Data Block• Creating a Master-Detail Form• Relationship between data blocks

Page 15: Oracle Apps - Forms

Crating a New Form Module

• Use one of the options to create a new form module 1. Use The Data Block Wizard

2. Build a new form manually3. Build a form Based on a Template.

Page 16: Oracle Apps - Forms

Using Wizards..

Use Form Builder Wizards:

• Data Block Wizard: Used to create a data block with a data source.

• Layout Wizard: Used to display the data block items for Presentation.

Page 17: Oracle Apps - Forms

Data Block wizard- Type of data block

Page 18: Oracle Apps - Forms

Data Block wizard- Table or view name

Page 19: Oracle Apps - Forms

Layout wizard- Changing Prompts

Page 20: Oracle Apps - Forms

Layout wizard- Layout Style

Page 21: Oracle Apps - Forms

Layout wizard-Rows Page

Page 22: Oracle Apps - Forms

Data Block Functionality

Once you create a data block with the wizards, Form Builder automatically creates:

• A form module with database functionality including query, insert, update, delete

• A frame object• Items in the data block• A prompt for each item

Page 23: Oracle Apps - Forms

Modifying the Layout

• You can modify the layout after creating the data block by using re-entrant wizards

– Select Tools -> Data block wizard to modify the data block– Select Tools -> Layout wizard to modify the Layout of the form.– Changes can be made manually also.

Page 24: Oracle Apps - Forms

Types of Blocks

Data Block Control Block

- Base Table Block - Non Base Table Block

Page 25: Oracle Apps - Forms

Creating a Control Block

• Select the Data Blocks node and click the Create icon. or Select Navigator—>Create.• Select the “Build a new data block manually” option in the New Data

Block dialog box.

– Invoke the property pallet for the block– Change the name of the block to CONTROL– Set the Database Data block property to No.

Page 26: Oracle Apps - Forms

Data Block Properties

• General• Navigation• Records• Database• Advanced Database• Scrollbar• Font and Color• Character Mode• International

Page 27: Oracle Apps - Forms

Database Properties for Data block

Use properties in the Database group to control:

• Type of block—data block or control block• Query, insert, update, and delete operations on the data block• Data block’s data source type and Name• Query search criteria and sort order• Maximum query time• Maximum number of records fetched

Page 28: Oracle Apps - Forms

Navigation PropertiesORDERS

Order

Next NavigationData Block

SameRecordChangeRecord

PreviousNavigation Block

Page 29: Oracle Apps - Forms

Visual Attributes

• Visual attributes are font, color and pattern properties applied for form and menu objects.

Page 30: Oracle Apps - Forms

Data blocks and Relationships

Master

Detail

Master

Detail

Detail

Detail Detail

Master

Page 31: Oracle Apps - Forms

Data block wizard – Master-Detail Relationship

Page 32: Oracle Apps - Forms

Relation Object

• Relationship object is always created on the master block• Triggers and program units are generated automatically by form

builder• The default name of the relation object is Masterblock_DetailBlock

Page 33: Oracle Apps - Forms

Creating Relation Manually

Page 34: Oracle Apps - Forms

Deletion Behavior

• Non-Isolated (default setting) Prevents the deletion of a master record when associated

detail records exist in the database. • Isolated Allows the master record to be deleted

and does not affect associated detail records in the database.

• Cascading Allows the master record to be deleted and automatically deletes any

associated detail records in the detail block's base table at commit time.

Page 35: Oracle Apps - Forms

Block Coordination

Immediate Deferred

WithAutoQuery

WithoutAutoQuery

Page 36: Oracle Apps - Forms

Text files and Documentation

• Convert a binary file to a text file OR text file to birnary.By Selecting File-> Administration -> Convert.

• Create a text file for a form module for Documentation.By Selecting File->Administration -> Object List Report

.fmb .fmt

Page 37: Oracle Apps - Forms

Summary

• Creating a simple Form module• Types of blocks• Master-Detail Form• Data block relationships • Data block Properties

Page 38: Oracle Apps - Forms

Creating and Managing Menu Modules

Page 39: Oracle Apps - Forms

Objectives

• Identify Menu components• Create, save and attach Menu modules• Modifying properties of Menu items• Creating Popup menu and attaching• Controlling Menus Programmatically• Manage Menu Security

Page 40: Oracle Apps - Forms

Menu Module Components

MainMenu

IndividualMenu

MenuToolbar

MenuItem

Page 41: Oracle Apps - Forms

Default Menu

Action

SaveClear AllPrintPrint SetupExit

Edit

CutCopyPasteEditDisplay List

Block

PreviousNextClear

Field

PreviousNextClearDuplicate

Record

PreviousNextScroll UpScroll DownInsertRemoveLockDuplicate Clear

Query

EnterExecuteCancelLast CriteriaCount HitsFetch Next Set

Help

HelpKeysListDisplay ErrorDebug

Page 42: Oracle Apps - Forms

Menu EditorDisplaymenu

Create Down Create

Right

SwitchOrientation

Menu tabExpanded

menu Collapsedmenu

Page 43: Oracle Apps - Forms

Creating a Menu Module

ObjectNavigator

Menu Editor

Select Tools Menu Editor

Page 44: Oracle Apps - Forms

Menu Module Properties

Main MenuMenu DirectoryMenu FilenameStartup CodeShare Library with Form

Use SecurityModule Roles

Page 45: Oracle Apps - Forms

Menu Item Properties

• Enabled• Label• Menu Item Type• Magic Item• Menu Item Radio

Group • Command Type

• Menu Item Code• Submenu Name• Icon in Menu• Icon Filename

Page 46: Oracle Apps - Forms

Menu Item Types

Separator

Plain

CheckMagic

Radio

Page 47: Oracle Apps - Forms

Magic Items

• About• Undo• Clear• Copy• Cut

• Paste• Help• Quit• Window

Page 48: Oracle Apps - Forms

Menu Item Command Types

Null

Menu

PL/SQL

Plus

Form

Macro

Does not issue a command

Invokes a submenu

Executes a PL/SQL command

Spawns a process to SQL*Plus

Backward compatibility

Backward compatibility

Page 49: Oracle Apps - Forms

Menu Module File Types

Menu module definition: • .mmb (Menu Module Binary)• Stored in files or database tablesMenu module executable:• .mmx (Menu Module Executable) • Stored in filesMenu module text:• .mmt (Menu Module Text)• Stored in files

Page 50: Oracle Apps - Forms

Attaching Menu Module

• Open Form Module PropertyPallet.

• Modify Menu Module Property.• Specify the name of your menu

module.

Page 51: Oracle Apps - Forms

Pop-up Menus

Menu that appears on the screen at thelocation it was invoked• Enables users to

access commonly used functions easily

• Is accessed by pressing the right mouse button (Microsoft Windows and Motif)

Page 52: Oracle Apps - Forms

Using Pop-up Menus

• Pop-up menus are:– Form module objects in the object navigator,

such as alerts or Data Blocks – Built through the Property Palette or

Menu Editor– Associated with items and canvases

with a pop-up menu property

• Pre-Popup-Menu trigger providesdynamic control

Page 53: Oracle Apps - Forms

Writing PL/SQL Code in Menu Triggers

• Similar to PL/SQL code in form triggers• You can share code between a form

module and a menu module by using the following:– Libraries– User-defined triggers– DO_KEY built-in

Page 54: Oracle Apps - Forms

Writing PL/SQL Code in Menu Triggers

• Menu modules generated independently• Restrictions:

– Cannot directly reference values of form objects

– Must use NAME_IN built-in function– Cannot use direct assignment for

form objects– Must use COPY built-in procedure

Page 55: Oracle Apps - Forms

Built-ins Used

• FIND_MENU_ITEM• GET_MENU_ITEM_PROPERTY• SET_MENU_ITEM_PROPERTY• ITEM_ENABLED• MENU_SHOW_KEYS

Page 56: Oracle Apps - Forms

Built-ins Showing and Hiding

REPLACE_MENUCharacter mode built-ins:• HIDE_MENU• SHOW_MENU• MENU_REDISPLAY

Page 57: Oracle Apps - Forms

Managing Menu Security

• Defining security roles• Choosing roles for the menu module• Assigning access to menu items• Setting the Use Security property

Page 58: Oracle Apps - Forms

Roles

Role

Privileges

Users

Page 59: Oracle Apps - Forms

Menu Module Roles

• Select Menu Module Roles Property from the menu Module properties.• Enter Database Role Names.• Use Security Property Set to Yes.

Page 60: Oracle Apps - Forms

Menu Item Roles

• Invoke Property pallet of a Menu item.• Choose Menu Item roles property.• Select Menu Item roles.• Press OK button.

Page 61: Oracle Apps - Forms

Summary

• Creating Menu Modules• Attaching Menu Modules to Forms• Popup menu items• Pre-Popup menu trigger.• Built-ins for Managing Menu items programmatically.• Menu Module security with Roles.

Page 62: Oracle Apps - Forms

Form Builder Messages & Alerts

Page 63: Oracle Apps - Forms

Displaying Messages to Operators

MessagesApplicationWorkingInformativeError

AlertsSystemApplication

Page 64: Oracle Apps - Forms

Errors and Built-ins

• Built-in failure does not cause an exception.• Test built-in success with FORM_SUCCESS function.• What went wrong?

– ERROR_CODE, ERROR_TEXT, ERROR_TYPE– MESSAGE _CODE, MESSAGE _TEXT, MESSAGE _TYPE

Example: GO_BLOCK(‘EMP’);IF FORM_SUCCESS THEN

EXECUTE_QUERY; END IF;

FORM_FAILURE

FORM_FATAL

Returns TRUE OR

FALSE.

Page 65: Oracle Apps - Forms

Message Severity Level

>25

20

15

10

5

0

25

All (default)

More critical

Define by:

:SYSTEM.MESSAGE_LEVEL

Fatal Error

Page 66: Oracle Apps - Forms

Error Triggers

• On-Error Trigger– Fires when system error message is issued. Built-ins to Use:– Use ERROR_TYPE– ERROR_CODE– ERROR_TEXT

• On-Message Trigger– Fires when informative message is issued. Built-ins to Use:– MESSAGE_TYPE– MESSAGE_CODE– MESSAGE_TEXT

Page 67: Oracle Apps - Forms

Alerts Properties

Title

ALLERT_BUTTON1 ALLERT_BUTTON3ALLERT_BUTTON2

Alert Message Text (Max 200 Characters)

Alert Style

Page 68: Oracle Apps - Forms

Showing Alerts

DECLARE n Number;BEGIN n:=SHOW_ALERT(‘Del_Alert’);

IF n = ALERT_BUTTON1 THENDELETE_RECORD;

END IF;END;ORIF SHOW_ALERT('DEL_ALERT‘) = ALERT_BUTTON1 THEN

DELETE_RECORD;END IF;

NOTE: SHOW_ALERT Function Returns Number.

Page 69: Oracle Apps - Forms

Displaying Errors to an Alert

Changing the Alert Button Label:SET_ALERT_BUTTON_PROPERTY(‘Err_Alert’,

ALERT_BUTTON1,LABEL,’O.K’);

SET_ALERT_PROPERTY(’Err_Alert’,ALERT_MESSAGE_TEXT, ERROR_TYPE||’-’||TO_CHAR(ERROR_CODE)|| ’: ’||ERROR_TEXT); n := SHOW_ALERT(’Err_Alert’);

Page 70: Oracle Apps - Forms

Summary

• Displaying Messages in Form Builder• Built-ins

– ERROR_CODE, ERROR_TYPE, ERROR_TEXT– MESSAGE_CODE, MESSAGE_TYPE, MESSAGE_TEXT.

• Testing Built-ins with FORM_SUCCESS• Alerts• Setting alert Properties at runtime.

Page 71: Oracle Apps - Forms

Form Builder - Triggers

Page 72: Oracle Apps - Forms

Form Builder Triggers

• A trigger is a PL/SQL Block which fires implicitly whenever an Event occurs.

Events:Item Interaction

Errors/MessagesQueries

Validation

Navigation

Mouse Events

others

PL/SQLBLOCK

Page 73: Oracle Apps - Forms

Trigger Components- Scope

Scope

Type

CodeForm LevelBlock LevelItem Level

Page 74: Oracle Apps - Forms

Trigger Components - Type

Scope

Type

Code

Pre-Post-WhenOn-Key-

Page 75: Oracle Apps - Forms

Trigger Components - Code

SQL StatementsPL/SQL StatementsBuilt-in Sub-programsUser Defined Sub-programs

Scope

Type

Code

Page 76: Oracle Apps - Forms

Execution Hierarchy

Item Level

Block Level

Form Level

On-Error

EH=After

On-Error

EH=After

On-Error

EH=Override

Event

Page 77: Oracle Apps - Forms

Summary

• Trigger: Implicitly Fires• Type: Defines the event that fires it• Prefixes:

– Pre- – Post– When– On– Key

• Code: Anonymous PL/SQL Block• Scope: Form, block, or item level

Page 78: Oracle Apps - Forms

Oracle Objects Features In Forms

Page 79: Oracle Apps - Forms

Objectives

• Identify which object types are supported• Describe how object types are

represented within Form Builder• Create a block based on an object table• Create a block based on a relation table

with an object or an REF column• Populate a REF column with an LOV

Page 80: Oracle Apps - Forms

What is an Object Type?

interest

Close

withdraw

Check status

Attributes

Methods

ACCOUNTAc_no

Ac_typeDeposit

Open_date

Page 81: Oracle Apps - Forms

Overview on Objects

• Object tables• Object columns• Object views• REF Columns

REF

Page 82: Oracle Apps - Forms

Oracle 8i Features in Forms

Supported Oracle8i features• Large Objects: BLOB, CLOB, NCLOB, BFILE• User-defined objects

– Object table– Column object– REF column

Unsupported Oracle8i features• Collection types• Stored procedures that return object values

Page 83: Oracle Apps - Forms

How Form Treats Objects

Object_B

Attr_B1

Attr_B2

Attr_A3

Nested Objects

Attr_A1

Attr_A2

Object_A

Attr_A1

Object_A

Attr_A3

Attr_A2_B1

Attr_A2_B2

Items in a Form

Page 84: Oracle Apps - Forms

Creating Data Blocks

• Blocks based on object tables• Blocks based on object columns• Blocks with REF Lookups

Page 85: Oracle Apps - Forms

Block Based on Object Tables

Page 86: Oracle Apps - Forms

Block Based on Object Columns

Page 87: Oracle Apps - Forms

Blocks with REF Lookups

Page 88: Oracle Apps - Forms

Using REF Lookup Value

Select REF attribute columns: This causes the columns to appear as data items at run-time.Select the REF item itself: • This causes the item to be placed on a Null canvas.• The item does not appear at run time.• The item is available for coding purposes.

Page 89: Oracle Apps - Forms

LOVs for REFs

Page 90: Oracle Apps - Forms

Summary

• Identify supported Oracle8i object types• Define data blocks based on object tables• Define data blocks based on tables

with object columns or REF columns• Populate REF columns with an LOV

Page 91: Oracle Apps - Forms

Item Interaction Triggers

Page 92: Oracle Apps - Forms

Objectives

• Adding Functionality to Input and Non-input Items by adding triggers and Built-ins.

• Displaying LOVs from Buttons• Interacting with Checkboxes• Interacting with Radio Buttons• Interacting with List items• Loading Image into Image item• Populating Hierarchical Tree Item

Page 93: Oracle Apps - Forms

Item interaction Trigger

• Valid commands:– SELECT statements– PL/SQL expressions– All built-in subprograms– User Defined Subprograms

Page 94: Oracle Apps - Forms

Examples

When-Button-Pressed

When-Checkbox-Changed

When-Radio-Changed

When-List-Changed

When-List-Activated

When-Image-Pressed

When-Image-Activated

When-Tree-Node-Selected

Page 95: Oracle Apps - Forms

Displaying LOVs from Buttons

• Uses:– Convenient alternative for accessing LOVs– Can display independently of text items

• Needs:– When-Button-Pressed trigger– LIST_VALUES or SHOW_LOV built-inDECLARE x Boolean;BEGIN x:=SHOW_LOV(‘Dept_Lov’);END;

Page 96: Oracle Apps - Forms

Interacting With Checkboxes

• WHEN-CHECKBOX-CHANGED trigger

IF CHECKBOX_CHECKED(‘Control.case’) THEN SET_ITEM_PROPERTY(‘Emp.ename’,CASE_INSENSITIVE_QUERY, PROPERTY_FALSE);

ELSE SET_ITEM_PROPERTY('Emp.ename',CASE_INSENSITIVE_QUERY, PROPERTY_TRUE);

END IF;

Page 97: Oracle Apps - Forms

Interacting With Radio Button

• WHEN-RADIO-CHANGED trigger

IF :emp.job=‘MANAGER’ THEN :emp.sal:=7000;ELSIF :emp.job=‘CLERK’ THEN :emp.sal:=5000;ELSE :emp.sal:=2000;END IF;

Page 98: Oracle Apps - Forms

Interacting with List Items

ADD_LIST_ELEMENT(‘emp.job’, 4, ‘Analyst’, ‘ANALYST’);

DELETE_LIST_ELEMENT(‘emp.job’ 2);

President

Manager

Clerk

Salesman

Index

1

2

3

Page 99: Oracle Apps - Forms

Loading Images

Fetch onQuery

READ_IMAGE_FILE

WRITE_IMAGE_FILE

Page 100: Oracle Apps - Forms

Read_Image_File Built-in

• Used to Load Images into Image Items.

READ_IMAGE_FILE(‘E_’||:emp.empno||’.bmp’,’BMP’,’emp.emp_image’);

Page 101: Oracle Apps - Forms

Populating Hierarchical Tree Item

• Set the Data Query Property – SELECT 1,level,ename,null,empno FROM emp

CONNECT BY PRIOR empno=mgrSTART WITH JOB=‘PRESIDENT’

Note: Do not terminate query with semicolon.

• Write When-New Form Instance Trigger at Form LevelFtree.Populate_Tree(‘tree_block.emp_tree’);

Page 102: Oracle Apps - Forms

Summary

• Item Interaction Triggers and Built-ins• Interacting with Various Items

– Push Button– Checkbox– Radio Button– List Item– Image Item– Hierarchical Tree Item

Page 103: Oracle Apps - Forms

Thank You

Bhaskara Reddy Sannapureddyhttps://www.linkedin.com/in/bhaskara-reddy-sannapureddy-57052b11/