Thursday, December 11, 2008

Best Practices in Report Development

The Information drawn from some of standard documents and Development Experience.
These Tips are helpful to the Developers to maintain standards during OracleApplication Reports Development.

Before Starting Report:
The following points to be considered before starting report development:
Mode: Report Development can be done by two modes
i. Character Mode
ii. Bit Mapped.

To Set the Character Mode: Yes in Reports Property
If it is Bitmapped report then the above should be NO.
In System Parameter the Mode Parameter, initial value should be made as character orBitmapped.

Report Style
Portrait: if it is Portrait then the size would be like (80 * 66)
Landscape: 132 * 66
Land wide: 180 * 66.

The initial value should be set at system parameters ‘Orientation’.

Using Triggers in Reports:
There are 5 main triggers in Report and they can be used for different purposesas per the sequence of fire we have to write logic on that :

Before Report Trigger
For initializing environment or using User Exits we can use this trigger
It will set the profile option values.It can also be used to select the organization automatically.

After Report Trigger
This will ensure that memory allocated for AOL user exit is freed up now.

Naming Conventions
Query and Group Names
The query and group name should be meaningful as :Q_Headers ,Q_Lines, G_Headers etc.
This practice will help us to recognizeThe contents or purpose of the query.

Fields, Repeating frames, Boiler Texts
In the layout fields name should be similar to database column names.And repeating frames must reflect the relevant groups. This is useful torecognize the field or boiler palette or tracking the error of layout.

Bind Parameters Bind parameters should start by ‘P’
Lexical Parameters should start by ‘LP’.

Exception Handling
In Programming units and formula columns we should handle possible
Exceptions as ‘NO DATA FOUND’ (one of them).
In Numeric formula Columns always handle Zero Divide error and use NVL
Valmont := (:quantity * :rate) / :xyz
Here if :xyz is Zero then we will get Zero Divide Error.
We should implement above logic as :
-----> V_Amount := (NVL(:qty,0) * NVL(:rate,0) / NVL(:xyz,1);

Using %type
While defining the data types in program units using %type is better practice,

function F_E MPFormula return Number is
Instead of :-
function F_E MPFormula return Number is
V_EMPNO number (10);

Debugging Reports
We can use srw.message to debug the report.
The output of it we can see at log file of that report.

No Data Found
For displaying NO DATA FOUND in the Report if the query is not returns anyrows. Make a text field “NO DATA FOUND” in the layout of the Report, Make asummary column that will give count of any not null field in the report , and in theformat trigger the logic should bre like if count >0 thenreturm true else return false .

To display END OF REPORT at the last line of the report just place an Text “END OFREPORT”, aligned center in the layout of the report.

No comments: