Monday, March 9, 2015

1.Oracle OAF Overview,Architecture and Benefits.

#OAF Overview

With arrival for R12 and now Oracle Fusion, oracle is moving from Forms based interface to
Web based UI. So now days there is a buzz of OAF and ADF which has been the bases for development of these Web based UI for Oracle ebiz.

Oracle Application Framework(OA Framework) is a proprietary framework developed by Oracle Corporation for application development within the Oracle E-Business Suite.
OA Framework is an architecture for creating web based front end pages and J2EE type of applications within the Oracle EBS ERP platform. In order to develop and maintain OAF functionality, Oracle's JDeveloper tool is used. OA Framework uses the UIX other XML technologies for building the components.

OA Framework is based on J2EE technology called BC4J (Business Components for Java)
The OA Framework is a Model-view-controller (MVC) framework built using J2EE (Java 2 Platform, Enterprise Edition) technologies.

#OAF Architecture
  • OA Framework is based on Model View Controller design pattern.



Model: (Data) implemented using Oracle Business Components for Java (BC4J).

1. EO (Entity Object):Entity Object is based on database table or other data source.Entity   Object contains attributes which represent database columns.All insert/update/delete (DML Operations) transactions go through EO to database.
      2.VO( View Objects ):
   View Objects are based on EO or SQL Query which is again based on EO Objects
   Two types
    1. SQL based
    2. EO based
   Basically VO is synonymous to views used in PLSQL Programming they are used for joining   tables, filtering based on conditions and sorting the data. Entity Objects can be based on any number of EO and provide access to EO.
      3. Application Module:
     Its a container for VO. Once you create a Application Module you need to associate the      corresponding VO to the Application Modules. Access to the VO is always provided through the Application Module.Every Page in OAF Framework need to be associated with a AM.

View: (User Interface) Implemented using an Oracle technology called UIX.
      (UIX = User Interface XML).

Controller: (Code) User actions are handled by the OA Controller.
      (Ex: Clicking “Go” button)
Controller responds to user actions and directs application flow. Model objects like EO and VO can't be accessed directly from theController Class, except AM.
Contains methods such as,
1. ProcessRequest: Fires when OAF page loads for the first time.

2. ProcessFormRequest: Fires when user submits the page.

#Benefits:
  • Consistent and Compelling User Interface
  • Durable Personalization and Extensibility
  • User Interface Interactivity
  • Built-in Security
  • Integrated Development Environment
  • Mobile Support
  • Functional Administration Tool

1.Oracle Alerts With Examples.

Overview: You can use alerts simply to notify one person/multiple persons about an event or some data change. There are two type of alerts
  • Event based Alerts
  • Periodic Alerts
Event based Alerts: These Alerts are fired/triggered based on some change in data in the database. Ex: If you want to notify your manager when you create an item in the inventory you can use Event based alerts. When you create an item in the inventory it will create a new record in mtl_system_items_b, here inserting a record in the table is an event so when ever a new record is inserted it will send the alert. In same alert you can also send the information related to that particular item.
Periodic Alerts: These Alerts are triggered hourly, daily, weekly, monthly or yearly based on your input. Ex: If you want to know list of all items created on that day at the end of day you can use periodic alerts repeating periodically by single day. This alert is not based on any changes to database. This alert will notify you everyday regardless of data exists or not that means even if no items are created you will get a blank notification.
What can be done with Alerts?
  • You can send notifications
  • You can send log files as attachments to notifications
  • You can call PL/SQL stored procedures.
  • You can send approval emails and get the results.
  • Print some content dynamically
How to create an Alert?
  • Study your Business requirement and decide what type of alert you need either periodic alert or event based alert.
  • If you are going for periodic alert decide the frequency
  • If you have chosen event based alert then find out on what event (insert, update, delete) you want to fire the alert.
  • Decide what data need to be included in the alert
  • Based on the data you want in the alert write a SELECT SQL Statement to pull the data.
  • Create a distribution list grouping all the people to whom you want to send the alert.
Navigation:
  • Go to “Alert Manager” Responsibility
  • Alert >> Define
Transfer Alert from one instance/database to other:
  • Go to Alert Manager Responsibility
  • Alert >> Define
  • Go to “Tools” Menu on top
  • Click on “Transfer Alert”
  • Enter source and destination fields and click Transfer.
Screenshots:


Tuesday, March 3, 2015

8.Discoverer Report Migration from One Instance to Another Instance:

#To Move/Migrate the report we can use file->Export and File-> Import (to destination system)

Current Instance:

Select the required objects in the end user layer->Next select the folder name, first move it to selected area.

Again Click on LOV->Select the item class->move

Again click on LOV->select the workbook name->Move it to selected area

Click on next->Provide the name->Finish
(Save the log file for future verification purpose)  The extension is '.eex'

Now go to other instance : Open Administrator Edition->File->Import->Click on Add->Choose file->Next-->Next->Start.

Now the report along with corresponding objects will be imported to this instance,

Tip:Table used to delete existing report:

'delete from EUL5_Documents where doc_name=''Report_Name";

7.Deploying Discoverer Report into Oracle Apps.


After done with creating discoverer report make a note of workbook name and below  are the steps to register a discoverer report in Oracle Apps.

Make sure you followed each and every one correctly.

1. Go to Application Developer-->Function

2. Enter Function , User Function Name, Description(Optional) in Description Tab.
Ex:Function: TEST_DISCO
User Function Name: Discoverer Report
Description: Discoverer Report

3 In Properties Tab
Select Type “SSWA plsql function”
Maintenance Mode Support – None
Context Dependence - Responsibility

4. In Form Tab
Parameters --> Enter the Workbook name created previously

EX: Workbook=TEST_WORKBOOK
In case you want to give some parameters then you can use:
workbook=&parameters=~*~*~*
Example:
workbook=&Parameters=age~26*salary~ 1000*

5. In Web HTML Tab

Enter HTML Call - OracleOasis.RunDiscoverer

6. Now you can add this Function in any existing or new Menu

Also Note that Discoverer Report cannot be invoked when you’ve direct login into Oracle Applications through http://:/dev60cgi/f60cgi

You need to access through logging in from the browser web page. Otherwise it will give an Error.

7. Now navigate to Responsibility which contain the Menu to which you added this function.

8. Click the Function Name to Display the report.

6.Working with Worksheets : Subtotal,Groupsort,grandtotal,Number Format,Line,SQL Inspector


#Subtotal:Go to  tools->Totals->Check the check box->New(Project Status Code)->Count->Insert

Select the column->Change the lable to subtotal. Here you can insert item name also , to change dynamic title ->Ok->Ok.

#Group Sort:To avoid the repetation values in particulor column,we can use this feature. We can display only single time.

Select the column name->Right Click->Group Sort.

#Grand Total: Go to tools->Total->Click on New->Select the radio button->Grand total at bottom->Ok->Ok.

#Number Format:To apply the number format we can use this feature.For every amount field we need to apply the number format.

Select the amount column->Right Click->Format data->Number Tab. Click on decimal place take 2,Check the check box of 1000 separators.

#Line:After Applying group sort we need to display one underline for every grouped results.

#SQL Inspector:In modifying the workbook we need to find out the view name.Follow below steps.

Copy the folder then go to discoverer admin edition->Business Area->Select the folder->Right Click->Properties->Copy Identifier->Go to database->find the script of it->Modify(Here we can see the query with view name).

Note: We can avoid all these steps in Desktop Edition. got to ->SQL Inspector and there we can find the view name in the from clause.

5.Joins,format the results,Export the results,Parameters


#Joins In Discoverer: a join relates two folders using one or more matching items. In the database, a join relates two tables using matching columns.

Type of Joins

Single Item Joins

Multi Item Joins

Joining more than two folders

Non-Equi-Joins

One-to-many joins:Are the most common type of join. With a one-to-many join, one row in the master folder is joined to multiple rows in the detail folder.

One-to-one joins:One-to-one joins are joins between two folders where both items used in the join are primary keys. Therefore only one row in one folder will join to only one (or no) rows in the other folder.

Many-to-Many Joins:Many-to-many joins are not supported directly in Discoverer (or in any relational system). However, many-to-many joins can always be reworked and transformed into multiple one-to-many joins. Very occasionally, a many-to-many join is a valid construct.

#Format the results:With the format exception feature we can highlight with the color based on condition.

Select the particular column->right click->Format Exception

Click on New->Select the column name

Condition->Choose the color->Click on 'OK'.

#Export the Results:With this option we can export the entire output into excel sheet by using 'X' symbol in the tool bar.But with this we can export the results from only one worksheet.
To export all the worksheets from the workbook go to File->Export->Choose the number of Worksheets->Ok

#Parameters:To create new parameters go to tools->Parameters->Click on New(Provide Name,Prompt,Description)

After creation of the parameters we need to change the condition if we are using range of parameters.

Go to tools->Conditions, Use >= From value and <= to value (or) use between & operator.

Note: We can apply same parameters to multiple tabs/worksheets without creating into other sheets.

4.Multiple Worksheets in the same workbook and Scheduling Workbooks.


#We can include multiple worksheets in the same workbook.These worksheets may be created on same folder from same business area (or) other busniess area (or) other

folder from other business area (or) same business area.

To create new sheet go to sheet-> new sheet and click on edit sheet for editing.

#Scheduling:Whenever the report is taking much time to execute we can use this option.

Go to File->Scheduling->Select the required worksheets,mention time and date and frequency.

We can manage the scheduling by using scheduling manager.

File->Manage Workbooks->Scheduling Manager.

3.Creation of Workbooks using Page-detail and Cross tab.


#This chapter explains how to create Workbook using Page details and Cross tab.

• Build a new workbook or worksheet
• Edit a worksheet:

Select the type of display for the new worksheet or workbook:

• Table: Table output has columns of information with headings
• Crosstab: It is also called as drill down approach.Crosstab output looks like a bus or train timetable with values displayed across the top, down the left edge and in the intersection of rows and columns.

  • Normal tables have selected items across the top
  • Crosstabs have items across the top and items down the side

                Values are shown in the grid
                Some kind of aggregate (sum, count, etc.) if necessary

  • Page Items are also useful for filtering data
Example:

• Page-Detail: A page detail layout is a table or crosstab report produced for each value of the page item,such as an account.

Sample Page Item


 Select the data that belongs on the worksheet in the workbook

2.Components and Architecture of Discoverer with Explanation.


#Components:
  • Discoverer Administration Edition
  • Discoverer Desktop Edition
  • Discoverer Plus
  • Discoverer Viewer
#Architecture:

1.End User Layer(EUL):The End User Layer of Discoverer provides a way to mask the underlying complexity of the database to provide end users with an interface they can easily understand.

2.Business Area:A business area is a collection of related information in the database.example,
Ex:information about Sales may be stored in one business area, while information about material is stored in another business area.

3.Business Folders:
  • Simple Folders – Folders that are based on a database table (e.g.: ITEM)
  • Custom Folders – Folders that contain a custom SQL query.
  • Complex Folders – Folders that are based on multiple simple folders.
Security: We will give specific business area access to users under 'Tools->Security.

:: When we open administration in discoverer we can see 4 tabs.

Data-hierarchies-item class-summaries(explanations of all these)

Data:In data tab we can see all the objects and navigation, such as Business Area,Folders and thier properties such as joins,items selected..etc

Hierarchies: We can set up items in a hierarchy to enable end users to drill up and down the hierarchy to view related information.Using Hierarchy Wizard we can create hierarchies.

Discoverer will have two types of hierarchies

1.Date Hierarchy

2.Item Hierarchy

Item Classes:We can display the list of values of the parameters. We can create item_clause in admin edition.Select the folder->expand it->right click->new item clause

Summary Folders:Discoverer summary tables are database tables created by Discoverer Administrator that contain summarized data. Discoverer summary tables contain pre-aggregated and pre-joined data, and can improve query performance in Discoverer Plus and Discoverer Viewer.

We can use the Automated Summary Management (ASM) Wizard to create summary folders in discoverer or else  we can create manually by selecting the option 'Click the I want to specify the summaries myself radio button'.

1.Introduction to Discoverer and Connecting to it.


#Introduction:

Discoverer is reporting tool used to support organizational decisions and data will show in the form of excel format.

Versions:4i,6i,9i,10g,11g

#Connection Steps:

1.Take a copy of TNSNames.ora file for every instance we have separate TNS Names entry in tnsnames.ora file

2. we need to keep in network/admin folder in the discoverer home

Ex:Path : D:/Discoverer/Network/Admin

For every instance TNS Entry is same,only 'host name' and 'port number' and 'service name id' will vary. In place of host name,port number we can see the server id address also some times.

After Every Cloning the '.dbc' files will change , we need to download fresh '.dbc' file related to any instance and keep into secure folder

Set the environment variable initially

We usually download the .dbc files from unixbox by using any FTP(ex: putty,filezillah,toad..etc)

EUL Settings:

Oracle Discoverer administrator->tools->options->choose the option

*connect to both standard and application EUL's gateway

userid/pwd(applsys/pub)

Foundation Name: APPS

Monday, March 2, 2015

6.User Exits in Oracle Reports.

#User Exits in Oracle Reports.
User exit when called from Report triggers moves the control from report to this outside program there it performs the action programmed and returns back to report environment. 
The program which makes USER to EXIT from ongoing environment to perform certain action is USER EXIT. 
We can integrate Oracle reports with Oracle Application Object Library, and run them as concurrent programs from your forms or through standard request submission.
Below are the user exits available in Oracle Reports that makes AOL integration.
FND SRWINIT:
When "FND SRWINIT" user exit is called  in the report's Before Report trigger, the user exit uses the passed request id to query the Oracle Applications context that the concurrent request was submitted in (via the FND_CONCURRENT_REQUESTS table) and then log on with that context.

function BeforeReport return boolean is
begin
  SRW.user_exit('FND SRWINIT');
  return (TRUE);
end;
FND SRWEXIT:
It is used to free the memory which has been allocated by the other user exits.
FND SRWEXIT ensures that all the memory allocated for Oracle AOL user exits has been freed up properly. It is called in After Report trigger.

function AfterReport return boolean is
begin
  srw.user_exit( 'FND SRWEXIT' );
    RETURN (TRUE);
  --return (TRUE);
end;
FND FORMAT_CURRENCY:
It is used for MULTIPLE CURRNECY REPORTING (MRC).
This user exit formats the currency amount dynamically depending upon the precision
of the actual currency value, the standard precision, whether the value is in a mixed
currency region, the user's positive and negative format profile options, and the
location (country) of the site.

Syntax

FND FORMAT_CURRENCY
CODE=":column containing currency code"
DISPLAY_WIDTH="field width for display"
AMOUNT=":source column name"
DISPLAY=":display column name"
[MINIMUM_PRECISION=":P_MIN_PRECISION"]
[PRECISION="{STANDARD|EXTENDED}"]
[DISPLAY_SCALING_FACTOR="":P_SCALING_FACTOR"]

FND FLEXIDVAL:
This API is used for get descriptions from flexfields, gets input from FND FLEXSQL.
This user exit is called to populate fields for display. The key flexfields data retrieved by the query is passed into this exit from the formula column. With this exit values, descriptions and prompts can be displayed by passing appropriate token (any one of VALUE, DESCRIPTION, APROMPT or LPROMPT).

Syntax:

FND FLEXIDVAL
CODE="flexfield code"
APPL_SHORT_NAME="application short name"
DATA=":source column name"
[NUM=":structure defining source column/lexical"]
[DISPLAY="{ALL|flexfield qualifier|segment number}"]
[IDISPLAY="{ALL|flexfield qualifier|segment
    number}"]
[SHOWDEPSEG="{Y | N}"]
[VALUE=":output column name"]
[DESCRIPTION=":output column name"]
[APROMPT=":output column name"]
[LPROMPT=":output column name"]
[PADDED_VALUE=":output column name"]

[SECURITY=":column name"]

FND FLEXSQL:

FND FLEXSQL:


This fragment allows to SELECT flexfield values or to create a WHERE, ORDER BY, GROUP BY, or HAVING clause to limit or sort the flexfield values returned by the SELECT statement.This user exit is called once for each fragment you need for your select statement. All flexfield columns are defined in your report as type CHARACTER even though the table may use NUMBER or DATE or some other datatype.
This user exit FND FLEXSQL is called  with different arguments to specify that part of the query you would like to build.The user exit retrieves the appropriate column names (SQL fragment) and inserts it into the lexical parameter at runtime before the SQL query is executed.

Syntax:

FND FLEXSQL
CODE="flexfield code"
APPL_SHORT_NAME="application short name"
OUTPUT=":output lexical parameter name"
MODE="{ SELECT | WHERE | HAVING | ORDER BY}"
[DISPLAY="{ALL | flexfield qualifier | segment
    number}"]
[SHOWDEPSEG="{Y | N}"]
[NUM=":structure defining lexical" |
    MULTINUM="{Y | N}"]
[TABLEALIAS="code combination table alias"]
[OPERATOR="{ = | < | > | <= | >= | != | "||" |
    BETWEEN | QBE}"]
[OPERAND1=":input parameter or value"]
[OPERAND2=":input parameter or value"]

Note:

1. We use the User Exits in the Report triggers like before report, after report, before parameter form, after parameter form.
2. We have to create a mandatory parameter called P_CONC_REQUEST_ID when we work with FND SRWINIT, FND SRWEXIT. We have to create these variables.

P_CONC_REQUEST_ID Number(20) --
P_Struct_Num Number(20) --
P_Flex_Data Char(6000) (Segment1||' '||Segment2......||Segmentn)
3. The user exits are case sensitive we have to write them in capital letters only otherwise they will raise an error.

5.Anchoring Objects In Oracle Reports.

#Anchoring Objects In Oracle Reports.
An anchor defines the relative position of an object to the object to which it is anchored. Anchors are used to determine the vertical and horizontal positioning of a child object relative to its parent. Since the size of some layout objects may change when the report runs (and data is actually fetched), you need anchors to define where you want objects to appear relative to one another.
There are two types of anchors in Oracle Reports:
* implicit (anchors that Oracle Reports creates when a report is run)
* explicit (anchors you create)
Implicit Anchors : At runtime, Oracle Reports generates an implicit anchor for each layout object that does not already have an explicit anchor. It determines for each layout object which objects, if any, can overwrite it, then creates an anchor from the layout object to the closest object that can overwrite it. This prevents the object from being overwritten. The implicit anchor functionality saves you from having to define the positioning of each object. Implicit anchors are not visible in the Layout editor. However, you can specify that the Object Navigator display anchoring information using the Object Navigator Options dialog.
Explicit Anchors : Create an anchor in the Layout editor by clicking on the Anchor tool, dragging from one edge of the child to the one of the parent’s edges, then specifying the anchor’s properties in its property sheet. Any anchor you create for an object will override its implicit anchoring. Explicit anchors are always visible in the Layout editor unless you specify otherwise via the Layout Options dialog.





4.About SRW Package.

#About SRW Package.

SRW (Sql Report Writer) Package is a built in package in Oracle ReportsBuilder. It is a collection of PL/SQL constructs that include many functions, procedures, and exceptions you can reference in any of your libraries or reports.
The PL/SQL provided by the SRW package enables you to perform such actions as change the formatting of fields, run reports from within other reports, create customized messages to display in the event of report error, and execute SQL statementsThere are nearly 70 functions, procedures, and exceptions are there in this package. Here I am giving brief information and uses of few important functions, procedures, and exceptions.
SRW.MESSAGE:
It is a Procedure that displays a message with the message number and text that you specify. It is mainly used to debug a report in Reports Builder.
SRW.MESSAGE(msg_number NUMBER, msg_text CHAR);
Example:
function foo return boolean is
begin
  if :sal < 0 then
    SRW.MESSAGE(100, 'Found a negative salary. Check the EMP table.');
    raise SRW.PROGRAM_ABORT;
  else
    :bonus := :sal * .01;
  end if;
  return(true);
end;

SRW.PROGRAM_ABORT:
This exception stops the report execution and raises the following error message: REP-1419: PL/SQL program aborted. SRW.PROGRAM_ABORT stops report execution when you raise it.
SRW.DO_SQL:
This procedure executes the specified SQL statement from within Reports Builder. The SQL statement can be DDL (statements that define data), or DML (statements that manipulate data). DML statements are usually faster when they are in PL/SQL, instead of in SRW.DO_SQL.
Since you cannot perform DDL statements in PL/SQL, the SRW.DO_SQL packaged procedure is especially useful for performing them within Reports Builder.
Example:
FUNCTION CREATETABLE RETURN BOOLEAN IS
BEGIN
  SRW.DO_SQL('CREATE TABLE TEST_EMP (EMPNO NUMBER NOT NULL
    PRIMARY KEY, SAL NUMBER (10,2)) PCTFREE 5 PCTUSED 75');
    RETURN (TRUE);
   EXCEPTION
    WHEN SRW.DO_SQL_FAILURE  THEN
    SRW.MESSAGE(100, 'ERROR WHILE CREATING TEST_EMP TABLE.');
    RAISE
    SRW.PROGRAM_ABORT;
END;

SRW.DO_SQL_FAILURE:
Reports Builder raises this exception when the SRW.DO_SQL packaged procedure fails. This exception stops the report execution and raises the following error message:
REP-1425: Error running DO_SQL package – REP-msg ORA-msg.
SRW.GET_REPORT_NAME:
This function returns the file name of the report being executed.
SRW.GET_REPORT_NAME (report_name);
Example:
function AfterPForm return boolean is
    my_var varchar2(80);
  BEGIN
    SRW.GET_REPORT_NAME (my_var);
    SRW.MESSAGE(0,'Report Filename = '||my_var);
   RETURN (TRUE);
  END;

SRW.RUN_REPORT:
This procedure synchronously executes the specified report within the context of the currently running report.
SRW.RUN_REPORT (“report=test.rdf … “)
SRW.SET_FIELD:
This procedure sets the value of a character, number, or date field. This is useful when you want to conditionally change a field’s value.
SRW.SET_FIELD (object_id, text CHAR | number NUM | date DATE);
Example:
Suppose you want to conditionally change the number of a field, based on each employee’s salary. In the format trigger for the field, you could type the following:
FUNCTION CHGFIELD RETURN BOOLEAN IS
TMP NUMBER;
 BEGIN
  if :sal >= 5000 then
  tmp := :sal * 1.10;
  srw.set_field (0, tmp);
 else
  srw.set_field (0, 4000);
 end if;
 RETURN (TRUE);
END;

SRW.SET_FIELD should be used only to change the contents of a field’s datatype, not change the field to a different datatype.
Others in Brief:
  • SRW.SET_FONT_FACE: This procedure specifies font face for a CHAR, DATE, or NUMBER field. SRW.SET_FONT_FACE(‘arial’);
  • SRW.SET_FONT_SIZE: This procedure specifies font size for a CHAR, DATE, or NUMBER field. SRW.SET_FONT_SIZE(10);
  • SRW.SET_FONT_STYLE: This procedure specifies font style for a CHAR, DATE, or NUMBER field. SRW.SET_FONT_STYLE(SRW.ITALIC_STYLE);
  • SRW.SET_FORMAT_MASK: This procedure specifies the format mask for the DATE or NUMBER field. SRW.SET_FORMAT_MASK(‘mask’);
  • SRW.SET_TEXT_COLOR: This procedure specifies the global text color of the CHAR, DATE, or NUMBER field. SRW.SET_TEXT_COLOR(‘color’);

3.Types of Triggers in Oracle RDF reports and their sequence of execution.

#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 
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; 
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; 
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;
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; 
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. 

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..