SRW.REFERENCE and SRW.USER_EXIT

To discuss Oracle Forms & Reports related technical issues.
Post Reply
oracle7
Posts: 3
Joined: Wed Nov 29, 2006 10:17 pm
Location: USA

SRW.REFERENCE and SRW.USER_EXIT

Post by oracle7 »

Hi Folks,
I couldn't understand properly about SRW.REFERENCE and SRW.USER_EXIT even I red about it in the reports manual. My question is why,where,and which condetion we can use this.Moreover, what is the purpose of this. If anyone knows, please post your valuble explanation. I would be very thankful to you.

Thanks,
Chaitanya.
admin
Posts: 2063
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

Post by admin »

SRW.REFERENCE: This procedure causes Report Builder to add the referenced object to the PL/SQL construct's dependency list. This causes Report Builder to determine the object's value just before firing the PL/SQL construct. This is useful when you want to ensure that a column value passed to a user exit is the most recently computed or fetched value.

/* Suppose you want to pass the temperature and pressure values
** to a user exit called SUPERHEAT. Suppose, also, that if the
** temperature is too low, you want to raise a customized error message.
** To do so, you could write the following formula:
*/


FUNCTION EXIT RETURN BOOLEAN IS
BEGIN
if :temp > 0 then
srw.reference (:temp); -- unnecessary reference
srw.reference (:pressure);
srw.user_exit('superheat temp pressure');
else srw.message(1000, 'Temperature is below
normal. Is machine off?');
raise srw.program_abort;
end if;
RETURN(TRUE);
END;

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

/* Suppose you have a user exit named STORE to which you want
** to pass salary values from Report Builder. To do so, you
** could write the following formula. For more information on
** how to call user exits, see Calling a user exit.
*/

FUNCTION FOO RETURN BOOLEAN IS
BEGIN
IF :SAL >= 0 THEN
SRW.REFERENCE(:SAL);
SRW.USER_EXIT('STORE SAL');
ELSE
SRW.MESSAGE(100, 'FOUND A NEGATIVE SALARY. CHECK THE
EMP TABLE.');
END IF;
EXCEPTION
WHEN SRW.UNKNOWN_USER_EXIT THEN
SRW.MESSAGE(200, 'STORE USER EXIT WAS UNKNOWN.
CHECK IF IT''S LINKED.');
WHEN SRW.USER_EXIT_FAILURE THEN
SRW.MESSAGE(200, 'STORE USER EXIT FAILED.
CHECK ITS CODE.');

RETURN(TRUE);
END;

Pl let us know what is the confusion after reading/experimenting example the reports help as shown above. thanks
oracle7
Posts: 3
Joined: Wed Nov 29, 2006 10:17 pm
Location: USA

Post by oracle7 »

Thanks Admin, I understood the srw.reference.See this formula column

function INV_LINE_DISPFormula return Char is
begin

srw.reference(:INV_LINE);
srw.reference(:inv_curr);
srw.reference(:INV_CURR_PRECISION);
srw.user_exit('FND FORMAT_CURRENCY
CODE=":inv_curr"
DISPLAY_WIDTH="16"
AMOUNT=":INV_LINE"
DISPLAY=":INV_LINE_DISP"
MINIMUM_PRECISION=":INV_CURR_PRECISION"');
return(:INV_LINE_DISP);

end;

function INV_LINE_DISPFormula return Char is
begin

In srw.reference,:INV_LINE, :inv_curr, and :INV_CURR_PRECISION are place holders. I understood this but, in srw.user_exit, the user_exit name FND is used. what is the purpose of this and even some placeholders are not in srw.reference , was used in srw.user_exit(DSPLAY_WIDTH="16",DISPLAY=":INV_LINE_DISP"
);
I wont understand about the user_exit_string in srw.user_exit.

Thanks,
Chaitanya.
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests