#Triggers check for an event.When the event occurs they run PL/SQL code associated with the trigger.
Report triggers execute PL/SQL functions at specific times during the execution and formatting of your report. Using the conditional processing capabilities of PL/SQL for these triggers, you can do things such as customize the formatting of your report, perform initialization tasks, and access the database. To create or modify a report trigger, use Report Triggers in the Object Navigator. Report triggers must explicitly return TRUE or FALSE. Report Builder has five global report triggers (you cannot create new global report triggers):
There are eight report triggers.
Global triggers called the Report Triggers
Global triggers called the Report Triggers
1.Before Parameter Form trigger:BEFORE PARAMETER FORM will fire before the parameter form is going to open.
Example:
function BeforePForm return boolean is
begin
srw.message(100,'before parameter form trigger');
return (TRUE);
end;
Example:
function BeforePForm return boolean is
begin
srw.message(100,'before parameter form trigger');
return (TRUE);
end;
2.After Parameter Form trigger:AFTER PARAMETER FORM will fire after the parameter form is opened and after passing the parameter.
Example:
function AfterPForm return boolean is
begin
SRW.MESSAGE(101,'after parameter form trigger ');
return (TRUE);
end;
Example:
function AfterPForm return boolean is
begin
SRW.MESSAGE(101,'after parameter form trigger ');
return (TRUE);
end;
3.Before Report trigger: BEFORE REPORT TRIGGER will fire before fetching the data from database.
Example:
function BeforeReport return boolean is
begin
SRW.MESSAGE(102,'before report trigger');
return (TRUE);
end;
Example:
function BeforeReport return boolean is
begin
SRW.MESSAGE(102,'before report trigger');
return (TRUE);
end;
4.Between Pages trigger: BETWEEN PAGES will fire when we are moving from one page to another page
Example:
function BetweenPage return boolean is
begin
SRW.MESSAGE(108,'between PAGE trigger');
return (TRUE);
end;
Example:
function BetweenPage return boolean is
begin
SRW.MESSAGE(108,'between PAGE trigger');
return (TRUE);
end;
5.After Report trigger : AFTER REPORT TRIGGER will fire when ever we are closing the output of the report
Example:
function AfterReport return boolean is
begin
SRW.MESSAGE(102,'after report trigger');
return (TRUE);
end;
Other Triggers :
(1) Validation Triggers:Validation Triggers are PL/SQL functions that are executed when parameter values are specified on the command line and when you accept the Runtime Parameter Form. (Notice that this means each Validation Trigger may fire twice when you execute the report). Validation Triggers are also used to validate the Initial Value of the parameter in the Parameter property sheet.
(2) Format Triggers:Format Triggers are PL/SQL functions executed before the object is formatted. The trigger can be used to dynamically change the formatting attributes of the object.
(3) Action Triggers:Action Triggers are PL/SQL procedures executed when a
button is selected in the Previewer.The trigger can be used to dynamically call another report
(drill down) or execute any other PL/SQL.
Example:
function AfterReport return boolean is
begin
SRW.MESSAGE(102,'after report trigger');
return (TRUE);
end;
Other Triggers :
(1) Validation Triggers:Validation Triggers are PL/SQL functions that are executed when parameter values are specified on the command line and when you accept the Runtime Parameter Form. (Notice that this means each Validation Trigger may fire twice when you execute the report). Validation Triggers are also used to validate the Initial Value of the parameter in the Parameter property sheet.
(2) Format Triggers:Format Triggers are PL/SQL functions executed before the object is formatted. The trigger can be used to dynamically change the formatting attributes of the object.
(3) Action Triggers:Action Triggers are PL/SQL procedures executed when a
button is selected in the Previewer.The trigger can be used to dynamically call another report
(drill down) or execute any other PL/SQL.
Before Report trigger and After Report trigger should be declared compulsory. In the Before Report trigger we declare the srw.user_exit(‘ fnd srwinit’) user exist and in the After Report trigger srw.user_exit (‘fnd srwexit’)
The sequence/order of events when a report is executed is as follows:
Before Parameter Form trigger is fired.
1 Runtime Parameter Form appears (if not suppressed).
2 After Parameter Form trigger is fired (unless the user cancels from the Runtime Parameter
Form).
3 Report is "compiled."
4 Queries are parsed.
5 Before Report trigger is fired.
6 SET TRANSACTION READONLY is executed (if specified via the READONLY argument
or setting).
7 The report is executed and the Between Pages trigger fires for each page except the last one.
(Note that data can be fetched at any time while the report is being formatted.) 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.
8 COMMIT is executed (if READONLY is specified) to end the transaction.
9 After Report trigger is fired.
10 COMMIT/ROLLBACK/NOACTION is executed based on what was specified via the
ONSUCCESS argument or setting..
Before Parameter Form trigger is fired.
1 Runtime Parameter Form appears (if not suppressed).
2 After Parameter Form trigger is fired (unless the user cancels from the Runtime Parameter
Form).
3 Report is "compiled."
4 Queries are parsed.
5 Before Report trigger is fired.
6 SET TRANSACTION READONLY is executed (if specified via the READONLY argument
or setting).
7 The report is executed and the Between Pages trigger fires for each page except the last one.
(Note that data can be fetched at any time while the report is being formatted.) 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.
8 COMMIT is executed (if READONLY is specified) to end the transaction.
9 After Report trigger is fired.
10 COMMIT/ROLLBACK/NOACTION is executed based on what was specified via the
ONSUCCESS argument or setting..
No comments:
Post a Comment