Many times users wants to control the status of concurrent program, specially in unix it is difficult to complete the program in warning status. Following code snippet will be useful programmers who wants to set the concurrent program status.
In generally,
For PL/SQL program status is controlled by retcode, if retcode is 0 for sucessful completion, 2 for error and 1 for warning.
Same in Unix, exit 1 indicates error and exit 0 indicates successful completion but for warning you don't have direct way. In those cases we need to use following function.
################################################################################
This function sets the completion status
################################################################################
set_completion_status(){count_status=`sqlplus -s << EOSQL
$APPSLOGIN
WHENEVER SQLERROR EXIT SQL.SQLCODE
SET HEADING OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET LINESI 100
SET PAGESI 0
SELECT COUNT(1)
FROM ikncu.RAC_FUTURE_ACK_TEMP
WHERE process_flag IN ('ERROR')
AND po_request_id = $FCP_REQID;
EXIT EOSQL`
sqlplus -s << EOSQL
$APPSLOGIN WHENEVER SQLERROR EXIT SQL.SQLCODE
SET FEEDBACK OFF DECLARE l_stat BOOLEAN;
l_session_id NUMBER;
BEGIN
fnd_global.initialize(session_id => l_session_id
, user_id => fnd_global.user_id
, resp_id => fnd_global.resp_id
, resp_appl_id => fnd_global.resp_appl_id
, security_group_id => null
, site_id => null
, login_id => null
, conc_login_id => null
, prog_appl_id => null
, conc_program_id => null
, conc_request_id => $FCP_REQID
, conc_priority_request => null);
IF($count_status = 0)THEN
ci_utility_pkg.spool('inside if block');
l_stat :=
fnd_concurrent.set_completion_status('NORMAL','Normal Completion. Review log for details.');
ci_utility_pkg.spool($count_status);
ELSE
l_stat := fnd_concurrent.set_completion_status('WARNING','Completed in Warning. Review log for details.');
ci_utility_pkg.spool($count_status);
END IF;
COMMIT;
END;
/
EXIT;
EOSQL
}
No comments:
Post a Comment