+ All Categories
Home > Technology > Oracle Apps-- D2K notes

Oracle Apps-- D2K notes

Date post: 11-Nov-2014
Category:
Upload: yogita-sarang
View: 1,971 times
Download: 8 times
Share this document with a friend
Description:
Oracle Apps-- D2K notes
Popular Tags:
143
6i What is D2K ? It is front tool. First name of D2K Oracle * Form Developer 2000-5.0à(client/server)
Transcript
Page 1: Oracle Apps-- D2K notes

6i

Page 2: Oracle Apps-- D2K notes

What is D2K?

It is front tool.

First name of D2K

Oracle * Form

Developer 2000-5.0à(client/server)

Oracle Developer Release 6.0

Form6i (i-internet) Client/Server Browser

Versions of D2K

1) Forms 3.0&Repots 1.0à6.0

2) Forms 4.5 &Reports 2.5(Developer 2000)

3) Form 5.0&Repots 3.0

Supports of Wizards.

4) Forms 6i &Reports 6i (Developer 6i)

supports java Runs application on web.

What is use of front end tool.

SQL

PL/SQL

He is technical He is non technical person

Person

Any front tool is used to develop a application.

SQL * PLUS ORACLE D2K

Page 3: Oracle Apps-- D2K notes

(This for customer (or) non technical person.)

Types of Interface

Can you develop application using D2k?

Yes (using D2K we can develop web based application.)

When develop D2k application we can develop on windows plat form only.

What are the criteria for purchasing front tool:

cost(what is the cost)

Operating System(it is support O/S or not)

Backend

Connectivity.

D2k supports:

Windows

Unix

Linux

Macintosh

Sun O/S

D2K Supports Backend:

CUI BROWSERGUI

Page 4: Oracle Apps-- D2K notes

àOracle

àNon Oracle DBs

àSybase

àSQL Server

àDB2

Cost:

1.5 Lakes.

Connectivity:-Support by ‘ODBC’

Technical Part of D2k:-

It support RAD (Rapid Application Development)

Technology.

RAD:-

Minimum code.

More Productivity.

Is there any front tool without write single line program develop system?

Yes--that is D2k.

D2k is a Default Intelligent tool.

Program required to more functionality.

It support oops (reusability)

It has automatic row level locking system.

It supports concurrent users.

D2k support Data Migration (this is export or import can do. From legacy DBs to current DBs)

Automatically Data integrity Maintained in case of Master/Detail Form/screen.

Page 5: Oracle Apps-- D2K notes

It supports Integration.

Excel

P.P

OLE (Object Linking embedded.)

COM(Common Object Module)

it is an Integration tool.

D2K: Forms Reports Graphics Query Builder Procedures Translator.

We can develop all things separately and integrate it.

It support:

Web Enabled System. Web Based System.

Web enabled System:-

Working windows (or) Browser.

Web Based System:-Only on Browser.

Ex:-oracle ERP.

D2K supports Three Tire Arctic

CLIENT BROWSER SERVER

Page 6: Oracle Apps-- D2K notes

Developer 6i:

Forms —Design form for data manipulation purpose

Reports —Used to retrieve data from database for a better format

Graphics —Used to design charts.

Procedure Builder – used to create subprograms that GUI mode

MDI:-Multiple Document Interface.

It is not part of D2K. It is part of O/S(windows O/S).

Window:-

Every new form is automatically held in a default window named WINDOW1.

1) Boilerplate (Labels)

2) Item (Fields, save, Cancel etc.)

Note:-Default window will be there not requires developing it.

Item:-

Item display data values, and can be edited. Item are objects contained in block.

Canvas:-

The canvas is the ‘background’ (or) Which Items, Text and Graphics placed.

Block:-

Logical container of item. Owner of item. Not visible at run time. It supplying item to the canvas.

Note :-No Item without Block

Page 7: Oracle Apps-- D2K notes

Note:-No relation between canvas and block.

ORACLE D2K

Table ------ Block

Column --- Item

Row ------- Record

TABLE

BLOCK

CANVAS

Can You create without Table a block?

MDI WINDOW

WINDOW

CANVAS

ITEM BLOCK

A B C D

A C D

A D

Page 8: Oracle Apps-- D2K notes

A:-Yes.

Table 1 Block A

Table 2 Block B

Table 3 Block C

Table 4 Block D

On more than one table we cannot create one block. Data block always depend on single table. We can create one view on three tables then we can create a block on the view.

We can create more than one block on one table.

The relationship b/w table block (1: M)

Items from different blocks may be on same canvas. Different block items may be on different canvas. Same item cannot possible on different canvas.

Canvas Item

(1: M)

Canvas Block

(M: M)

02.

Window: - There are two types.

1) Model Window :-

If it is active, we cannot navigate to any other window. It always needs response.

2) Modeless Window:-

It is used 90 %( It is default.) If it is active, navigation is possible to any other window

Canvas: - It is 5 types

Page 9: Oracle Apps-- D2K notes

1) Content:-

It is used 90%.

It is default.

It occupies whole window.

At run time only one content canvas can be display on same window

2) Stacked:-

More than one stacked canvas can be displayed on same window at run time.

Because it is displayed on top of any window or any content canvas.

WINDOW

When required stacked canvas:-

When you pay the fee by cash not required to open any other canvas . If it is check again you have to open another canvas.

3) Tab:-

CONTENT

STACKED

STACKED STACKED

CONTENT

CONTENT

Page 10: Oracle Apps-- D2K notes

4) Horizontal Tool Bar:-

5) Vertical Tool Bar:-

Item:-

It is an interface object (Which user interacts).

It is two types.

1) Input item :- Accept values from user

Text-item, radio-button, check box, list item.

2) Non input item: - does not accept from user (May accept values from system)

There are two types.

1) Accept values from system :-

display item

Ex: - system date on form

OLE (Object Link and Embedding)

Ex: - logos, other part active x control

Chart Item

Ex: - bar chart

2) Does not accept values from item:-

Ex: - add, save, exit button.

FORM:-

SUPP PRODCUST

Page 11: Oracle Apps-- D2K notes

A form is a module of form builder which is saved as a file and groups or keep different form objects. ---àCanvas is known as screen

Hierarchy of form objects:-

form

à Block line for ownership.

à Broken line for relationship.

Components of d2k

Form report graphics schema procedure queryBuilder builder builder builder builder builder

Modules

Form menu pl/sql lib object libraryModule module module module

Programs

IFDES60.EXE IFGEN60.EXE IFRUN60.EXE

03--class

WINDOW CONVAS BLOCK PL/SQL TRIGGER OTHER

OBJECT

ITEM TRIGGER TRIGGER

Page 12: Oracle Apps-- D2K notes

old version

Iàinternet IFDES45.EXE

Fàform IFDES50.EXE

DesàDesign IFDES60.EXE 60.EXE

60àversion

Form module:

IFDES60.EXE (step1)

Used to design form. Save source code as file. file name(.FMB)

FMBàForm Module Binary.

Sept2:-

IFGEN60.EXE

used to generate execute file(.FMX)

FMXàform module executable.

Step3:-

IFRUN60.EXE:-

Used to run.FMX file

If .FMX file not found then it generate .FMX file and run .FMX file. It generate .FMX file only when some property is enabled.

Default folder Form60 àF:\oracle\ora9i\forms60

(When you saved. it will saved where oracle is installed)

Note:-

Page 13: Oracle Apps-- D2K notes

To save /generate .FMX file

User not required to provide

file name path

Q) If not save file what name it will give by default.

F:\orant\form60\module1.fmx

Q) When you want transfer the application which file you can take.

.FMBàPortable (this can transfer)

.FMXàNot Portable.

If machine has same platform and version (6i)

We can transfer.FMX also.IFRUN60.EXE is there it will run other wise

it will create .FMB and .FMX both.

Working windows:-

1) Object Navigator

2) Layout Editor

3) PL/SQL Editor

4) Property Palate

1) Note:-all forms objects having own property.

You can do two things through property.

look& feel Action/(Behaviors)

Object Navigator:-

All objects are found over here. All objects are created here.

Layout Editor:-To design form, some object also can be created here.

How to create block:-

Page 14: Oracle Apps-- D2K notes

Canvas

Table

You can create two ways:-

1) Wizard

2) Manually

1) Wizard:-

Go to data block.

2) Manually:-

1) Control Block

2) Data Block.

To Changed to

Data Block to Control Block

Control Block to Data Block

Note:-Both are possible.

1) Step1:-

Start programàoracle form 6i orclD2K

form builder

1) Form

module1 (+) indicate something there.

Create data block

double click on date block

by default :-orant\d2k60\module1

Give the module as some name.

How to generate .FMX file

Page 15: Oracle Apps-- D2K notes

step1:-in D2K

Go to file from menu bar click to administrator click on compile file(Ctrl+T)

(In interview asked)

(Here .FMX file create where .FMB is saved here)

IN form Builder automatic

DML DQL

****

1) After run the form:-

Tool bar

execute un Conditional Query un Restricted Query

How to retrieve conditional value:-

Enter(1st) Execute(2nd) 1st click on enter give condition value and click on execute

Ex:-deptno—20

Q) If give Sal>2000 as conditional in Sal field.

A:-We get result.

Q) For complex logic?

A:- open/invoke the query/where window.

Setp1:-click on enter

Step2:-put bind parameter in any text item

Ex:-Sal

Step3:-click on execute.

Bind Variable:-variable created in SQL it is called Bind variable.

Page 16: Oracle Apps-- D2K notes

Go to deptno: Z

Click on execute. It will display Query/where window.

Note:-in query/where window we do not use where clause.

Query:-Sal between 2000 and 3000

List Item:-

Type of List Item:-

1) Poplist

2) Tlist (T-text)

3) Combobox

At object navigator default Item type: =Text Item

List item:-we can create through

àObject Nvg

àLayout Editor

Poplist:-It is read only.

Tlist:-

Read only. We find scroll bar.

Combo Box:-read and write.

Q) What is default?

A:-pop list is default.

How to populate or insert values or elements in list item

Page 17: Oracle Apps-- D2K notes

Two types

1) Design Time

2) Run Time

Setp1:-

o Go to list item property.o click on element in list

1) In List Elements entered values we can see in list.

2) In List Item Value entered value will be stored in back end.

Note:-

In case of query for list item. Fetched data must match with only values of list item.

Tlist:-change list style àTlist

1) Scroll bar will not visible at design time.

2) Scroll bar is visible only at run time.

3) If all elements of Tlist not displayed then scrollbar will come.

4) In Tlist select value is activated.

Combo Box:-

Note:-

Combo Box we have to give value based on table column size then it go store value.

Ex: - 1) if column size 1 byteàit will store only 1 character

2) If column size 5 bytesàit will store 5 bytes.

05—class:-

Page 18: Oracle Apps-- D2K notes

Radio Buttons and Check Box:-

Q) What situation you use radio button?

àMutual exclusive selection.

Ex:-Gender

o Mo F

Only one button can take.

(If we two values are there you can use check box also).

Group:-

Group1 Group2

M Y

F N

Create radio Button:-

There 2 methods are

At Object Nvg At Lout out Editor

Step2:-

Create Radio group Create radio button under the radio group.

At layout editoràautomatically system will

Create radio group implicitly.

At object Nvg:-

Create Itme, change Property as Radio Group.

At Layout Editor:-Create Radio Button Automatically

Radio Group creates.

Step2:-At layout editor it asked very time the Radio group.

Q) We can delete all Radio Button But Radio Group will exist?

Page 19: Oracle Apps-- D2K notes

A:-Yes.

Setp3:-Assign values for each Radio Button

Go to Radio Button Property

Label--&Male

Radio Button Value—M(This ‘M’ will go back end)

initial value

Used for default value.

Ex:-Initial value-C

Note:-For give Radio Button Initial value we go to Radio group Property.

Initial Value-F

Check Box:-Multy select.

Ex:-

Local

Country

Foreign

There are two values are there

Checked Un Checked

If checked what value should go If unchecked what value should go.

Page 20: Oracle Apps-- D2K notes

Editor Type:

1. System editor (It is pre-defined)

Page 21: Oracle Apps-- D2K notes

2. User_defined Editor

How to attach Editor to text Item

Go text item property. Select system defined editor. (SYSTEM_EDITOR)

How to Invoke or call Editor

Ctr+E

Note:-here we have use only ‘e’.

Types of Blocks (Based on record)

1) Single Displayed Record Block

.Form (This is Default)

2) Multi Record Block Displayed

.Tabular

Note:-we have to specify how many Record=3

When you take single record in FORM it will single Record Form.

When you take more than one record in FORM it will call it as Multi Record Form.

The combination of single record from, Multi records from is called Master/Detail Form.

(How to make single record if get by default more than one records are displayed.)

Go property of data block

Page 22: Oracle Apps-- D2K notes

Node--Record

Number records displayed-1

How to calculate SUM of employee Sal

create one new item for totalsal go property of totalsal Item

Section--Data

Data type--number

Calculation --section

Calculation Mode--Summary

Formula --

Summary Function--sum

Summarized Block--null

Summarized item-Sal

Go to EMP Block Property

Section--Records

Query all records--Yes

àRun the form now it will show total Sal

Page 23: Oracle Apps-- D2K notes

LOV (List of values)

It is a data structure like table. It is a virtual table.

Page 24: Oracle Apps-- D2K notes

Q:-In LOV data comes from where?

A:-Data will come from Record Group data populated into LOV from Record Group.

Record Group

It is also a data structure similar to table. It is virtual table It populate the data into

LOV List Item

Types of Record Group:-

1) Query Based (90% used)

2) Non Query based (or) Static

Query Based:-

The Record group which is associated with select

Query is called query based record group.

It can be created at Design time Run time

Page 25: Oracle Apps-- D2K notes

2) NON QUERY BASED:-

No select query associated with record group.

1) It can be created.

Only at run time.

Static:-

No query associated with this record group. It can be created at

Only design time.

Note:-LOV &Record Group can be created separately.

LOV Record Group

Query

LOV RECORD GROUP

QUERY

Page 26: Oracle Apps-- D2K notes

Note:-

LOV can be created by

Wizard Manually.

When we created LOV through wizard based on query automatically record group created

Create LOV (Based on query)

step1:-

Double click on LOV Node at obj nav

step2:-

Write the select query in SQL query statement

select *from dept

Note:-Here once when you created LOV automatically Record Group also creates.

lov1Record Group

Record Group

LOV2

LOV3

It is not possible in simple wayThrough programs is possible.

LOV1

LOV2

LOV3

IT IS NOT POSSIBLE IN SIMPLE WAY THROUGH PROGRAM IS POSIBLE

Record Group

Record Group

Page 27: Oracle Apps-- D2K notes

How to attach LOV to Text Item:

step1:-

Go to text item property.

Go lov section.

List of values--lov4

How Invoke LOV:-

We can call LOV F9

(Control (cursor) must be on Item (LOV item))

LOV is used for

Help Box

Validation

Assignment

How to do assignment:-

Go to LOV property

Click on column mapping property

Node--function

Click on browse button

Select the Item name (I.c emp.deptno)

How to create static LOV

If you have less records then no need to retrieve data from table.

In this case we go for static LOV.

Step1:-

Create record group (manually) DB click on Record group select static say ok Mention all the column in record group.

Page 28: Oracle Apps-- D2K notes

create LOV manually go to LOV property

Node-- functionRecord group--deptrg

MASTER AND DETAIL 1. Create one block with single record (form) on dept Table.

2. Create one block with multi record (tabular) on EMP table.

How many records you want to display

How to make the relationship between this block

NOTE: - Each block having the relation node.

1. Double click on master block relation node.

2. We get new relation.

3. Check on select.

4. Select detail block name e.g.:-EMP.

Write the join condition.

emp.deptno=dept.deptno

This is block name (not table name).

Click on OK.

Once mention d2k give integrate rules will

Applied Automatically.

(OR)

When we create relation, automatically 03 triggers Will created.

One trigger on form level

Two triggers on master block level

Three program units created

Trigger on form level:-

On-clear-details

Page 29: Oracle Apps-- D2K notes

Block level:-

On-populate-details

On-check-delete-master

Program units:-

Check-package-failure

Clear-all-master-details

Query-master-details

Run this

Now in form

You select 10 deptno it will all details of EMP

10th deptno.

Q).what is the default relation name will give

Automatically at dept-emp.

Delete condition for master records/child records.

Cascading Isolated

Non-isolated à default

Cascading:-

If master record delete child record automatically Delete.

Isolated:-if master record delete no effect on child Record.

Non-isolated:-we cannot delete master record any Corresponding child record exits.

If you change relation what trigger will created:-

Isolated:-

On-clear-details à form level

On-populate-details Block level

Note: here ‘On-check-delete-master’ trigger will be removed No changing on programming units.

Page 30: Oracle Apps-- D2K notes

Test removes relation and select cascade

Query:-

Cascading:-

On-clear-details à from level

On-populate-details à block level

Pre-delete à block level

Q).if cascading what trigger will get newle pre-delete

Program units are:-

Go recordà

Remove all records now

If you save then it commit.

Co-ordination property:-

It defines the query behavior of detail block. It decides how detail records will be displayed for corresponding master record.

It has 3 types

1. Deferred (means lately).

2. Auto-query (detail block).

1. Deferred:-if you select master data, then detail will come or not will decide here. (Or)

àDetail record not displayed with master record at same time

Differed 2 types:-

1. with auto-query

2. With out auto-query

1. with auto-query : -

If we click anywhere in detail block, automatically Child records will be displayed.

2. With out auto-query:-

In this case we have done for query for detail record separately.

Page 31: Oracle Apps-- D2K notes

2. Auto query:-

Master record and child records displayed same time automatically

It has no meaning if differed no}

Auto query no} then default auto query will run.

Prevent Master less operation:-

(It will appear in master block in property of relation name)

àWhen we go for does operation on detail block I Don’t check master data through this.

Yes--You cannot do any operation in detail without any master record.

No--(this default) you can do any operation in detail without any master record.

2nd Method for create master and detail block

How to create relation during creation the

Detail Block:-

create data block (for detail)

auto-join data block(un checked it)

Differed auto query yes yes

yes no no no

No yes

Page 32: Oracle Apps-- D2K notes

click on creation relationship

Click on OK.

Select master block name (dept may have more than One relationship).

Say ok. Select common item name form.

Detail item master item

Deptno deptno

Next. Remaining steps are same.

Where you can write program.

SQL PS/SQL BUILT-INS USER-DEFINED

OLE :-

Object Linking and Embedding (OLE) was introduced to support the cooperation of separate applications presenting a single compound document.

TRIGGERS:-

Create trigger <trigger name>

After/before insert/update/delete

On table name

For each row

When <condition>

Declare

Begin

Exception;

End;

Page 33: Oracle Apps-- D2K notes

FORM TRIGGER:-

It is pl/sql block which is associated with events.

It is used for:

To add more functionality to form.

To process data

To impose validation

It is execute against event associated with it.

d2k having own events.

Types of events:-

1. External

2. Internal

Externalàis done by user (press the key click mouse).Internalàit is occurred due to navigation.

Components of triggers:-

1. Type

2. Scope

3. pl/sql code

1. Type:-

àType of triggers identifies the name of the events take Action event.

2. Scope:-

Trigger should be executed in which area (level) SCOPE OF LEVELS

1. Form level

2. Block level

3. Item level

NOTE:-all triggers cannot be written at all levels.

Page 34: Oracle Apps-- D2K notes

3. pl/sql program :-

Program body of trigger allows to write

TYPES OR TRIGGERS

1. Pre

2. Post

3. When

4. On

5. Key

1. PRE:-

It is fires just before event take place or deleting

Pre-form

Pre-block

Pre-text-item

Pre-record

2. POST:-it fires just after event take place or deleting.

Post-form

Post-block

Post-text-item

Post-record

3. WHEN:-

It fires just after default processing done

When control reaches to the object.

When-new-form-instance

When-new-block-instance

When-new-item-instance

Page 35: Oracle Apps-- D2K notes

When-new-record-instance

4. ON:-It is used for replacement of default processing

Generally it is used for non base table.

On-insert

On-update

On-delete

5. KEY: - àsome triggers associate with key.

They are called key triggers

They are fired when we press the keys.

Key-next-item

(Tab/enter keys)

(Arrow keys) key-up

Key-down

Key-nxtrec (next record).

CREATE TABLE product master

(Product no varchar2 (6) constraint

Pk_product_pk primary key,

Description varchar2 (25),

unit_measure varchar2 (10),

Qty_on_hand number (8),

Reorder_lvl number (8),

Cost_price number (10, 2),

Selling_price number (8,2))

Page 36: Oracle Apps-- D2K notes

Restriction:-

product_no is primary key

First letter of product_no must start with ‘P’.

Description, Unit_Measure, Selling_Price and Cost_Price cannot be left blank.

Qty_On_Hand should have a default value of 0

Qty_On_Hand is not enterable.

Selling_price cannot be 0

Cost_Price cannot be 0

Selling_price cannot be less than cost_price.

Create synonym prod_master for product_master.

Create a data block on synonym (prod_master)

Form name

PRODUCT:

Data Block Name

Product_master

Canvas name

Product_can

Window name

Product_win

For a Title

Node—functional

Page 37: Oracle Apps-- D2K notes

Title—Product Information

Last Push Button names:- Labels

Pb_addAdd

Pb_viewView

Pb_modifyModify

Pb_deleteDelete

Pb_saveSave

Pb_exitExit

Pb_firstFirst

Pb_priorPrior

Pb_nextNext

Pb_last

CLASSIFICATIONS OF TRIGGERS:-

All are internal triggers (based on action)

1. Interface trigger

2. Navigation trigger

3. Query trigger

4. Validation trigger

5. Message trigger

6. Transaction trigger

Page 38: Oracle Apps-- D2K notes

7. Block processing trigger

1) Interface trigger:-

This trigger is associated with external events.

A) General B) Mouse C) Key

A) General: - (Or) Action Trigger

Trigger that get execute due to user interaction are called Action Trigger.

When-button-press

When-radio-changed

When-checkbox-changed

When-list-changed

When-list-activated (T list)

When-window-Closed

B.Mouse:- When-mouse-click

When-mouse-doubleclick

When-mouse-enter

When-Mouse-Leave

When-Mouse-Move

C) Key:-

Trigger Name Key

Key-next-item Tab or Enter

Key-up

Key-down

Key-ExeQry F8

Key-NxtBlk Shift F5

Page 39: Oracle Apps-- D2K notes

Key-Commit F10

2 . Navigation trigger :-

It is internal trigger

Pre:-

When-new-<object>-instance

Ex:-

When-new-form-instance

When-new-block-instance

When-new-item-instance

When-new-record-instance

Post:-

3. Query processing trigger: - 2 types

1. Pre-query

2. Post-query

1. Pre-query:-

It fire only once for all row fetched.

(Before fetching any row it will fire)

If data is there do query

2. Post-query:-

1. After fetch the row

2. It is fire for each fetched row

NOTE:-both are block level triggers.

4. Validation trigger:-

1. It is validation of data

Page 40: Oracle Apps-- D2K notes

(It used to check data when enter in field)

1. when-validate-item (it is only item level)

2. when-validate-record (it is on block level)

5. Message trigger:-

1. Informative message

2. Error message

NOTE:-message displayed by the form builder at run Time can be changed.

1. Informative message both are using for

On-message form, block, item

2. Error message levels

On-error

6. Transaction trigger:-

1. Pre

2. On

3. Post

1. Pre Pre-insert

Pre-delete

Pre-update

2. On On-insert

On-delete

On-update

3. Post post-insert

Post-delete

Post-update

7. Block processing trigger:-

1. when-clear-block

Page 41: Oracle Apps-- D2K notes

2. when-create-record

3. when-database-record

4. when-remove-record.

Variables used in d2k:-

1. pl/sql variables

2. Item variables

3. Global variables

4. System variables

5. Parameter variables

2. Item variable:-item can be used in variable.

: [colon] is prefix

2-5 variables are called bind variable.

Any variable use: it called bind variable.

:[< block name>]. <Item name>

Ex:-

: emp.empno

Declare

Vsal number (8, 2);

Begin

Select Sal into vsal from EMP

Where empno=7500;

: emp.emp_sal:=vsal;

: This is not using in normal pl/sql using in d2k.

IN D2K

Begin

Page 42: Oracle Apps-- D2K notes

Select Sal into: emp.vsal

From EMP

Where empno=:emp.empno;

NOTE:-in d2k some cases we can write

Program “without BEGIN &END Block”

Syntax for lov

Ex:-

Show-lov (‘dlov’);

3. Global variable:-used to pass the value to

1. With in the form

2. form to form

3. Form to report/graphics

It can be declared at

1) Form level

2) Block level

3) Item level.

data type =char maxi size is 255

Note:-This is the drawback.

It is open till session (it has poor memory mgt) it is use one key word ‘GLOBL’

: (colon) is prefix

: GLOBL. <Variable name>

Ex:-

: global.code

TRIGGERS:-

Page 43: Oracle Apps-- D2K notes

When-new-form-instance

When-new-block-instance

When-new-item-instance

Initialization is must

:global.code:=‘A’;

4. System variables:-

At run time form builder maintain Form status in to system variable.

Means it is declared & maintain by form builder itself.

Users can not declare (or) assign in to system variable.

Exception:-

In specific cases some system variable can be assigned by user.

Data type=char

Value=uppercase (...some cases lower case also)

User can use system variable if require.

it is used one key word ‘SYSTEM’

:system.<variable name>

:system.block_status

Key word block status

It is used generally to right generic programs

(Flexible code)

NOTE:- for more details system variable go to ‘help’

5. Parameter variables:-

it is used to pass the value

1. With in the form

2. form to form

Page 44: Oracle Apps-- D2K notes

3. Form to reports/graphics

Data type=number/char/date

Size=respective

4. Not open till session

5. It is created at object navigator at design time.

6. It is used with key word ‘parameter’

Syntax:-

:parameter.<variable name>

BUILT-INS:-

It is predefine ‘sub programs ‘as part of d2k

Sub programs are 2 types

1. Procedure

2. Function

All built-ins are part of pre define Packages are 2 types

1. Standard extension (all built-ins kept)

2. Others text_IO (name)

NOTE:-the package name not used as prefix with

Built-ins 200+procedures+functions are there.

CATAGEORY OF BUILTS are 2 types

1. Restricted

2. Unrestricted

1. Restricted:-it is not allowed on all triggers the Built-ins which initiate navigation restricted built-ins

Ex: - go-block

Go-item

Next-item

Page 45: Oracle Apps-- D2K notes

Next-record

2.un restricted:-allowed on all triggers

Ex:-message (-------)

Show –lov

Show-lov (‘lov name’);

All built-ins use:-

1.save:-

Commit-form;

Clear –block (do-commit);

Clear-block; (or)

Clear-block (no-commit);

Clear-form (do-commit);

Clear-form (no-commit);

Commit; (this is converted to commit-form)

Delete –record;

Update-record; (this block level)

2. NAVIGATIONAL BUILTINS:-

Go-block (<block name>); (it is used for jumped from One block to another block)

Next-block;

Go-item (<block name><item name>);

Next –item (it is require);

Go-record (<record no>);

Next-record

First-record

Last-record

Previous-record

Page 46: Oracle Apps-- D2K notes

Go-form (<form name>);

Next-form

Previous-form

Show-lov (<lov name>);

List- values (if lov is attached to item then)

Show-editor (editor-name)

Edit-text item (editor attach with item)

Show-view (<stacked canvas name>);

Hide-view (<stacked canvas name>);

Show-alert (<alert name>);

Execute-query;

Set-<object>-property (arguments);

Set-window-property ();

Set-block-property ();

Set-item-property ();

Set-lov-property ();

Set-alert-property ();

Set-form-property ();

Get-<object>-property

Get-application-property ();

Add-list-elements ();

Through this programs put values or used to populate

The list item automatically through this program.

Message (‘msg string’)—pro display the message.

Create a button lov when you click on that button

Lov should display. (Or)

Page 47: Oracle Apps-- D2K notes

HOW TO CALL THE LOV THREW PROGRAMS

Double click on lov Select lov wizards

After finishing this process lov will be created

change Lov name as deptlov

Create one push-button

Right click choose PL/SQL Editor

Write code here.

Declare

Vlov boolean;

Begin

Vlov: =show_lov ('deptlov');

End;

àAs soon as the form is opened in memory

àA series of navigational trigger are executed.

The sequences of triggers that fires

when a form is invoked are as follows.

Sequence Trigger Name Remarks

1 Pre-Form The trigger gets executed even before the form is displayed.

2 Pre-Block This Trigger fires while entering the block and also during navigation from one block to another.

3 Pre-Record This trigger fires for the first time

Page 48: Oracle Apps-- D2K notes

before entering the first record in the first block on the for Subsequently it fires before navigation to any record in that block. 4 Pre-Text-Item This trigger fires for the first time before entering the first enterable item in the first block on the form.

Subsequently it fires before navigation to any item in the block.

5 When-New-Form-Instance This trigger fires when the forms focus is on the first item in the first block after form displayed. 6 When-New-Block_instance This Triggers fires after the cursor is ioned on the first item of the block and also during navigation from one block to another. 7 When-New-Record-Instance This trigger fires when the forms focus changes from one record to the other.8 When-New-Item-Instance This trigger fires after the cursor is positioned on the any item the form and also during navigation from one item to another.

The sequences of trigger that fires when

a form is closed are as follows:-

1 Post-text-item It fires after leaving the current item.

2 Post-Record It fires after leaving the current record.

3. Post-Block It fires after leaving the current block

4. Post-Form It fires just before exiting the form.

SMART TRIGGER:-

Introduced in form 5.0

It is a collection of frequently used triggers. With respect to object where control currently located

Right click on list box

Page 49: Oracle Apps-- D2K notes

Select smart script

Frequently used triggers available

List of values it is also used to invoke lov if it is attached to item.

How to find duplicate values when enter. threw program on

EMP table. Trigger—key-next-item

Itemname—empno

DeclareCNT number (5);Begin Select count (*) into CNTFrom EMP Where empno=:emp.empno;If CNT>0 thenMessage (‘the empno is already existing ‘);Else next_item;End if;End;

NOTE:- Suppose we want to display the message as Model Window Give 2 times message it will display Model window.

Page 50: Oracle Apps-- D2K notes
Page 51: Oracle Apps-- D2K notes

-: ALERT :- An ALERT is modal window that display a message notifying the operator of some

application condition.

It is a form object

It is used to display the decision message

It is display as ‘Model Window’ There are three styles of alerts: Stop Caution Note

Here each style denotes a different level of message severity.

Note:-

Alert style

Node—Functional

Alert Style--

à It has 3 buttons.

Button 1 Label --Ok }

Button 2 Label ---Cancel}

Both are by default

Button 3 Label --we can give any third message (Ex:-Delete)

You can enter up to 200 characters

àIt is invoked threw program Show_alert ( );

HOW TO CREATE ALERT:-

Step1:-

Create alert

àDouble click on alert Node in Object Navigator

(Then change the name if it necessary)

Page 52: Oracle Apps-- D2K notes

Step2:-

Then right click on alert

Go to Alert Property

Provide a message for alert

Functional- section

àGive the message for Alert

Message-Do want to delete

Step3:-

Invoke ALERT.

HOW TO INVOKE THE ALERT:-

Show_alert()

It is a function

It return one numeric value

To return number type value

PROGRAM FOR CALL FUNCTION:-

Create one button for Alert

Give as name Alert then right click go to PL/SQL Editor

Trigger--When_Button_Pressed

Declarevalt number;Beginvalt:=show_alert(’DELALT');end; (--DELALT is alert name.)DECLAREvalt number;BEGINvalt:=show_alert('DELALT');

Page 53: Oracle Apps-- D2K notes

--for Button 1IF valt=Alert_Button1 THEN

DELETE_RECORD;--COMMIT;--if we save after delete.--for button 2ELSIF valt=Alert_Button2 THENMessage('Deletion Canceled');Message('Deletion Canceled');--for Button 3ELSEMessage('Nothing Deleted');

Message('Nothing Deleted'); END IF; END;

How One Alert can be used for different Message?Button—delete

Trg--when_button_pressed

DECLAREvalt number;BEGIN--seting the message of next set_alert_property('DELALT', Alert_Message_Text, 'Do you wnat delete??');--it for setting title. set_alert_property('DELALT',Alert_Title_Text,'delete??');valt:=show_alert('DELALT');--for Button 11IF valt=Alert_Button1 THENDELETE_RECORD;--COMMIT;--if we save after delete.--for button 2ELSIF valt=Alert_Button2 THENMessage('Deletion Canceled');Message('Deletion Canceled');--for Button 3ELSEMessage('Nothing Deleted');

Message('Nothing Deleted');

Page 54: Oracle Apps-- D2K notes

END IF; END;

Changing the alert message at runtime.

we can change an alert message at run time by executing the SET_ALERT_PROPERTY

Trigger:-When_validate_item CODE—MGR (ITEM)

DECLAREALERT_BUTTON NUMBER;BEGINSELECT ENAME INTO :MANAGER FROM EMPWHERE EMPNO=:MGR;EXCEPTIONWHEN NO_DATA_FOUND THEN

ALERT_BUTTON:=SHOW_ALERT( 'MANAGER_ALERT');RAISE FORM_TRIGGER_FAILURE;END;Q)Create a two button alert for the emp form,which will be displayed in case operator enter an invalid salaryi.e outside permitted range,for check.It should have two buttons,

‘OK’ and ‘Cancel’.

If the operator choose ‘OK’,Accept the salary else

re_enter

Step1:-

Create an alert ,’SAL_ALERT’ of Caution type.

Step2:-

Define two button,’OK’ and ‘CANCEL’

Page 55: Oracle Apps-- D2K notes

Trigger:-when_validate_item

Item name—sal

DECLAREALT_BUTTON NUMBER;BEGINIF :JOB='CLERK' AND :SAL>2500 THENALT_BUTTON:=SHOW_ALERT(‘SAL_ALERT');IF ALT_BUTTON=ALERT_BUTTON2 THEN /*CANCEL*/RAISE FORM_TRIGGER_FAILURE;END IF;END IF;:GROSS:=:SAL+NVL(:COMM,0);END;

When_validate_item

IF :MAIN.UID IS NULL THENMESSAGE('Enter UserId'); RAISE FORM_TRIGGER_FAILURE; END IF; How To invoke Stacked Canvas:-

canvas stacked (Block dept)

canvas content(Block emp)

empdept

Page 56: Oracle Apps-- D2K notes

Create one block on dept(deptno,dname,loc)with staked

Click on call Button its open another canvas(content)

1) Canvas stacked canvas for dept block(deptcan)

2) Canvas content or stacked for emp block(empcan)

Button ---call (empdetal)

trigger-- when_button_pressed

show_view(‘empcan’);

Note:-

The call button must be out of calling area

You can not call from content to stacked

You can call stacked to stacked

For position change:-

view port—section(deptcanvas)

view port x position-0

view port y position-0

Width—425

deptno

dname

locCall

Page 57: Oracle Apps-- D2K notes

Height—324

For position change (empcan)

view port—section(empcanvas)

view port x position-0

view port y position-200

Width—450

Height--150

it hide deptcan canvas

go back to empcan canvas

create one button on deptcan

Button--OK

Trigger--when_button_pressed

Go_block('emp');

Hide_view('deptcan');

For Show Editor:-

Trigger--When_mouse_Doubleclick

code—Remk(I.c text_item)

Declare

OK Boolean;

BEGIN

Show_editor(‘System_Editor’, :Remk,:Remk,Ok);

END;

Note:- here :Remk is item name

Page 58: Oracle Apps-- D2K notes

Global Variable:-

Note:-

First create one block on emp table

create one block manually (one text item TO receive deptno)

àblock sequences first should be emp block

step1:-

Trigger-when_button_pressed

Block-emp

Button OK

code

:GLOBAl.var:=:emp.deptno;

:TB.TI:=:GLOBAL.var;

go_block(‘TB’);

System Variable:-

-->It used by form build

-->It keep or store the status at run time.

10

10

10

Global variable

emp Tblk

Page 59: Oracle Apps-- D2K notes

:system.block_status

1)New

2)Changed:-

-->Insert

-->Update

-->Delete

3)Query

:SYETM.BLOCK_STATU

OK--Button

IF:system.block_status=‘CHANGED’ THEN

clear_block(do_commit);

else

Message(‘No data to be saved…….’);

Message(‘No data to be saved…….’);

end if;

Note:- we can give the

clear_block;

Commit;

Parameter variable:-

Page 60: Oracle Apps-- D2K notes

Step1:-

Create parameter at obj nav

Name as àpdno

:tblo.dno:=:parameter.pdno;

Trigger--when_button_pressed

Button--OK

:parameter.pdno:=:emp.deptno;

:tblo.dno:=:parameter.pdno;

go_block('tblo');

POST_QUERY:-

Trigger--post-text-item

Item--dname(write code here)

select dname into :emp.dname

from dept

where deptno=:emp.deptno;

Note:-

Go to dname item and click

Enter key will get that a corresponding dname of deptno.

Emp

30 30

Parameter

TBlo

Page 61: Oracle Apps-- D2K notes

àIf duplication data enter it should not

save and enter other data it should save.

Trigger—when_validate_item

Item—empno

Block –emp

declare

cnt number(20);

begin

select count(*) into cnt from emp

where empno=:emp.empno;

if cnt>0 then

message('Duplication empno');

message('Duplication empno');

raise form_trigger_failure;

end if;

end

NameCodeAddr Dno

BLKA BLKBPost -block Pre-Block

Ford10

Lanais

Page 62: Oracle Apps-- D2K notes

Key-next-item

Go-block(‘BLKB’)

When control leaving block post-block will fire.

How Trigger will fire what is sequences

1) When-validate –item

2) post-text-item

3) when-validate-record

4) Post-record

5) Post-block

6) Pre-block

7) Pre-record

8) pre-text-item

9) when-new-block-instance

10) when-new-record-instance

11) when-new-item-instance

Note:-

If pre-text-item trigger failed, the control goes back to the original place.(I e. go back to Block A)

Page 63: Oracle Apps-- D2K notes

What is navigational Trap:-

àIt called also Fatel Error

àIf PRE-TEXT-ITEM trigger failed from source and target both then navigational trap

situation arises.

àIt is known as fatal error.

Trigger execution hierarchy:-

EH/ES

Execution Hierarchy

Execution Style

When we write same trigger in different level the which trigger will fire first

It is decided by EH/ES

where the property will there

Go to trigger property

Node--functional

Block A Block B

Navigational Trap

Page 64: Oracle Apps-- D2K notes

Execution hierarchy

Override

After

Before

How to maximize the form

-->go to form level trigger--when_new_form_instance

-->for maximize the MDI windowset_window_property(Forms_mdi_window,window_state,maximize);-->for maximize the ‘window’--under same same trigger Set_Window_Property('krishna', WINDOW_STATE,maximize);

here ‘krishna’ is window name

we can fined it under window at obj nav.

SET_WINDOW_PROPERTY(

FORMS_MDI_WINDOW,

WINDOW_STATE, MAXIMIZE );

SET_WINDOW_PROPERTY(

FORMS_MDI_WINDOW,

TITLE, 'MANTECH' );

SET_WINDOW_PROPERTY( 'WINDOW1',

WINDOW_STATE, MAXIMIZE );

--SET_WINDOW_PROPERTY( 'WINDOW1',

Page 65: Oracle Apps-- D2K notes

TITLE, PROPERTY_FALSE );

SET_WINDOW_PROPERTY( 'WINDOW1',

TITLE,'App_Wolrd');

declare

cursor primary_cur is select 'x' from u_tab where USERID = :UID;

primary_dummy char(1);

begin

open primary_cur;

fetch primary_cur into primary_dummy;

if ( not primary_cur%found ) then

message( 'Unknown user ...');

close primary_cur;

raise form_trigger_failure;

end if;

close primary_cur;

end;

How to create different buttons if menu is not there

find a default menu

-->Go property of form

(default name--module1)

-->node-- functional

menu module--DEFAULT&SMARTBAR

(default menu name)

-->Remove the default menu

For query Processing

Page 66: Oracle Apps-- D2K notes

trigger --When_button_pressed

button name--ExeQuery

built_in--execute_query;

For exit form

trigger --When_button_pressed

button name--Exit

built_in--exit_form;

For refresh form

trigger --When_button_pressed

button name--Refresh

built_inà

clear_block(No_commit);

Note:-

-->if we not specify no_commit here.

-->You change the data,

-->It will ask do you save.

What is execute_query:-

It is built_ins

It clears the Block and executes the query.

It does not accept conditional value. From the query block.

It always checks the conditional value at where clause of query block.

What is execute-Query?

It built-Ins

It clears the block and executes the query

Page 67: Oracle Apps-- D2K notes

It does not accept conditional values, from the query Block

It always checks the conditional value at where clause of query block.

Control Block Method:-

1) Control Block(blk) (here create one text item name -pno)

2) Data Block(emp)

Level of Trigger—Form Trigger --when_new_form_instance

:global.pno:=:emp.deptno;

execute_query;

set_window_property(Forms_mdi_window,window_state,maximize);

Set_Window_Property

('krishna',WINDOW_STATE,maximize);

Block-emp

Button name—Query

Trigger—when_button_presed set_block_property('emp',

Default_where,'empno='||:empno);

clear_block(no_commit);

execute_query;

Calling form:-

write in Supp Button for called fome.

When_Button_Pressed

syntax:-

call_form(<forms name>,display_mode,

switch menu_mode,query_mode

,parameter list);

<form name> is mandatory

Page 68: Oracle Apps-- D2K notes

all others are optional

(fmx name Awith path.)

ex:-’d:\krishnaforms\formb.fmx

display_mode

hide

no_hide

Hide:-

calling form will not be displayed when

called form invoked.

No_Hide:-

calling form and called form both

displayed.

Switch menu-mode

No_Replace

-->calling form menu will be displayed

Do_Replace:-

-->Called form menu will be displayed.4

Query-Mode:-

Query_only

-->Called form used only for

-->DQL

-->No DML

No_Query_Only:-

-->DQL

Page 69: Oracle Apps-- D2K notes

-->DML

call_form

('C:\Documents and sttings\Administrator\Desktop\gv.fmx',no_hide,no_replace,query_only);

Parameter list:-

It is Mechanism to pass value from calling form to called form.

Open-Form:-

-->We can open more than one form.

-->Navigation is possible between calling form

and called form.

-->After Exit called form,control goes to calling form.

Syntax:-

open_form(<form name>,active_mode,session_mode,

Query-mode,Parameter list);

Active_mode:-

-->Active

-->No_active

Active:-Control is on called Form.

No_Active:-Control is on calling Form.

Session_mode:-

Session

Called form using different database.

No_session:-

Called form using same database of calling from .

New_form:-

-->We can call only one form.

Page 70: Oracle Apps-- D2K notes

-->Calling from is exit out.

Note:-

-->If calling form is itself called by only another form,then control goes to another form

after exit from called form.

Syntax:-

New_from(<Form Name>,Rollback-Mode,

Query_mode,parameter list);

Roll Back:-

To_savepoint

NO_ROLLBACK

Full_RollBACK

Page 71: Oracle Apps-- D2K notes

-:Menu:-àIt provides the option

àTo Invoke

àForm/module

Page 72: Oracle Apps-- D2K notes

àReport

àGraphics

Components of menu

1) Main Menu

2) Submenu

3) Menu Item

File-->main menu

New -->Menu Item

Close

Sub menu

.MMB (Menu Module Binary) it is source code

.MMX (Menu Module Executable) (executable code.)

How to create Menu:-

-->Double click on Menu Module

-->Double click Menu Editor

-->create different

-->sub menu

-->Menu Item

-->save the file as .MMB (it should be in same location of .fmb

-->generate .MMX file.

-->go to file

-->go administrator

-->click on compile file (or) ctr+t

Note:-we will get error here.

Page 73: Oracle Apps-- D2K notes

Restriction:-

-->To compile the menu all item must have PL/SQL code.

-->we write PL/SQL code only on Item.

Under in Exit menu Item :

Exit_form;

Open menu Item

Go_Block(‘supp’);

Attach Menu to form:-

Go to form property of form

Go to Menu Model—

C:\Documents and Settings\applmgr\Desktop\empmenu.mmx

Create main menu which having following

Types of Menu Item

1) Plain

2) Separator

3) Radio

4) Check

File EditDept_detSalgrade_det Copy

CutPasteClose

Exit

Page 74: Oracle Apps-- D2K notes

5) Magic

Dept_det

PL/SQL Block

Built In

go_block('dept');

Salgrade_det

PL/SQL Block

Built In

go_block(‘salgrade');

Exit

Exit_form;

For separator

Create one menu Item

Node--Functionl

Menu item Type – Separator(This only for separator. )

After the create Close Menu Item.

Note:-Run the .mmx file very time if do any changes

Close

Exit_form; ( or)

Menu Item Type—Magic

Magic Item—Quit

For Creating Magic Item:-

Let take one example here.

Edit—sub menu

Step1

Create menu Item Copy

Page 75: Oracle Apps-- D2K notes

Cut

Paste

Cut

àSelect the menu item(Cut)

àGo to property

Node—functional

Menu Item type—Magic

Magic Item—Cut

Similarly

Copy

Menu Item type—Magic

Magic Item--Copy

Similarly

Past

Menu Item type—Magic

Magic Item--Past

Popup Menu(short Cut)

(It is introduced in 5.0 )

àIt is Created in Form module

Double Click on popup menu

give name as –popupA

Go to menu editor frame menu

Note:-

In popup menu no concept of main menu.

Page 76: Oracle Apps-- D2K notes

it has only sub menu

menu item

Under Menu Editor

menu item(dept_det)

menu item(salgrade_det)

menu item(exit)

menu item(copy)

menu item(cut)

menu item(paste)

Repeat the same steps from code in menus.

Attach Popup menu to any Item (or)Canvas

go to canvas/item property

in canvas/ item property

Node—functional

Popup Menu—popupa

Run the from

Note:-

When right click any where on canvas the shot cut menu will display.

if attached to item(empno),go the item right(empno) click on item the popup will displayed.

Messaging System

Form Builder display the different type of message to user at run time.

These message can be

changed

suppressed

Page 77: Oracle Apps-- D2K notes

Note:-

All messages can not be

changed

suppressed

MSG Type

1) Information MSG (All success message called informative MSG)

2) Error MSG

3) Working MSG

4) System Alert

5) Application MSG

6) Application Alert

MSG can changed using ON_Message Trigger ON_MESSAGE Trigger

Form Level

Block Level

Item Level

MSG reporting Built_Ins are

Message –Code

Message –Text

Message –Type

Component of MSG

Type

Code

Page 78: Oracle Apps-- D2K notes

Text

Type:-

Ora(Back End)

Frm(Fornt/End)

Code:-error number

Text:-MSG String

Error MSG (Built-ins are)

on_Error

Error_code

Error_text

Error_type

Working MSG:-

Working MSG Displayed from form Builder during the processing can be suppressed.

How to do this/system Alert:-

Using one system variable

:system.suppress_working

Q):-Which system variable can we assing value?

A:- Suppress_working

default=‘FALSE’

Ex:-

:System.suppress_working:=‘TRUE’;

(When_new_form_instance)

Severity Level of MSG:-

all MSG displayed by Form builder having some number assigned by from builder

Page 79: Oracle Apps-- D2K notes

This number of MSG is called severity level,means how much the message is sevior/critical.

Different Pre_defined Level:-

0àall other msg

5àdue to obvious reason (if enter ename in empno it error )

10àDue to procedure mistake.

15àdue to form is not designed

20àdue to trigger failure.

25àForm is Incorrectly used

Message can be suppress using one

system variable

:system.message_level=15;

(up to 15 message will be suppressed )

Default is 0

Default=0;

When_new_from_Instance

:system.message_level:=15;

FRM:40400 (successful message) when

saved the data

all message can not be changed at all level.(form,block,item).

Commit message can be changed at

block level.

Level—Form

Trigger—On_Message

IF message_code=40400 then

Page 80: Oracle Apps-- D2K notes

message('record has been saved sucessfully........');

message('record has been saved sucessfully........');

ELSE

message('Mesage_text');

END IF;

Object orient programming(OOPS) In D2K:-

Used for

maintain the standard(same color etc)

More productivity

Easy maintain

D2k provides 6 components:-

1) Property Class

2) Visual Attributes

3) Object Group

4) Program Unit

5) PL/SQL Library

6) Object Library

1)2)3)4) are used within form module

Not used across the form.

5)6)àThese modules are used Across the form

1) Property Class:-

àIt is used by define useràuser-defined property

àIt is named object that contains a list of properties and their values.

Page 81: Oracle Apps-- D2K notes

CLASS:

Type of property:-

Variant

Inheritance

Steps

1) Double click on property classes(PC)

2) Give name as PCTXT

3) Go to Property Class property

4) (+) click on add(+)(i.c add icon bar)

I)select width -- 100Height -- 30Font Size -- 20

Foreground color-- Magenta

Assigning the property class to other objects on the form:

go to Item propertyo node –general

subclass information --click on it(….)

o sub class information dialog box will be displayed

DATE

STRINGRADIO

NAMEENAME

ADDR

THIS CALL

INHERITANCE

Page 82: Oracle Apps-- D2K notes

select property class radio button.

select the property class name.

click on ok button

Note:-The properties of the item that are inherited form the property class will display an red arrow.

if you remove subclass information you can see the time default size width-1 high-0

inserted of remove it go to item property and in place of property class name give NULL

2)VISUAL ATTRIBUTES

1).Used to maintain standard of

look &feel(font)

color

How to create visual attributes:-

1).double click on visual attributes.

2).give name as vatxt.

3).go to va property.

color:-blue

4).go to the item property. (empno)

5).go to visual attribute section.

6).select visual attribute group:-vatxt.

How to attach the visual attribute to block

go to block property

visual attribute--section

visual attribute group--VATXT

Record--section

current Record visual attribute group--VATXT

Page 83: Oracle Apps-- D2K notes

3) OBJECT GROUP

It is logical container to keep parent object only

which can be reused.

it keeps only reference of object.

How to create the object group:-

Double click on object group.

Give name as –objgro.

Drag &drop the parent object.(io emp block)

Go to new parent object property. (here one more control block(BLKA) and create one canvas(BLKCAN))

Go to new parent object property (blka) subclass information--emp and new object emp.

1).create one canvas.

2).drag canvas.

3).I.e.:-can-dept.

NOTE:-we can use canvas and when create any new canvas you can get the use the other interaction.

4).PROGRAM UNITS:- It is used to right the

o Procedure

o Function

o Package

Which you can be reused.

Page 84: Oracle Apps-- D2K notes

DB click on program unit

Give name procA

create a button ‘count’

write a program for this button

Trigger—When_button_pressed

DECLARE RECNO NUMBER;

BEGIN

SELECT COUNT(*) INTO RECNO FROM EMP

WHERE DEPTNO=:DEPTNO;

MESSAGE('THE NUMBER EMP'||RECNO);

MESSAGE('THE NUMBER EMP'||RECNO);

END;

PROCEDURE procA(PDEPTNO NUMBER,

PCNT OUT NUMBER) IS

VCNT NUMBER(2);

BEGIN

SELECT COUNT(*) INTO VCNT FROM EMP

WHERE DEPTNO=PDEPTNO;

PCNT:=VCNT;

END;

How to call procedure:-

àW-b-p procA(deptno,countitem);

PL/SQL Library:-

It is a first module

.PLL (PL/SQL library)

Page 85: Oracle Apps-- D2K notes

It is used to write the

Procedures

Function

Package

Which can be reused across the form.

DB click on PL/SQL L/B model

It is not change the name

The same PL/SQL library can be attached to

multiple forms and menus.àThere are three library files.

.PLL

.PLX

.PLD

1).PLL :-

It contains both library source code and the Complied

The .PLL is created or updated when it is saved in the library module.

(platform-specific p_code(Executable code)

2).PLX:-

It is a platform-specific executable.

This complied p_code is need when an application is ready to deployed.

3).PLD:-

It is text format file and can be used for technical

Page 86: Oracle Apps-- D2K notes

Documentation of the library files.

The PL/SQL subprograms can define in library

procedures

Functions

Package Specifications

Package Bodies.

Nag:-

1)FileànewàPL/SQL Library

(Or)

2)Node Libraries

To change

To save the file and give the name emp_pll

DB click on program unit

same as above program in procA procB

How to use program of PL/SQL

In PL/SQL editor,define appropriate program unites and then compile and apply modifications.

Page 87: Oracle Apps-- D2K notes

An Object Library is a container for form objects.

You can drag any number of individual objects such as block, items, canvasses, windows, or property classes into a library for reuse in other modules.

Benefits of object Library:-

Simplifies sharing and reuse of object.

It provides control and enforcement of standards.

It eliminates the need to maintain multiple referenced forms.

Page 88: Oracle Apps-- D2K notes

Objects included in an object library:-

• Alert• Block• Canvases• Property Class• Visual Attributes• Windows

Create an object library and placing object in the object Library:- Create an object library name give any (emp_objlib.olb)that stores object.

The Object Library is collection of one or more Library Tabs.

DB click on the Library Tabs Node to create a new Library tab in the object library.

default name is LIB_TAB0 give name as (LIB_VATTR)

Go property of LIB_VATTR and give label(VATTR)

Create another Library tab stores a property class.

The new library tab property as

Name—LIB_PC

Label--PC

open appropriate tabs in the Object Library for place object Nag:- Toolsàobject Library

select the visual attributes objects in form module And drag and drop it on the VTTR tab in Object Library.

Repeat the same step for Pclass.(in this case PC tab must be active ).

Forms Builder displays a dialog box as show asking for copying or subclasing the dra

Page 89: Oracle Apps-- D2K notes

Reports are used to extract necessary data from a oracle table and displayed it on VDU or printer.

The process of data extraction and its displayed is called Report creation.

for report creation oracle provides a GUI based report writer tool called Oracle Reports Builder.

What is oracle Report:-

Oracle report is tool for developing,displaying and printing production-quality reports.

Page 90: Oracle Apps-- D2K notes

Report6.0.RDF(Report Definition File)

Component Of Report:-

Data Model(Mandatory):-

Layout Model(Mandatory):-

Data model and Layout Model in witch the structure and format of the report can be created.

Parameter Form(Optional)

Report Trigger(Optional)

Data model:-

A data model is composed of some or all of the

following data definition objects.

• Queries

• Groups

• Columns

• Parameters

• Links.

Queries:-

• Queries are SQL SELECT statements that fetch data from the oracle database.

Groups:-

àGroups determine the hierarchy of data appearing in the report, and are primarily used to group columns select in the query.

Note:-Oracle repots automatically creates a group for each query.

Pre_Defined Repot format:-

Page 91: Oracle Apps-- D2K notes

• Tabular(90% used)

• Group Left(Group Report)

• Form-Like(Master/Detail Report)

• Group-Above

• Mailing Label(Complex Report)

• Matrix(Complex Report)

• Form Letter

• Matrix With Group

• There are 8 reports format

• Group Left :-

10 ------------

------------

20 ------------

------------

• Group Above :-

10 ----------------

----------------

20 -----------------

-----------------

Matrix and Matrix with Group

Used for analyses

It is called dimensional report

It is complex report

Steps:-

Select the Repot Builder

Navigation

Page 92: Oracle Apps-- D2K notes

1) startàprogramsàoracle Report6i àReport Builder

2)select Report Wizard.

3)

Page 93: Oracle Apps-- D2K notes

Break report is created with repeating values for a column have to be printed only once.

Thus the break reports are effective only when the select statement includes a column called a break containing at least one value which repeats over multiple records.

Step1:-

select Group Left as a presentation style.

Step2:-

enter the SQL statement as in the Data Tab.

SQL> SELECT Ename, Empno,Sal, Emp.Deptno, Dname,loc

Page 94: Oracle Apps-- D2K notes

FROM Emp,Dept

WHERE Emp.Deptno = Dept.Deptno;

Group Left report requires the name of the column that must be used as a break column.

step3:-select the deptno is repeating as the multiple items are selected for every order.

Step4:-deptno is displayed in the group filed.

Note:-The list of columns that must be displayed on the report is asked.

Step5:-

Select all columns.

Step6:-

select sal in calculation totals page (if it requries tol sal) Change the label for empno as emp num in label page

step7:-

select ‘Cyan Grid’ presentation style and click on finish in Template screen.

Repeating Frames:-

Repeating frames are called so because repeating frames are repeated as many times as necessary to display all the records.

The report layout contains two repeating frames.

The first repeating frame includes columns deptno.

All other columns are included in the second repeating frame.

Page 95: Oracle Apps-- D2K notes

Whenever we need to report like for each master record fetched only the related detail recorder.

It has two groups of data .

Data Link object:-

It is a data model object,which joins multiple queries.

Note:-

Join defined by data link object is an Outer Join.

Page 96: Oracle Apps-- D2K notes

Layout:-

master/detail report uses Group Above layout style.

(I.c in which master record display across the page with the label to the left of their fields and the detail records apper below the master records in tabular format.

Creating the report definition:-

Master/detail report can be created using two queries.

Step1:-

For master query:-

Right click on data model and select report editor.

select query object from the toolbox and place it on the report work area.

Enter the query in SQL Query statement Dialog Box

SQL> SELECT Deptno, Dname, Loc

FROM Dept;

setp2

For detail query:-

Create one group with following query:

SQL> SELECT Empno, Ename, Sal, Deptno

FROM Emp;

Note:-Two groups are created.

Note:-here the name of

Page 97: Oracle Apps-- D2K notes

Query object is Q_1

Group object is G_1

The name of the data base column are the same as defined in the SQL query.

Open the property palette of Master and Detail Q_1,G_1 and change the

name of the in Master Group Query object to Q_master

Group to G_master name of the in Detail Group

Query object to Q_Detail

Group to G_Detail

Note:-If data columns with the same name are included in the Report groups,the data columns will be renamed by using column name followed by an integer Value starting with 1.

Step3:-

Select the Data link tool and click and hold on the Deptno column of the G_master group.

Drag the mouse pointer to deptno column of the G_Detail group and release.

Open the Data Link property sheet by Double clicking on the data link.

we examine the all relationship here where is the default clause used in master/detail relationship.

The link is used to established by using a where clause and an equality sing(=)

Step4:-

Select Tools..Report Wizard to define the report format.

select presentation Group Above as show in diagram

Select displayed two groups into displayed groups.

Master and Detail manually

Go to report builder and select build report manually

Page 98: Oracle Apps-- D2K notes

create master group on dept table.

Open the property palette of Master

name of the in Master Group

Query object to Q_master

Group to G_master click on layout model icon

select frame tool from tool pallet .

select Repeating frame tool and drag it on frame in report editor area.

select Text tool from tool pallet and drop it on editor area for a labels.

here text1 –deptno

text2—danme

text3—loc select Field tool from and drop it on report editor area for report fields.

here take Field1—deptno

Field2—dname

Field3--loc

Right click on filed(Deptno) and select Property pallet

Node—Field

source—deptno

Repeat the similar steps to other fields.

Run the Report but we will get error.

Page 99: Oracle Apps-- D2K notes

Repeating invalid group : close the error

Note:-And click on Layout model icon I object Navigator.Forget layout editor.

Select the repeating frame and right click and go property pallet.

Node--Repeating frame

source—G_dept(this is the master group name)àRun it see the result.

àCreate one group for detail group

àHere also name of the in Detail Group

Query object to Q_Detail

Group to G_Detail Create relationship master and detail group through data link.

Go layout model.

add all field which are in detail group

do same job for all the fields

select repeat frame for detail block fields for separately.

run report

Note:- Here we will get error.

remove all fields from repeat frame and frame also.

create new frame for detail block in repeat frame of master.

create one repeat frame with in the new frame.

create a fields for detail group.

Page 100: Oracle Apps-- D2K notes

attaché all corresponding source columns to these fields.

go property of repeat frame of detail group repeating frame

select the repeating frame(which having all detail fields) and right

select property pallet.

Node--Repeating frame

source—G_detail(this is the detail group name)àrun report.

àgo to property of detail repeating frame

Node—General layout

Vertical Elasticity –ExpandàRun and see

àgo to property of detail filed Node—General layout

Vertical Elasticity –Expand

Page 101: Oracle Apps-- D2K notes

A parameter is a variable whose value can be set at runtime (e.g, from the Runtime Parameter Form or the command line).

There are two types parameters

1)User parameters are created by you for the report.

2)System parameters are created by Report Builder.

Note:-

We can delete or rename a user

parameter

Page 102: Oracle Apps-- D2K notes

we cannot delete or rename a system parameter.

expand the Data Model node in the object navigator.

Go to User Parameter node.

select user parameter node and click on the Create Button Button to create a user parameter for passing deptno.

Note:-

Default name of parameter is P_1 will be created

Go to property of Queries at object Navigator Navigator (I.c Q-emp) Select the

Node—Query

Sub Node—SQL Query Statement

àClick on SQL Query Statement. In select statement Give a parameter as:

SELECT Empno, Ename, Sal

FROM Emp

WHERE Deptno=:a -------- Here ‘a’ is parameter.

àIf we want two parameter the give the two parameter

SELECT Empno, Ename, Sal

FROM Emp

WHERE Deptno=:a AND Sal>:b;

Note:-

Here we can fined two parameter(I.c A,B) in user parameter object.

Expand the user parameter object for find parameters.

Creating Computed columns:-

Computed columns calculates values based on PL/SQL expression or on data provided by database columns.

There are two types of computed columns that can be added to a report.

Page 103: Oracle Apps-- D2K notes

Formula Column:-

It compute their values using PL/SQL expression.

It can operate on multiple values per record. (eg:-sal+comm).

Steps:-

Summaries Columns:-

It compute their values using built in functions of Oracle Report.

It on one value over multiple records. (eg:-sum of sal amount).

Deleting Default Header and Inserting Report Header:

select default marked text and press delete key.

click on text item on the vertical tool bar and place it in the header.

(enter the name of company and address.)

Additional Default Layout Tool:-

àIt is used to enables default layout for portion of our report with out overwriting enter layout model.

How to add date ,time, page number columns:

Page 104: Oracle Apps-- D2K notes

It is dimensional repot.

A matrix report is a summary report that presents the desired data with headings across the top and the left side.

Used for analysis.

Report format is

Matrix or Matrix with group.

Matrix report is also referred to as “CROSS-TAB”.

A matrix report is a cross-tabulation of four sets of data.

Page 105: Oracle Apps-- D2K notes

1) One set of data is displayed across the page.

(I.e Values are placed one besides other.)

2) One set of data displayed down the Page.

(I.e Values are placed one below the others.)

3) One set of data is the cross-productwhich creates data cells at the inter-section of cross and down the data.

4) One set of data is displayed as the ‘filler’ of the cells. (I.e the values are use to fill the cells created step3.)

Open report builder

create one group in data model.

>select emp.empno,emp.deptno,dept.loc

from emp,dept

where dept.deptno=emp.deptno

bring out the data column from group

Page 106: Oracle Apps-- D2K notes

=>Pl/sql constructs can be used to perform if conditional Logic can require in report.

1)Report trigger.

=> It is enables execution of pl/sql functions at specific times during the execution and formating of a report.

There are different type of triggers are available in oracle reports.

Page 107: Oracle Apps-- D2K notes

1) Formula Triggers.

2) Format Trigger.

3) Action Trigger.

4) Validation Trigger.

5) Report Trigger.

6) Group Filter.

1)Formula Triggers:-

Formulas are PL/SQL functions that populate formula or placeholder columns.

Access:-

You can access the PL/SQL for formulas via:

1) Object Navigator.

Nag:-groupàfield (cf_tol_salcomm)

PL/SQL Editor (F11)

2)The program unit editor

step:-

go to program unit

Select the formula function nameàF11

3)column property pallet.

Step:-

go column property (sal)

placeholder/formula—click on node button

The program unit editor

step:-

go to program unit

RC on program unit select program unit editor.

Page 108: Oracle Apps-- D2K notes

3)column property pallet.

Step:

go column property (sal)

node—advanced layout

sub node– format trigger

Note:-

The value returned by the formula trigger is displayed In the report field connected to the formula column.

Example:-

Function CF-salcomm_valueFormula Return

Number is

Begin

Return :sal+nvl(:comm,100);

End;

Function CF-sales_valueFormula Return Number is

Begin

Return :avg_product_rate*:sum_quantity;

End;

2)Format Trigger:-

This trigger are PL/SQL functions executed before an object is formatted.

The trigger can be used to dynamically change the formatting attributes of objects.

Page 109: Oracle Apps-- D2K notes

Ex:-

1)Font,Font weight etc

Access:-

1)OB

2)PL/SQL program unit

3)Layout Object Property.

(Main SectionàBodyàselect Fieldà PL/SQL Editor(F11))

Example:-

A conditionally print or not print a report column value.\

Format trigger returns Boolean values TRUE or FALSE.

If the return value for the format trigger is FALSE,the value is not displayed in the report.

Requirement:-

Display sal above 3000

Steps:-

create report

go filed in

Main selectàBodyàselect filed (I.c sal)

Go to PL/SQL Editor

Page 110: Oracle Apps-- D2K notes

It is a Report Package which keeps the Report Buit_Ins.

SRW is used as prefix with Buit_ins SRW.message(<NO>,’Msg’);Noàuser number.

Page 111: Oracle Apps-- D2K notes

function F_SALFormatTrigger return boolean is

begin

IF :SAL>3000 THEN

SRW.MESSAGE(100,'THSI REPORT IS USED

TO DISPALY ONLY ABOUE 3000 SAL ONLY');

return (TRUE);

ELSE

RETURN(FALSE);

END IF;

end;

How to hiding value:-

function F_ename return boolean is

begin

if :ename not in ('SMITH','WARD','JONES') then

return (true);

else

return (false);

end if;

end;

àCreate 4 parameters three for ‘emp_ names’ and one for conditional ‘job’

function F_SALFormatTrigger return boolean is

begin

if :ename in(:NAME1,:NAME2,:NAME3)

AND :SAL>:P_SAL then

Page 112: Oracle Apps-- D2K notes

return (true);

else

return (false);

end if;

RETURN(TRUE);

end;

function F_SALFormatTrigger return boolean

is

begin

if :sal >:p_sal then

srw.message(100,'the sal is below'||:p_sal); --it is used dispaly message

srw.set_foreground_border_color('red'); --it used fill colour round border

srw.set_border_pattern('solid'); --draw brower round the value cell.

srw.set_foreground_fill_color('magenta');

srw.set_fill_pattern('solid'); --it is used set colour for cells.

end if;

return (true);

end;

3)Action Trigger:-

Action Trigger are PL/SQL procedures executed when a button is select into the previewer.

The trigger can be used to dynamically call another report or execute any other PL/SQL.

Access:-

1)OB

Page 113: Oracle Apps-- D2K notes

2)PL/SQL program unit

3)Button Object Property pallet.

SRW.RUN_REPORT is used in the PL/SQL for a button,

Runtime Parameter Form will not appear by default when the button is selected.

Runtime Parameter Form to appear PARAMFORM=YES in the call to

SRW.RUN_REPORT(C:\krishna\atrigger.rdf

PARAMFORM=no p_job=“MANAGER" PSAL=“3000”);

4) Validation Trigger:-

Validation Trigger are PL/SQL functions that are executed when parameter values are specified on the command line when you accept the runtime parameter form.

Validation triggers are also used to validate the initial value of the parameter in the parameter property pallet.

Access:-

1)OB

2)PL/SQL program unit

3)parameter Property pallet.

Note:-

1)The PL/SQL in a validation Trigger can be a maximum of 32 K character.

Generate report

accepts ‘mon’ name from user if any employee joined in that month display output if not Give error message

‘There is no employees in this month’

The cursor has to go same parameter filed only.

Steps:-

1) Create one report

2) Create one parameter p_mon

Page 114: Oracle Apps-- D2K notes

3) Go to property of parameter

Uncheck the check box (I.c Restrict List to predetermined values)

4) Click on validation trigger property to define a validation trigger.

5) Write the code here.

function P_monthValidTrigger return boolean is

s_mon varchar2(20);

begin

select distinct to_char(hiredate,'mon') into s_mon

from emp

where to_char(hiredate,'mon')=:p_mon;

return (TRUE);

exception

when no_data_found then

srw.message(100,'There is no employees in this month'||:p_mon||'.');

return(false);

end;

5) Report Trigger:-

Report triggers execute PL/SQL functions at specific times during the execution and formatting of your report.

Note:-

We cannot create new global report triggers.

Report Builder has five global report triggers.

1) Before parameter Form trigger

Page 115: Oracle Apps-- D2K notes

2) After parameter Form trigger

3) Before Report

4) Between Pages

5) After Report

Note:-

Any processing that will effect the data retrieved by the report should be performed in the before form or after form trigger.

1)Before parameter Form trigger:-

Fires before the report is executed but after queries are parsed and data is fetched.

function BeforePForm return boolean is

begin

IF USER='SCOTT' THEN

return (TRUE);

ELSE

SRW.MESSAGE(100,'Permisition Denied........');

return(FALSE);

END IF;

end;

2) After parameter Form trigger:-

Fires after you exit the previewer, or after a report output is sent to a specified destination.

function AfterPForm return boolean is

cnt number;

begin

select count(*) into cnt

Page 116: Oracle Apps-- D2K notes

from emp

where deptno=:dno;

IF cnt>=5 THEN

return (TRUE);

ELSE

SRW.MESSAGE(100,'It has a less employees........');

return(FALSE);

END IF;

end;

Use Report triggers to store the name of the user who execute the report,the date on which the

report was execute:-

Step1:-

Create a table for store user,date.

Column name:-- User_Name varchar2(40)

column name:- Report_Date Date

Create table user_date(User_Name varchar2(40),

Report_Date Date);

Triggerà after parameter form

function AfterPForm return boolean is

user_name varchar(10);

begin

select user into user_name from dual;

insert into user_date values(user_name,sysdate);

srw.message(100,'the user'||user_name||sysdate);

Page 117: Oracle Apps-- D2K notes

return (TRUE);

end;

Note:-

Toolsàpreferences.

function AfterPForm return boolean is

begin

if :p_job is null and :p_sdate is null and :p_edate

is null then

:p_job:='%';

:p_sdate:=trunc(sysdate,'mm');

:p_edate:=sysdate;

return (TRUE);

else

return(true);

end if;

end;

1. Before Parameter Form trigger is fired.

Runtime Parameter Form appears(if not suppressed).

2. After Parameter Form trigger is fired

(unless the user cancels from the Runtime Parameter Form).

Report is "compiled."

Queries are parsed.

3. Before Report trigger is fired.

Page 118: Oracle Apps-- D2K notes

SET TRANSACTION READONLY is executed

(if specified via the READONLY argument or setting).

4. Between Pages trigger fires for each page except the last one.

COMMITs can occur during this time due to any of the following--user exit with DDL,

SRW.DO_SQL with DDL, or if ONFAILURE=COMMIT, and the report fails.

COMMIT is executed (if READONLY is specified) to end the transaction.

5.After Report trigger is fired.

11 COMMIT/ROLLBACK/NOACTION is executed based on what was specified via the ONSUCCESS argument or setting.

3)Before Report:-

It fires before the report is executed but after queries are parsed and data is fetched.

Requirement:-

If enter the max rows through parameterthen it will display only that many rows only.

If we not enter enter any parameter it will display all records.

The report query is execute after triggering the BEFORE REPORT trigger.

Thus the maximum number of rows fetched can beset by using SET_MAXROW() procedure in the BEFORE TRIGGER (Or) procedure sets the maximum number of records to be fetched for the specified query.

Query statement is

select empno,ename,sal from emp

order by sal desc

function BeforeReport return boolean is

begin

if :p_cutoff is not null then

srw.set_maxrow('Q_1',:p_cutoff);

Page 119: Oracle Apps-- D2K notes

return (TRUE);

else

return(true);

end if;

end;

Q_1àQuery name.

:p_cutoff àit is parameter name.

Placeholder Columns:-

àIt act as global variables in the Data Modal.A placeholder is a column for which you set the Data type and value in PL/SQL that you define. You can set the value of a placeholder column in the following places:

àThe Before Report Trigger, if the placeholder is a report-level column

àA report-level formula column, if the placeholder is a report-level column

àA formula in the placeholder's group or a group below it (the value is set once for each record of the group)

Place holder is write at Before Report

10 MANAGER

20 CLERK

30 SALEMAN

àGo to user parameter (Dno)

à Click the Place Holder and write the program.

In Query

Page 120: Oracle Apps-- D2K notes

Select empno, ename, job, deptno

From emp

Where job=:cp_1

Note:-

In case of placeholder column no need of create a parameter for :cp_1,we can create a place holder column in out of the group.

We can reference as parameter(:cp_1).

2)In case before parameter form it is not possible.

àGo to Before Report

function BeforeReport return boolean is

begin

IF :DNO=10 THEN

:cp_1:='MANAGER';

ELSIF :DNO=20 THEN

:CP_1:='CLERK';

ELSIF :DNO=30 THEN

:CP_1:='SALESMAN';

END IF;

return (TRUE);

end;

4) Between Pages Trigger:-

It fires before each page of the report formatted, except the first page.

This trigger can be used for customizing page formatting.

It can be used to pass printer codes to supports changing page orientation in the middle of a report.

You can use this trigger to send specific control character to the printer to change the paper orientation or to do double-sided printing.

Page 121: Oracle Apps-- D2K notes

5)After Report:-

This trigger fires once after the report is successfully executed.

It is used to send a message of Successfully report completion as well as to pass back the last page number in a multi_page report.

6)Group Filter:-

It determines which records to include in a group.

You can use packaged filters, First and Last.

The FRIST,LAST used to display the first n or last n records for the group. (or)

you can create your own filters using PL/SQL.

Write the program Group filter trigger at group :-

function filter_comm return boolean is begin if :comm IS NOT NULL then if :comm < 100 then return (FALSE); else return (TRUE); end if; else return (FALSE); -- for rows with NULL commissions end if; end;

Example for Group Filter:-function G_dnameGroupFilter return boolean is

N NUMBER;

begin

SELECT COUNT(*) INTO N FROM EMP

WHERE ENAME IS NULL AND SAL IS NULL

Page 122: Oracle Apps-- D2K notes

AND COMM IS NULL AND DEPTNO=:DEPTNO;

IF N=0 THEN

RETURN(TRUE);

ELSE

return (FALSE);

END IF;

end;

Page 123: Oracle Apps-- D2K notes

Go to program unit create a packagespecification

Give name

emp_deptno_update

PACKAGE emp_deptno_update IS type r_comp is record (deptno emp.deptno%type, ename emp.ename%type,

Page 124: Oracle Apps-- D2K notes

hiredate emp.hiredate%type, sal emp.sal%type, total_sal emp.sal%type); TYPE comp_rc IS REF CURSOR RETURN r_comp; FUNCTION emp_sal( p_deptno NUMBER) RETURN comp_rc;END;Package body:-

PACKAGE BODY emp_deptno_update IS FUNCTION emp_sal( p_deptno NUMBER) RETURN comp_rc IS c_emp emp_deptno_update .comp_rc; v_raise NUMBER; BEGINIF p_deptno>=40 THEN v_raise :=1.4; ELSIF p_deptno=30 THEN v_raise :=1.3; ELSIF p_deptno=20 THEN v_raise :=1.2; ELSE v_raise:=1.1; END IF;

OPEN

c_emp FOR

SELECT deptno,ename,hiredate,sal,

v_raise*(sal+nvl(comm,0)) total_sal

FROM emp

WHERE deptno=p_deptno

Page 125: Oracle Apps-- D2K notes

ORDER BY ename;

RETURN c_emp;

END;

END;

àcreate a one user parameter

NameàP_deptno

àdraw out a REF CURSOR query in the data model.

àwriter a function that returns the cursor variable that runs the database function.

function emp_deptno_RefCur

return emp_deptno_update.comp_rc

is

begin

RETURN emp_deptno_update.

emp_sal(:P_DEPTNO);

end;

Lexical Parameter:-

Lexical references are placeholders for text that you embed in a SELECT statement.

Lexical references to replace the clauses appearing after SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, CONNECT BY, and START WITH.

How to create user define exceptions.

EXCEPTION

when SRW.MAXROW_INERR then

srw.message(1000, 'Contact Oracle''s customer

support: SRW.MAXROW_INERR');

raise srw.program_abort;

Page 126: Oracle Apps-- D2K notes

Anchors:-

à Anchors are used to determine the vertical and horizontal positioning of a child object relative to its parent.

à The end of the anchor with a symbol on it is attached to the parent object..

Page 127: Oracle Apps-- D2K notes

A Graph is a form of information representation,

It is used to visually display a lot of information in a Compact form.

Chart Types:-

1) Column:-

Column charts type is used to compare sets of data Ranges vertically.

2) Bar:-

Page 128: Oracle Apps-- D2K notes

Bar Chart type is used to compare sets of data Ranges horizontally.

3) Line:-

line chart type is used to show vertical changes for a specific set of data.

4) Mixed:-

Mixed chart combines multiple plot types such as column and line.

5) Double-Y:-

Double Y chart type provides two independent Y-axes On which to plot data.each Y-axis can show a different range of values.

Ex:-one axis can be used to represent no of employees and the second axis can be used to represent emp sal For a specific year.

6) Pie:-

This type chart is used to compare the ratios or percentages of parts of a whole.

Ex:- a pie chart can be used to compare total Sal by Deptno.

7) Table:-

Table chart type is used to show data in a Table format.

8) Scatter

9)High_low

10) Gantt:-

Gantt chart type is used to show sets of Project data over a given amount of time. Gantt charts are generally used to show project milestones timelines.

Ex: - a pie chart can be used to compare total Sal by Deptno.

Page 129: Oracle Apps-- D2K notes
Page 130: Oracle Apps-- D2K notes

Recommended