101
Oracle Applications 11i Reports

Oracle D2K reports

Embed Size (px)

Citation preview

Page 1: Oracle D2K reports

Oracle Applications 11i Reports

Page 2: Oracle D2K reports

2

Topics

Reporting Tools Reporting Tools for Oracle Applications Oracle application with Reports 6i Character/Bitmapped Reports Building a Report Report Registration Process in OA Usage of User Exits

Page 3: Oracle D2K reports

3

Reporting Tools

Many organizations struggle with the question – What is the best applications reporting solution for its requirements?

Page 4: Oracle D2K reports

4

Reporting Tools

Decision Making

Type of Reporting tool, Which satisfies the Reporting Needs of organization.

Page 5: Oracle D2K reports

5

Reporting Tools

Following Points influence in Decision Making:

Different User communities with potentially Different Information accessing the same Information Source.

The version of Oracle Applications. Expertise in User Community. Level of Technical Support.

Page 6: Oracle D2K reports

6

Reporting Tool Selection Plan

Reporting Tools

Page 7: Oracle D2K reports

7

Reporting Tools

Understanding the User Audience

Page 8: Oracle D2K reports

8

Reporting Tools

Determine Appropriate Tool Category.

Ensure that the selection process (mentioned in the previous slides) does not overlook business requirements that are not met by reports 6i, XML Publisher, BIS and discoverer.

Oracle Reporting Tools (Major).

Oracle Reports. Oracle XML Publisher Oracle Discoverer. Oracle’s business intelligence suite (BIS).

Page 9: Oracle D2K reports

9

Scope

Oracle Reports 6i

The Scope of this presentation is

Page 10: Oracle D2K reports

10

Reporting Tools for 11i

Oracle Reports6i

Oracle reports is an enterprise reporting tool that allows organizations to build and publish high quality, dynamically generated reports.

Most often reporting consists of multiple queries within a single report that may span across several functional areas.

Oracle reports fits into this reporting category where reporting tends to answer questions like daily sales, current available inventory against today’s sales reservations etc.

These are real-time reports accessing the production database directly.

Page 11: Oracle D2K reports

11

Reports 6i

Character Mode ReportsCharacter mode reports run faster. Following are the Pre requisites for designing a report in character mode

Set the Reports Design in Character Units property to ‘yes’

Set the report width and report height For Landscape 132 or 180 as width and 66 as

heightFor Portrait 102 as width and 85 or 116 as height

Page 12: Oracle D2K reports

12

Oracle Apps11i With Report 6i

In the properties of the mode system parameter set the initial value field to character.

In the layout editor’s view menu: switch grid snap on, and in options ~ ruler settings set the number of snap points per grid spacing to one.

Don’t use objects that are not consistent with character mode output e.g. images, colors , drawings, italics, ellipses, diagonal lines, drill down buttons, multimedia etc.

Page 13: Oracle D2K reports

13

Oracle Apps11i With Report 6i

Bitmap Reports

Bitmap reports are used for generating either PCL or Postscript type Reports.

These reports use different fonts or incorporate graphics images into a report.

We can also build reports of type PDF, but these are set up differently and are not bitmap reports.

Page 14: Oracle D2K reports

14

Oracle Apps11i With Report 6i

Following are the Pre requisites for designing a report in Bitmap mode

Go to reports designer, under data model, open up the system parameters, right click on DESTYPE and select properties, enter printer as the initial value and click OK.

Right click on MODE and select properties enter BITMAP as the initial value and click OK.

Page 15: Oracle D2K reports

15

Oracle Apps11i With Report 6i

Character Mode Bitmap Mode

Output uses Fixed Font Output uses Proportional Fonts.

Font type, size, or style does not hold any meaning.

Font type, size, or style does hold meaning

Object gets mapped exactly to a set of character-cells without any overlapping

Objects gets mapped with overlapping.

Differences Between Character and Bitmap Report

Page 16: Oracle D2K reports

ReportQuery

PL/SQL LibraryTemplate

SELECT...

FROM...

Report Builder Modules

Page 17: Oracle D2K reports

Data & Layout

Page 18: Oracle D2K reports

Report Level Objects

ParameterForm

DataModel

LayoutModel

Properties TriggersPL/SQLprogram

units

Report

Page 19: Oracle D2K reports

DataModel

QueriesDatalinks

Groups

ParametersColumns

Columns

Data Model Objects

Page 20: Oracle D2K reports

Layout Model Objects

Frames BoilerplateRepeating

framesFields

OLE2

LayoutModel

Page 21: Oracle D2K reports

Parameter Form Objects

ParameterForm

Fields Boilerplate

Page 22: Oracle D2K reports

Report File Types

Type

.rdf

.

Description

Full report definition

(includes source code and comments)

Modifiable through Builder

Binary, executable

Page 23: Oracle D2K reports

Tabular Report

Employee List

Emp No Name Salary

Page 24: Oracle D2K reports

Master Detail Report

Department Name

Emp Name Salary

Department Name

Department Details

Emp Name Salary

Page 25: Oracle D2K reports

Matrix Report

Job Title

Dept No

Department Salaries

Page 26: Oracle D2K reports

Creating a Tabular Report

• Wizard Pages

• Report Style

• Query Type

• Data Query

• Fields

• Totals

• Labels

• Template

Page 27: Oracle D2K reports

Query Builder

Page 28: Oracle D2K reports

Building a Query

Page 29: Oracle D2K reports

Additional Default Layout

Page 30: Oracle D2K reports

Selecting Fields to Display

Page 31: Oracle D2K reports

Summaries and Labels

Page 32: Oracle D2K reports

Select a Report Template

Page 33: Oracle D2K reports

View the Report Output

Page 34: Oracle D2K reports

Saving the Report

Abc.rdf xyz.rdf

File Save As

File—>Save

Page 35: Oracle D2K reports

Live Previewer

1 2

3

4

Page 36: Oracle D2K reports

Data Model

Page 37: Oracle D2K reports

Group Hierarchy

1

2

Page 38: Oracle D2K reports

Using Data Links

Deptno Dname

10 ACCOUNTING

20 RESEARCH

JONES

SCOTT

20

20

Ename Deptno

Dept.deptno=Emp.deptno

Dept

Emp

Page 39: Oracle D2K reports

Creating a Column-to-Column Link

Page 40: Oracle D2K reports

Create a Column

What type of value? Choose the correct column tool

What frequency? Create in a group or at report level

CP_1

CP_1

Page 41: Oracle D2K reports

Data Model Columns

1

2

43

5

Page 42: Oracle D2K reports

Summary Column

Specific properties: Function Source Reset At

Datatype depends on Source Datatype

Page 43: Oracle D2K reports

Formula Column

Performs a user-defined computation Executes a PL/SQL function Must return a value Can be Character, Number, or Date Returned value must match datatype

function CF_Total_salFormula return Number isbegin return(:sal+nvl(:comm,0));end;

Page 44: Oracle D2K reports

Placeholder Column

An empty container at design time

Populated by another object at run time Before Report trigger Formula column at report

level Formula column in same

group or below placeholder

CP_1

CF_1

Page 45: Oracle D2K reports

Populating Placeholder Column

Page 46: Oracle D2K reports

User Parameters

Restrict values in a WHERE clauseSELECT EMPNO,ENAME,JOB

FROM EMP

WHERE DEPTNO = <a value>

Substitute any part of a SELECT statement

SELECT EMPNO,ENAME,JOB

FROM EMP

<a where clause>

Substitute a single column or expression

SELECT

FROM EMP

<a column/expression>

Page 47: Oracle D2K reports

Creating a User Parameter

Page 48: Oracle D2K reports

Referencing Parameters

In Report Query Bind reference replaces a value:

:parameter_name Parameter object may be created by default

Lexical reference replaces a clause: &parameter_name Parameter object may be created by default

Page 49: Oracle D2K reports

Using Bind References

SELECT empno, ename,job

FROM emp

WHERE deptno = :dept_id

Restrict values in a WHERE clause

Page 50: Oracle D2K reports

Using Lexical References

Use to Substitute any part of the query

SELECT empno,ename,jobFROM emp&P_WHERE_CONDITION&P_ORDER_BY

Note: Ensure that the number of values and datatypes match at runtime

Page 51: Oracle D2K reports

Layout Model - Different Sections of Report

Main section

Page 1 of 1

EmployeesReport

Header section

End of report Trailer section

Page 52: Oracle D2K reports

Layout Objects

The tool palette contains: Standard GUI drawing tools Frame, repeating frame, field objects Other layout objects

Drawing Tools

Text

Repeating FrameLink File

ButtonOLE2 object

Frame

FieldChart

Anchor

Additional Default Layout

Page 53: Oracle D2K reports

Layout Object Properties

Objects with common properties: Frames Repeating Frames Fields Boilerplate Objects

Some common properties affect: Sizing Pagination Frequency of display

Page 54: Oracle D2K reports

Sizing Objects

Elasticity

Layout icons

Vertical Horizontal

fixed

expand

contract

variable

Page 55: Oracle D2K reports

Print Frequency

Print Object On = All Pages Base Printing On = Enclosing Object

Employee Report Employee Report

-1-

Employee Report

-2-

Employee Report

-3-

Page 56: Oracle D2K reports

PL/SQL Triggers in Reports

• Describe the different types of triggers• Describe sample uses of triggers• Write and reference common code• Create a PL/SQL library

Page 57: Oracle D2K reports

Types of Triggers in Reports

Report Level:

Five triggers Report Triggers node in Object Navigator

Layout:

Format trigger on most objects

Page 58: Oracle D2K reports

Trigger Code

TrueFalse

CharacterNumber

Date

Page 59: Oracle D2K reports

Before Parameter Form

After Parameter Form

Before Report Between pages After Report

Sequence of Firing

Page 60: Oracle D2K reports

Using Report Triggers

After Parameter Form Example : Build Dynamic Where Clause

SELECT empno,ename,job,sal,deptnoFROM emp&P_WHERE_CLAUSE

function AfterPForm return boolean isbegin IF :p_dept_id is null then :p_where_clause:=''; ELSE :p_where_clause:='where deptno=:p_dept_id'; END IF; return (TRUE);end;

Page 61: Oracle D2K reports

Using Layout Triggers

Format triggers: Exist on most layout objects Can suppress an entire layout section (master group

frame): No records fetched Can suppress the display of individual records (repeating

frame): All records fetched

Page 62: Oracle D2K reports

Writing Common Code

At Report level: Object Navigator, Program Units Menu: Program—>PL/SQL Editor

In a library: Object Navigator, PL/SQL Library File—>New: Create new library File—>Open: Add to existing library Attach library to report

Page 63: Oracle D2K reports

Report Builder Built-in Package

• Describe the package contents• Output messages at run time• Execute a drill-down report• Create and populate temporary tables• Modify visual attributes dynamically

Page 64: Oracle D2K reports

SRW Package

Standard Report Writer Package A collection of PL/SQL constructs that contains many

functions, procedures, and exceptions You can reference in any of your libraries or reports.

Note: You cannot reference constructs in the SRW package from another product, e.g., from SQL*Plus.

Page 65: Oracle D2K reports

Contents of SRW Package

SRW.SET_BOOKMARK

SRW.SET_ATTR

SRW.DO_SQL

SRW.RUN_REPORT

SRW.REFERENCE

SRW.SET_MAXROW

SRW.MESSAGE

SRW.PROGRAM_ABORT

Page 66: Oracle D2K reports

Displaying Messages

Warning

WHEN <exception> THEN SRW.MESSAGE(999, 'Warning: An error occurred in report');

Error

WHEN <exception> THEN SRW.MESSAGE(999, 'Error: Table creating failed.’);

Page 67: Oracle D2K reports

Performing SQL Statements

Example

SRW.DO_SQL('CREATE TABLE LOG_TABLE(USER_NAME VARCHAR2(40), DATE_EXEC VARCHAR2(11)' );

SRW.DO_SQL('INSERT INTO LOG_TABLE(USER_NAME,DATE_EXEC) VALUES(:P_USER_NAME,sysdate)');

SRW.DO_SQL_FAILURE

Exception

Page 68: Oracle D2K reports

68

Oracle reports provides a suite of PL/SQL procedures in the SRW package. The user_exit procedure in this package allows you to call user exits (pro C routines) and oracle apps reports use quite a lot of these calls. The user exits available in oracle reports are:

—FND SRWINIT—FND SRWEXIT—FND FLEXIDVAL—FND GETPROFILE & FND PUTPROFILE.—FND calculate.—FND FORMAT_CURRENCY

Usage of User Exits

Page 69: Oracle D2K reports

69

FND SRWINIT

Sets your profile option values and allows oracle application object library user Exits to detect that they have been called by a oracle reports program.

You always call FND SRWINIT from the before report trigger as follows:

SRW.User_exit('FND SRWINIT');

This user exit is important, where, in a multi-org environment to ensure your report displays data from the user’s organization.

Usage of User Exits

Page 70: Oracle D2K reports

70

FND SRWEXIT

Ensures that all the memory allocated for application object library user exits has been freed. Up properly.

You always call FND SRWEXIT from the after report trigger as follows:

SRW.USER_EXIT('FND SRWEXIT');

Usage of User Exits

Page 71: Oracle D2K reports

71

FND GETPROFILE & FND PUTPROFILE.

These user exits let you retrieve and change the value of a profile option.

FND calculate.

Use this routine to calculate the result of an unlimited number of operands and operators.

Usage of User Exits

Page 72: Oracle D2K reports

72

FND FLEXSQL

This user exit can be called to create a SQL fragment.

Used by the report to tailor the SELECT statement that retrieves flexfield values.

This fragment allows you 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 your SELECT statement.

The flexfield columns defined in the report should be of data type CHARACTER even though the table may use NUMBER / DATE.

Usage of User Exits

Page 73: Oracle D2K reports

73

FND FLEXIDVAL This user exit is called to populate fields for display. Pass the

key flexfield data retrieved by the query into this user exit from the formula column and the display values and descriptions and prompts by passing appropriate token.

FND format_currency

This user exit formats the currency amount dynamically depending upon:The precision of the actual currency value.The user's positive and negative format profile optionsThe location (country) of the site : The location of the site

determines the thousands separator and radix to use when displaying currency values.

Usage of User Exits

Page 74: Oracle D2K reports

74

Ensure you have required parameters.Ensure that the following parameters are defined using the oracle reports parameter screen, these will be used in the user exit calls and SQL statements.

P_CONC_REQUEST_ID.You always create this lexical parameter. "FND SRWINIT" uses this parameter to retrieve information about this concurrent request.

P_MIN_PRECISION.You reference this lexical parameter in your FND FORMAT_CURRENCY user exit call.

P_FLEXDATA Character 600-6000

P_STRUCT_NUM Character15 Initial value = 101

Usage of User Exits

Page 75: Oracle D2K reports

75

Report Registration Process in OA

Report Deployment.

Typically the report will be developed on a PC, so when it is ready to test in the oracle applications environment, you must:

Upload your .rdf file to the server box, ensure file is uploaded properly. If the .rdf is not properly not uploaded the report will fail with a signal 10 error.Place the .rdf file it in the correct directory.

Each product (eg. GL, AP etc) will have a directory structure and you will need to place the report in the report sub-directory of the appropriate product. Typically the directory structures will have names like ONT_TOP and are relatively easy to identify. You should always place your custom reports in “mod” directories.Ensure your report has the appropriate file permission’s which allow the oracle concurrent manager to execute it (using chmod etc).

Page 76: Oracle D2K reports

76

Register your report within oracle applicationsNavigate to application developer responsibility after logging in to Oracle Applications

Report Registration Process in OA

Page 77: Oracle D2K reports

77

Concurrent executable

Report Registration Process in OA

Page 78: Oracle D2K reports

78

Identify the report to the AOL layer.The execution file name is the operating system file name

(without the extension) The application field tells the AOL layer where to look for

this file.

Report Registration Process in OA

Page 79: Oracle D2K reports

79

Concurrent Program

Report Registration Process in OA

Page 80: Oracle D2K reports

80

This step sets up the report so it can be submitted by the concurrent manager, identifying parameters which must be passed etc. The Executable Name field is the link to the previous step. The Program name field and Description will appear in the List of Values users see, so they should be functionally descriptive.

Report Registration Process in OA

Page 81: Oracle D2K reports

81

Request Section MLS Function

The Multilingual Concurrent Request feature allows a user to submit a request once to be run multiple times, each time in a different language. If this program utilizes this feature the MLS function determines which installed languages are needed for the request.

Use in SRS Run Alone Enable Trace Allow disabled values Restart on system failure

Report Registration Process in OA

Page 82: Oracle D2K reports

82

Output Section Format Save Print Columns Rows Style Style Required Printer

Report Registration Process in OA

Page 83: Oracle D2K reports

83

Oracle Reports Parameters.Use the Parameters button to open the window shown below and define the parameters that the report should prompt the user for. Notice that the Token field links the parameters you list here to the parameters which your report is expecting. It is not case sensitive.

Report Registration Process in OA

Page 84: Oracle D2K reports

84

Concurrent manager passes program arguments to your.

Oracle reports program using tokens (so that their order does not matter), you should write your program to receive arguments in the same order that you specify when you call your program and pass arguments for easier maintenance.

Oracle reports program parameters should not expect NULL.

Values. The concurrent manager cannot pass a NULL value to your program.

Tip :It is always suggested to start the parameter sequence from 10 and increment by 10 or as desired.

Report Registration Process in OA

Page 85: Oracle D2K reports

85

If your report should not be run at the same time as any other report or process (perhaps even itself) then use the Incompatibilities button to open the window shown below and identify them.

Report Registration Process in OA

Page 86: Oracle D2K reports

86

Copy the report

Copy

Report Registration Process in OA

Page 87: Oracle D2K reports

87

Add your report to the appropriate request groups.This is usually performed by the (functional) system administrator however you may need to do it in the test environment at least.

Using the system administrator responsibility, Menu path: Security Responsibility Request.

Report Registration Process in OA

Page 88: Oracle D2K reports

88

Reports are made available to users by adding them to the Request Group assigned to a Responsibility which in turn is assigned to users. This effectively makes your report appear in the List of Values which the user sees in the Standard Report Submission screen.

In the top half of the screen, query back the Request Group to which you wish to add your report and then in the lower half of the screen create a new record, select your report name and save.

Report Registration Process in OA

Page 89: Oracle D2K reports

89

FND Packages

Concurrent Program and Request Set Loaders

FND_Program and FND_Request Used to programmatically create:

Concurrent executables Concurrent Programs Parameters for Concurrent Programs Concurrent Request Sets

Recommended when maintaining multiple instances (i.e. development, test, production)

Page 90: Oracle D2K reports

90

FND Packages

FND_Program Functionality

Most procedures correspond to functionality provided by System Administration forms:

Others allow for checking for the existence of programs and components, and deleting existing programs and components

Use FND_Program.Message to display error messages.

FND_ProgramProcedure

Corresponding System AdministrationWindow

Executable Concurrent Program ExecutableRegister Concurrent ProgramParameter Concurrent Program ParametersIncompatibility Incompatible ProgramsRequest_Group Request Groups, master regionAdd_To_Group Request Groups, Requests region

Page 91: Oracle D2K reports

91

FND Packages

Register an Executable:

Package Name: FND_PROGRAM

Procedure Name: EXECUTABLE

Page 92: Oracle D2K reports

BEGIN FND_PROGRAM.EXECUTABLE

( executable => 'KKG_LST_OF_CNTRCTS', application => 'KKG Custom Application', short_name => 'KKG_LST_OF_CNTRCTS', description => 'KKG List Of Contract Report', execution_method => 'Oracle Reports', execution_file_name=> 'KKG_LST_OF_CNTRCTS');

END;

Example :

FND Packages

Page 93: Oracle D2K reports

93

FND Packages

Register Concurrent Program: Package: FND_PROGRAM

Procedure: REGISTER

Parameters:

Page 94: Oracle D2K reports

94

FND Packages

BEGIN FND_PROGRAM.REGISTER

(Program => 'KKG List Of Contract Report', Application => 'KKG Custom Application', Enabled => 'Y', Short name => 'KKG_LST_OF_CNTRCTS', Description => 'KKG List Of Contract Report', Executable_short_name => 'KKG_LST_OF_CNTRCTS', executable_application => 'KKG Custom Application', Save_output => 'Y', Print => 'N', Cols => NULL, Rows => NULL, Style => 'Landwide', Style_required => 'N', Printer => NULL, Output_type => 'Text', Use_in_srs => 'Y' , Nls_compliant => 'Y', Mls_function_short_name => NULL, Mls_function_application => NULL);

END;

Example :

Page 95: Oracle D2K reports

95

FND Packages

Assign a Program to a Request Group:Package: FND_PROGRAM

Procedure: PROGRAM_ADD_TO_GROUP

BEGIN FND_PROGRAM.PROGRAM_ADD_TO_GROUP (Program_short_name => 'KKG_LST_OF_CNTRCTS' , Program_application => 'KKG Custom Application' , Request_group => 'All Reports' , Group_application => 'Oracle Payables' );END;

Example :

Page 96: Oracle D2K reports

96

FND Packages

Register value sets for the concurrent program Package: FND_FLEX_VAL_API

Procedure: CREATE_VALUESET_TABLE

Parameters:

Page 97: Oracle D2K reports

97

FND Packages

BEGIN Fnd_flex_val_api.create_valueset_table ( Value_set_name => 'KKG_SUPPLIER_SITE',

description => 'Supplier Sites for KKG List Of Contract Report',

Security_available => 'N',Enable_longlist => 'N',Format_type => 'Char',Maximum_size => '150',Precision => NULL,Numbers_only => 'N',Uppercase_only => 'N',Right_justify_zero_fill => 'N',Min_value => NULL,Max_value => NULL,Table_application => 'Oracle Purchasing',Table_name => 'PO_VENDOR_SITES',Allow_parent_values => 'N',Value_column_name => 'VENDOR_SITE_CODE||''~''||

ATTRIBUTE1',Value_column_type => 'Varchar2',Value_column_size => '150',Meaning_column_name => 'VENDOR_SITE_CODE||''~''||

ATTRIBUTE1',Meaning_column_type => 'Varchar2', Meaning_column_size => '150',Id_column_name => 'VENDOR_SITE_CODE||''~''||

ATTRIBUTE1',Id_column_type => 'Varchar2',Id_column_size => '150',Where_order_by => 'where rowid in (select max

(rowid) From PO_VENDOR_SITESGroup by VENDOR_SITE_CODE||''~''||ATTRIBUTE1)',Additional_columns => NULL);

END;

Example :

Page 98: Oracle D2K reports

98

Tips

Report in Microsoft excel.

A character mode report that saves its output to a file with an extension of .Csv, will automatically be recognizable by MS excel.

Beware of traps when modifying existing reports!If you are modifying an existing report, you begin by FTP’ing it up to your PC and opening it in the reports designer there. Very often the report will give you error messages about missing packages. The messages should give you the name of the packages and you will be able to find them in the plsql subdirectory of the application to which the report belongs on the server side.

Page 99: Oracle D2K reports

99

Definitions

APPS schema. An ORACLE schema that has access to the complete oracle applications data model. Standard report submission (SRS).

The procedure to submit a background report to the concurrent manager using SRS is the same regardless of the product that owns the report. SRS takes advantage of shared flexfield value sets.Custom reports can be integrated into standard report submission so that they can be submitted and monitored using the same procedures as other oracle applications reports. Developers can set up certain menus and responsibilities to access custom reports or standard objects.

Repeating frames Repeating frames are used to display the rows of data that are retrieved for a group. Thus, they "repeat" until all the data is retrieved.

FramesFrames are used to keep layout objects together and can be used to protect layout objects from being overwritten by repeating frames at runtime.

Fields Fields define how columns appear in a report, such as the format of currency amounts and dates

Anchors Anchors are used to determine the relative positioning of one object to another in a report. The anchor attaches the anchored object, or child, to an anchoring object, or parent.

Page 100: Oracle D2K reports

Questions??

Page 101: Oracle D2K reports

Thank You