Professional Documents
Culture Documents
My Oracle Cafe
Sharing my learning from an wonderful journey..
Happy Reading...
Search
Home
Oracle Apps
Oracle Technologies
My World
Forum
Contact Us
SRW (Sql Report Writer) Package is a built in package in Oracle Reports Builder. 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 statements. There 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: Feedback 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: 1 2 3 4 5 6 7 8 9 1 0 f u n c t i o nf o or e t u r nb o o l e a ni s b e g i n i f: s a l<0t h e n S R W . M E S S A G E ( 1 0 0 ,' F o u n dan e g a t i v es a l a r y .C h e c k t h eE M Pt a b l e . ' ) ; r a i s eS R W . P R O G R A M _ A B O R T ; e l s e : b o n u s: =: s a l*. 0 1 ; e n di f ; r e t u r n ( t r u e ) ;
?
myoraclecafe.com/2011/05/20/srw-package-in-oracle-report/
1/10
11/28/13
e n d ; 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: 1 2 3 4 5 6 7 8 9 1 0 1 1 F U N C T I O NC R E A T E T A B L ER E T U R NB O O L E A NI S B E G I N S R W . D O _ S Q L ( ' C R E A T ET A B L ET E S T _ E M P( E M P N ON U M B E RN O T N U L L P R I M A R YK E Y ,S A LN U M B E R( 1 0 , 2 ) )P C T F R E E5P C T U S E D 7 5 ' ) ; R E T U R N( T R U E ) ; E X C E P T I O N W H E NS R W . D O _ S Q L _ F A I L U R E T H E N S R W . M E S S A G E ( 1 0 0 ,' E R R O RW H I L EC R E A T I N GT E S T _ E M P T A B L E . ' ) ; R A I S E S R W . P R O G R A M _ A B O R T ; E N D ;
?
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: 1 2 3 4 5 6 7 f u n c t i o nA f t e r P F o r mr e t u r nb o o l e a ni s m y _ v a rv a r c h a r 2 ( 8 0 ) ; B E G I N S R W . G E T _ R E P O R T _ N A M E( m y _ v a r ) ; S R W . M E S S A G E ( 0 , ' R e p o r tF i l e n a m e=' | | m y _ v a r ) ; R E T U R N( T R U E ) ; E N D ;
?
myoraclecafe.com/2011/05/20/srw-package-in-oracle-report/
2/10
11/28/13
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 fields 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 employees salary. In the format trigger for the field, you could type the following: 1 2 3 4 5 6 7 8 9 1 0 1 1 F U N C T I O NC H G F I E L DR E T U R NB O O L E A NI S T M PN U M B E R ; B E G I N i f: s a l> =5 0 0 0t h e n t m p: =: s a l*1 . 1 0 ; s r w . s e t _ f i e l d( 0 ,t m p ) ; e l s e s r w . s e t _ f i e l d( 0 ,4 0 0 0 ) ; e n di f ; R E T U R N( T R U E ) ; E N D ;
?
SRW.SET_FIELD should be used only to change the contents of a fields 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);
myoraclecafe.com/2011/05/20/srw-package-in-oracle-report/
3/10
11/28/13
Share
Share
Share
Share
Share
Share
Related Posts:
How to design An Accounting Flexfield Parameter for your Report? Bind & Lexical Parameters in Reports Calling a Report from a Form User Exits in Oracle Reports Summary column vs. Formula Column vs. Placeholder Column
7 Comments
Wann
August 30, 2011 at 7:47 pm
wann
July 12, 2012 at 3:11 pm
Alice Gheorghiu
October 7, 2011 at 1:09 am
Great article. Just what I needed for the report I am working on. reply to comment
sudhakar
February 23, 2012 at 6:38 am
myoraclecafe.com/2011/05/20/srw-package-in-oracle-report/
4/10
11/28/13
jeferson
March 22, 2012 at 6:14 pm
S
February 21, 2013 at 5:14 pm
Great articleIs there any way we can set the format mask runtime ? I have to get a format mask from a packaged function and then set it to all date fields. reply to comment
Sudeep
April 19, 2013 at 7:28 am
Hi. We are integrating one external application with Oracle Apps R12. My requirement is to send Oracle Concurrent Program(report) output to this external application upon completion of request so that user how is accessing this external application can open the report output in his browser. Will you please suggest me how to achieve this. Thanks, Sudeep reply to comment
Leave a Reply
MOC F orum
11/28/13
Enter your email address to subscribe to this blog and receive notifications of new posts by email. Join 17 other subscribers
Email Address
Subscribe
A visitor from Abu Dhabi viewed "R12 Supplier Bank Accounts | My Oracle Cafe" 2 mins ago A visitor from Minneapolis, Minnesota viewed "Deriving Oracle GL Account Code Combination IDs (CCIDs) through APIs | My Oracle Cafe mins ago A visitor from Mumbai, Maharashtra viewed "Key Tables in Oracle Inventory | My Oracle Cafe" 4 mins ago A visitor from Bangalore, Karnataka viewed "XDOLoader Utility to upload XML Templates | My Oracle Cafe" 5 mins ago A visitor from Bangalore, Karnataka viewed "Oracle.apps.fnd.framework.webui.OADialogPage | My Oracle Cafe | My Oracle Cafe" 6 mins ago A visitor from Tokyo viewed "How to customize a LOV in OAF (VO Extension)? | My Oracle Cafe 9 mins ago A visitor from Dallas, Texas viewed "How To Format Numbers In BI Publisher Template | My Oracle Cafe | My Oracle Cafe" 12 mins ago A visitor from India viewed "MTL_SYSTEM_ITEMS_INTERFACE | My Oracle Cafe | My Oracle Cafe" 26 mins ago A visitor from India viewed "How to Export Data from your OAF Pages? | My Oracle Cafe" 29 mins ago
Recent Posts
Unix for Oracle Apps FAQs in ADF: Basic Architecture
myoraclecafe.com/2011/05/20/srw-package-in-oracle-report/ 6/10
11/28/13
XML Data Definition, Data Template & RTF Template Migration How to make an OAF Page Read Only? FND_GLOBAL.APPS_INITIALIZE Setting the Applications Context Table/View Changes in R12: Payables How to create customer in TCA via API? OAF Extension Add new Field on OAF page
Recent Comments
Subbu on Registering Reports in Oracle Application malin on OAF Extension Add new Field on OAF page Dibyajyoti Koch on OAF Extension Add new Field on OAF page malin on OAF Extension Add new Field on OAF page Avijit Karmakar on API to update and assign Project Roles in an Oracle Project Akil Pariyani on API to Assign Item to an Organization in Oracle Inventory Akil Pariyani on API to Assign Item to an Organization in Oracle Inventory Garcinia Cambogia on HZ tables in Oracle Receivables
Popular Posts
HZ tables in Oracle Receivables Supplier API in R12 The Runtime Process of a Oracle Form R12 Supplier Bank Accounts Interfaces in Oracle Application: An Introduction Attachment in Oracle Application Triggers in Oracle Forms Steps to Create Report in Oracle Reports Builder 10g Oracle Applications R12 Architecture Key Tables in Oracle Inventory
Archives
Select Month
Categories
ADF (3) AOL (46) APIs (18) Apps Tables (9) Architecture (9)
myoraclecafe.com/2011/05/20/srw-package-in-oracle-report/ 7/10
11/28/13
Discoverer (11) Forms (14) General Ledger (6) Interface (8) Java (1) Life (7) OA Framework (19) Oracle Inventory (8) Oracle Projects (9) Oracle Workflow (5) Payables (15) Photography (19) Random Post (11) Receivables (12) Reports (10) Script (23) Short Story (11) Simply Oracle (4) SQL*Loader (4) SQL-PL/SQL (19) Technology (2) Travel (9) Unix (3) Xml Publisher (8)
Meta
Register Log in Entries RSS Comments RSS WordPress.org
Feat ured P os t s
Unix for Oracle Apps November 28, 2013
11/28/13
XML Data Definition, Data Template & RTF Template Migration November 21, 2013
MOC on FB
My Oracle Cafe
Like 17 people like My Oracle Cafe.
P ages
About Me Contact Us Contribute a Post Forum Get Trained! Home My Photography
11/28/13
Avijit Karmakar on API to update and assign Project Roles in an Oracle Project
Dis c laimer
The opinions expressed here represent solely my own represent personal conjecture based upon experience, practice and observation and does not represent the thoughts, intentions, plans or strategies of Oracle Corporation, my employers and their clients.
Tags
accounting flexfield Concurrent Program General Ledger OA Framew ork Oracle Forms photoghaphy SQL*LOADER GL Oracle account payables D2K Discoverer ADF FAQs AP API FNDLOAD key flexfields AR assam AutoInvoice
Interfaces
JDeveloper
Oracle AOL
Oracle Apps
Receivables w orkflow
value sets
XML Publisher
All contents are property of myoraclecafe.com and subject to international copyright law s. 2010-2013 Copyright My Oracle Cafe. All Rights Reserved.
myoraclecafe.com/2011/05/20/srw-package-in-oracle-report/
10/10