Tuesday, July 1, 2014

To Make a Concurrent Program Error Out or Warning.

I have come across this situation when i was in need to test an alert which i created to fire when any concurrent programs error out.So to check the alert created,I changed the procedure with the code as shown below which will error out.

As we all know there are two mandatory parameters that need to be passed for all the procedures called

1.ERRBUFF
2.RETCODE..

Based on the business process if there is any undefined exception occurred while running concurrent program, we can end the concurrent program with Error/Warning.

Define ERRBUFF as the first parameter and RETCODE as the second one. Mention them as OUT variable type.

CREATE PROCEDURE PROCEDURE_NAME (errbuf OUT VARCHAR2,retcode OUT VARCHAR2)

The retcode has three values returned by the concurrent manager

0--Success
1--Success & warning
2--Error

we can set the concurrent program to any of the above three statuses by using these values in the retcode parameter.

Example1:

BEGIN
.....
EXCEPTION
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Unhandled exception occurred in package. ErrMsg: '||SQLERRM);
 retcode:='2';
END;

Example2:

CREATE OR REPLACE procedure APPS.XXXX_HTS_SO_UPDATE_PRC(ERRBUF OUT VARCHAR2,
RETCODE OUT NUMBER) is
v varchar2(10);
BEGIN
select vendor_id into v
from po_vendors
where vendor_id=15000;
EXCEPTION
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Unhandled exception occurred in procedure. ErrMsg: '||SQLERRM);
retcode:='2';
END;


Even you can use fnd_concurrent.set_completion_Status to send the concurrent program to more status than success,error and warning.

Challa.

No comments:

Post a Comment