How to connect SQL*PLUS from UNIX Shell : Example 1:
SRW.PROGRAM_ABORT;
SRW.DO_SQL_FAILURE This exception stops the report execution and raises the following error message:
REP-‐1425: Error running DO_SQL package -‐ REP-‐msg ORA-‐msg
SRW.DO_SQL_FAILURE;
Usage Notes:
Report Builder raises this exception when the SRW.DO_SQL packaged procedure fails.
EXCEPTION
when SRW.DO_SQL_FAILURE then
srw.message(1000, ’Error occurred while creating table CHECKS.’);
SRW.GET_PAGE_NUM This function returns the current page number. This is useful when you want to use the page number in the field’s Format Trigger property.
SRW.GET_PAGE_NUM (page_num);
Restriction: it is only meaningful in a format trigger.
SRW.MESSAGE This procedure displays a message with the message number and text that you specify.
SRW.MESSAGE (msg_number NUMBER, msg_text CHAR);
EXCEPTION
when srw.unknown_user_exit then
srw.message(1000, ’User exit MYEXIT failed.Call Karen Smith x3455.’);
raise srw.program_abort;
SRW.PROGRAM_ABORT This exception stops the report execution and raises the following error message:
REP-‐1419: PL/SQL program aborted.
SRW.PROGRAM_ABORT;
SRW.RUN_REPORT This procedure invokes RWRUN60 with the string that you specify. This procedure is useful for:
o running drill-‐down reports (i.e., calling a report from a button’s action trigger) o sending parts of a report to different recipients (e.g., to send a report via e-‐mail
to each manager with just his or her group’s data)
o sending parts of a report to different printers (e.g., to send each manager’s report to his or her printer)
o running multiple reports from a single "driver" report
srw.run_report(’report=MAIL_IT
desname=’||:ename ||’ desformat=dflt batch=yes mgr_no=’|| TO_CHAR(:empno) );
SRW.RUN_REPORT_FAILURE If the SRW.RUN_REPORT packaged procedure fails, this exception stops the report execution and raises the following error message:
REP-‐1428: Error while running SRW.RUN_REPORT.
EXCEPTION
WHEN srw.run_report_failure then srw.message(30, ’Error mailing reports.’);
raise srw.program_abort;
SRW.USER_EXIT This procedure calls the user exit named in user_exit_string. It is useful when you want to pass control to a 3GL program during a report’s execution.
SRW.USER_EXIT20 This procedure is the same as SRW.USER_EXIT, except that it calls the user exit with five arguments instead of just two. This enables you to share user exits with other Oracle products, such as Oracle Forms, which pass five arguments instead of two.
SRW.USER_EXIT_FAILURE This exception is raised when the user exit you called has failed. When called, it stops the report execution and raises the following error message:
REP-‐1416: User exit <exit_name> failed.
EXCEPTION
when SRW.USER_EXIT_FAILURE then
SRW.MESSAGE(200, ’PASS user exit failed. Check its code.’);
What are User Exits in oracle Reports?
It’s an API which provides easy way to pass control from report builder to 3GL program that performs some function and then returns control back to report builder.
Using these we can integrate oracle reports with oracle apps AOL and run them as concurrent programs. Below are some AOL integrations.
FND SRWINIT § This is a User Exit which sets your profile option values and allows Oracle AOL user exits to detect that they have been called by oracle repots.
§ FND SRWINIT also allows your report to use the correct organization automatically.
§ Can be used in BEFORE-‐REPORT Trigger.
FND_SRWEXIT § This user exit ensures that all the memory allocated for AOL user exits has been freed up properly.
§ Can be used in AFTER-‐ REPORT Trigger.
FND
FORMAT_CURRENCY • To format the currency amount dynamically depending upon the precision of the actual currency value, standard precision, users profile values and location (country) of the site.
• You obtain the currency value from the database into an Oracle Reports column.
Define another Oracle Reports column, a formula column of type CHAR, which executes the FORMAT_CURRENCY user exit to format the currency value. A displayed field has this formula column as its source so that the formatted value is automatically copied into the field for display.
Syntax:
FND FORMAT_CURRENCY
CODE=:column containing currency code
DISPLAY_WIDTH=field width for display
FND FLEXSQL Call this user exit to create a SQL fragment usable by your report to tailor your 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. You call this user exit once for each fragment you need for your select statement. You define all flexfield columns in your report as type CHARACTER even though your table may use NUMBER or DATE or some other datatype.
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"]
FND FLEXIDVAL Call this user exit to populate fields for display. You pass the key flexfields data retrieved by the query into this exit from the formula column. With this exit you display values,
descriptions and prompts by passing appropriate token (any one of VALUE, DESCRIPTION, APROMPT or LPROMPT).
[NUM=":structure defining source column/lexical"]
[DISPLAY="{ALL|flexfield qualifier|segment number}"]
[PADDED_VALUE=":output column name"]
[SECURITY=":column name"]
This is an AOL user exit available to populate key flexfields for display
CODE means Key flexfield code
(GL# is for Accounting Flex field, for all other check the table FND_ID_FLEXS)
NUM is the structure of the key flex field(Chart of Accounts Number)
DATA is where you store the retrieved data (your sql output).
The userexit call FND FLEXIDVAL :
Properties Usage: Only Important properties discussed.